Repository navigation
Release Title: Initial Release of DistillPDF v0.1.0
Release Description:
DistillPDF v0.1.0 marks the initial release of a Python script designed for high-performance PDF optimization and transformation. This version introduces a comprehensive suite of features aimed at improving PDF file management and performance, particularly for environments where file size reduction and data privacy are critical.
Features Included:
- Image Resizing and Compression: Automatically adjusts images within PDFs to predefined dimensions and compresses them to reduce file size without significant loss of quality.
- Grayscale Conversion: Converts colored images within PDFs to grayscale to simplify the file and reduce its size.
- Flattening of Annotations and Form Fields: Converts interactive elements into static images to ensure compatibility across various PDF viewers.
- Font Subsetting: Includes only the characters used in the document, significantly reducing the file size, especially for documents with embedded fonts.
- Metadata Removal: Strips metadata from PDF files to enhance privacy and security.
- Clean-up of Unreferenced Resources: Removes unused objects and resources from PDF files to further reduce the file size.
- Content Stream Optimization: Optimizes the entire content stream of PDF pages by removing unnecessary data.
- Vector Graphic Simplification: Utilizes Bayesian optimization techniques to reduce the complexity of vector graphics in PDFs without noticeable visual alterations.
- Multi-threaded Processing: Supports multi-threaded operations to enhance performance on suitable hardware.
- Detailed Logging: Provides extensive logs for process tracking and troubleshooting.
Setup Instructions:
Ensure you have Python version 3.8.x installed. Install necessary dependencies with:
pip install -r requirements.txt
chmod +x distillpdfFor ease of use, it is recommended to move the distillpdf script to a directory included in your system's PATH.
Usage:
To use DistillPDF, provide an input PDF file and an output destination, along with optional flags for grayscale conversion and flattening:
./distillpdf input.pdf output.pdf --threads=4 --grayscale --flattenTechnical Stack:
The script leverages libraries such as PyMuPDF (fitz), pikepdf, PIL, OpenCV, scikit-learn, scipy, and numpy, integrating advanced image processing, machine learning for optimization decisions, and direct PDF manipulation capabilities.
Licensing:
DistillPDF is open-source software licensed under the GNU Affero General Public License v3.0, ensuring it remains free and accessible for modification and redistribution under the same license.