A professional, open-source Python toolkit for working with PDF files.
PDFForge is a modular Python PDF toolkit designed to make common PDF operations simple, reliable, and easy to extend.
The project follows clean software architecture principles, including Clean Code, SOLID principles, modular design, dependency injection, and design patterns.
| Feature | Status |
|---|---|
| PDF → Images | Available |
| Page Selection | Available |
| Custom Output Directory | Available |
| Automatic Unique Output Directories | Available |
| Interactive CLI | Available |
| Non-interactive CLI | Available |
| Drag & Drop Support | Available |
| Paths containing spaces without quotes | Available |
| Shell Operator Handling | Available |
| Colored terminal output | Available |
| Real-time Progress Display | Available |
Graceful Ctrl+C handling |
Available |
| Merge PDFs | Planned |
| Split PDFs | Planned |
| Extract Text | Planned |
| Encrypt / Decrypt PDFs | Planned |
| Rotate Pages | Planned |
| Compress PDFs | Planned |
| Add Watermarks | Planned |
More PDF operations will be added as the project evolves.
PDFForge aims to become a complete and extensible PDF toolkit for Python developers and everyday users.
The main goals of the project are:
- Provide a clean and maintainable PDF processing architecture.
- Make PDF operations accessible through a simple CLI.
- Support both interactive and non-interactive usage.
- Keep individual PDF operations modular and independent.
- Make the project easy for other developers to extend.
- Follow modern Python development practices.
- Provide a foundation for future PDF processing features.
PDFForge is designed around several important principles.
Each PDF operation is separated into its own logical component.
New operations can be added without unnecessarily changing existing functionality.
The architecture is designed to make individual components easier to test.
The project follows clean-code principles and attempts to keep responsibilities separated.
The CLI provides colored output, tables, panels, progress indicators, and an interactive shell powered by Rich.
Clone the repository:
git clone https://github.com/roy-twsl/PDFForge.gitEnter the project directory:
cd PDFForgeInstall the required dependencies:
pip install -r requirements.txtFor development, install the project in editable mode:
pip install -e .PDFForge supports two primary CLI modes:
- Interactive mode
- Non-interactive mode
Run PDFForge without any arguments:
pdfforgeThis starts the PDFForge Interactive Shell.
The shell provides:
- Colored output
- Command tables
- Progress indicators
- Interactive commands
- Error handling
- Graceful interruption
Example:
╔══════════════════════════════════════════════════════════╗
║ PDFForge ║
║ ║
║ Python PDF Toolkit ║
╚══════════════════════════════════════════════════════════╝
After starting the shell, commands can be entered directly:
pdfforge> help
Convert a PDF:
pdfforge> convert document.pdf --zoom 2.0
Convert a PDF using JPG:
pdfforge> convert document.pdf --zoom 2.0 --format jpg
Exit the interactive shell:
pdfforge> exit
You can also use:
pdfforge> quit
or press:
Ctrl+C
PDFForge currently supports converting PDF pages into image files.
Basic usage:
pdfforge convert document.pdfSpecify the zoom level:
pdfforge convert document.pdf --zoom 2.5Specify the output format:
pdfforge convert document.pdf --format jpgBoth png and jpg are currently supported.
Example:
pdfforge convert document.pdf --zoom 2.5 --format pngPDFForge can convert only selected pages instead of processing the entire PDF.
Select a single page:
pdfforge convert document.pdf --pages 5Select a range:
pdfforge convert document.pdf --pages 20-46Select multiple pages:
pdfforge convert document.pdf --pages 1,3,5Combine individual pages and ranges:
pdfforge convert document.pdf --pages 1,3,5-10,20This allows you to process only the pages you need.
PDFForge supports both automatic and custom output directories.
By default, PDFForge creates an available output directory for generated images. If a directory already exists, a unique directory name is generated instead of overwriting the existing output.
For example:
images/
images_1/
images_2/
You can also specify your own output directory:
pdfforge convert document.pdf --output-dir my_outputPage selection and a custom output directory can be combined:
pdfforge convert document.pdf --pages 1,3,5-10,20 --output-dir selected_pagesPDFForge supports paths containing spaces without requiring quotation marks.
For example:
pdfforge convert D:/My Documents/Annual Report.pdfThe same functionality is available inside the interactive shell:
pdfforge> convert D:/My Documents/Annual Report.pdf
Quoted paths are also supported:
pdfforge convert "D:/My Documents/Annual Report.pdf"PDF files can be dragged directly into the PDFForge terminal workflow.
This is especially useful on Windows because a file path can be inserted into the terminal automatically instead of being typed manually.
PDFForge is designed to handle common drag-and-drop path formatting, including paths containing spaces.
The interactive shell handles common shell operator characters that may appear when paths are pasted or dragged into the terminal.
Examples include:
&
|
;
These characters are handled so they do not unnecessarily break a PDF path during normal PDFForge shell usage.
PDFForge displays conversion progress while processing PDF pages.
The progress display provides information such as:
- Current page
- Percentage completed
- Elapsed time
- Overall conversion progress
This makes longer conversions easier to monitor.
After a conversion, PDFForge limits the number of generated image paths displayed in the terminal when many files are produced, keeping the output clean and readable.
PDFForge can also be used directly from the command line without entering the interactive shell.
Example:
pdfforge convert document.pdfWith page selection:
pdfforge convert document.pdf --pages 1,3,5-10With a custom output directory:
pdfforge convert document.pdf --output-dir outputWith custom zoom and format:
pdfforge convert document.pdf --zoom 2.0 --format jpgThis mode is useful for scripts, automation, and command-line workflows.
To display the main help information:
pdfforge --helpInside the interactive shell:
pdfforge> help
The interactive help system displays the available commands, descriptions, and examples.
PDFForge is designed to handle user interruption gracefully.
Pressing:
Ctrl+C
during an interactive session exits the shell cleanly.
If Ctrl+C is pressed during a PDF conversion, the current operation is interrupted and the application handles the interruption without producing an unnecessary unhandled traceback.
The project is organized into separate layers and components to keep responsibilities isolated.
A simplified structure looks like this:
PDFForge/
│
├── pdfforge/
│ ├── core/
│ ├── services/
│ ├── operations/
│ │ └── convert/
│ └── cli.py
│
├── tests/
│
├── README.md
├── CONTRIBUTING.md
├── LICENSE
├── requirements.txt
└── pyproject.toml
The exact structure may evolve as new PDF operations are added.
PDFForge is designed to make adding new PDF operations straightforward.
A typical workflow is:
- Create the new operation inside the appropriate package.
- Implement the required operation interface.
- Keep the operation focused on a single responsibility.
- Register the operation in the appropriate service layer.
- Add the corresponding CLI command.
- Support both interactive and non-interactive usage when appropriate.
- Add tests for the new functionality.
- Update the documentation.
The goal is to keep new functionality isolated rather than creating unnecessary dependencies between existing components.
Contributions are welcome.
You can contribute by:
- Reporting bugs
- Suggesting new PDF operations
- Improving existing functionality
- Adding tests
- Improving documentation
- Fixing bugs
- Improving CLI usability
- Adding new features
Before making significant changes, please read:
CONTRIBUTING.md
A typical contribution workflow is:
git checkout -b feature/my-featureMake your changes, test them, and commit:
git add .
git commit -m "Add my feature"Push your branch:
git push -u origin feature/my-featureThen open a Pull Request on GitHub.
For larger changes, please describe what was changed and why.
When contributing to PDFForge, try to follow these principles:
- Follow PEP 8.
- Use meaningful names.
- Use type hints where appropriate.
- Keep functions small and focused.
- Follow the Single Responsibility Principle.
- Avoid unnecessary duplication.
- Add docstrings to public classes and methods.
- Keep business logic separate from CLI presentation.
- Use the existing architecture instead of introducing unnecessary alternatives.
- Handle errors gracefully.
- Add or update tests when changing functionality.
For CLI-related changes, use the existing Rich-based presentation style instead of introducing a different terminal UI framework.
Before submitting a Pull Request, contributors should verify that their changes do not break existing functionality.
At minimum, test:
- PDF conversion
- Page selection
- Custom output directories
- Automatic unique output directories
- Interactive shell startup
helpconvert- Paths containing spaces
- Quoted paths
- Drag & drop input
- Shell operator handling
Ctrl+Chandling- Invalid commands
- Invalid input files
- Non-interactive CLI usage
- Progress display
If tests are added or modified, make sure they pass before opening the Pull Request.
The long-term goal of PDFForge is to provide a complete PDF toolkit.
Planned operations include:
- PDF merging
- PDF splitting
- Text extraction
- PDF encryption
- PDF decryption
- Page rotation
- PDF compression
- Watermarks
- Metadata management
- Additional PDF transformations
- Improved automation support
The roadmap may change as the project develops.
Maintainer: Roy
GitHub: @roy-twsl
Repository: github.com/roy-twsl/PDFForge
For bugs, feature requests, and technical discussions, please use the GitHub repository's issue and discussion features.
PDFForge is released under the GNU General Public License v3.0.
You are free to:
- Use the software
- Study the source code
- Modify the software
- Distribute copies
- Distribute modified versions
However, when distributing the software or derivative works, the conditions of the GNU GPL v3.0 must be respected.
The original copyright and attribution must not be removed.
See the LICENSE file for the complete license text.
PDFForge is built with the help of the Python open-source ecosystem.
Special thanks to the projects and communities that make modern PDF processing possible.
PDFForge is an open-source project created with the goal of building a powerful, maintainable, and extensible PDF toolkit for Python.
The project is continuously evolving, and new PDF operations and improvements will be introduced over time.
Built with Python. Built for PDFs. Built for developers.
Copyright © 2026 Roy