Cause: Poppler is not installed or not in your PATH.
Solution:
# macOS
brew install poppler
# Ubuntu/Debian
sudo apt-get install poppler-utils
# Fedora/RHEL
sudo dnf install poppler-utilsVerify installation:
pdftoppm -vCause: Pillow is not installed.
Solution:
pip install PillowCause: pdf2image is not installed.
Solution:
pip install pdf2imageCause: The input file path is incorrect or the file doesn't exist.
Solution:
- Check the file path is correct
- Use absolute paths if relative paths aren't working
- Ensure you have read permissions for the file
# Use absolute path
python3 securecompress_cli.py --input /full/path/to/input.pdf --output output.pdf --size 5Cause: No write permission in the output directory.
Solution:
- Check directory permissions
- Try writing to a different directory
- Use a directory you own
# Write to home directory
python3 securecompress_cli.py --input input.pdf --output ~/output.pdf --size 5Cause: The PDF cannot be compressed to the target size without severe quality loss.
Solutions:
- Increase the target size
- Use more aggressive settings:
python3 securecompress_cli.py \ --input input.pdf \ --output output.pdf \ --size 5 \ --dpi 120 \ --mode gray \ --max-passes 4
- Use black and white mode for text documents:
--mode bw
Cause: Insufficient RAM for processing large PDFs.
Solutions:
- Close other applications
- Process smaller PDFs
- Use lower DPI:
--dpi 120
- Split the PDF into smaller parts and process separately
Cause: High DPI, many pages, or multiple passes.
Solutions:
- Reduce DPI:
--dpi 150
- Reduce max passes:
--max-passes 1
- Disable quality check:
# Don't use --quality-check - Use object engine for text documents:
--engine object --content-type text
Cause: Too aggressive compression settings.
Solutions:
- Increase target size
- Increase DPI:
--dpi 250
- Enable quality check:
--quality-check --quality-threshold 0.85
- Use adaptive compression:
--adaptive
- Use color mode instead of grayscale:
--mode color
Cause: The PDF is corrupted, encrypted, or not a valid PDF.
Solutions:
- Verify the file is a valid PDF
- Try opening it in a PDF reader
- If encrypted, decrypt it first
- Try repairing the PDF with another tool
Cause: Certain pages have issues or are too complex.
What happens: The CLI will skip failed pages and continue with others.
Solutions:
- Check the summary for
failed_pageslist - Try with different settings
- Extract and process failed pages separately
- Consider using the GUI version for better error handling
Cause: Process was killed forcefully or crashed.
Solution:
# Manually remove temporary directories
rm -rf sc_temp_frames_pass*Cause: Ghostscript is not installed (optional dependency).
Impact: Object-level compression won't be available, but raster compression will still work.
Solution (optional):
# macOS
brew install ghostscript
# Ubuntu/Debian
sudo apt-get install ghostscript
# Fedora/RHEL
sudo dnf install ghostscriptCause: Mixing JSON output with other print statements.
Solution: Only parse lines that are valid JSON:
for line in process.stdout:
try:
data = json.loads(line.strip())
# Process data
except json.JSONDecodeError:
# Skip non-JSON lines
continueCause: Very large page or complex graphics.
Solutions:
- Wait longer (some pages take time)
- Use Ctrl+C to cancel gracefully
- Reduce DPI
- Try with
--engine object
If you're still having issues:
-
Check the documentation:
-
Search existing issues:
- GitHub Issues: https://github.com/yourusername/securecompress-cli/issues
-
Create a new issue:
- Include your OS and Python version
- Include the full command you ran
- Include the error message
- Include a sample PDF if possible (or describe it)
-
Consider the GUI version:
- QuantPDF Pro has better error handling
- Includes support and updates
- Visit: https://quantpdf.com
For detailed debugging information, use the --log option:
python3 securecompress_cli.py \
--input input.pdf \
--output output.pdf \
--size 5 \
--log debug.logThen check debug.log for detailed information about what went wrong.
Minimum:
- Python 3.7+
- 2GB RAM
- 1GB free disk space
- Poppler installed
Recommended:
- Python 3.9+
- 4GB+ RAM
- 5GB+ free disk space
- Poppler and Ghostscript installed
- Free version limits: 25MB input, 20 pages maximum
- PDF features: May lose forms, annotations, JavaScript, etc.
- Encrypted PDFs: Cannot process password-protected PDFs
- Memory usage: Large pages require significant RAM
- Processing time: Large PDFs can take several minutes
For unlimited processing and advanced features, consider QuantPDF Pro: https://quantpdf.com