PDF-Toolkit
- 3 Devlogs
- 2 Total hours
A small Python CLI tool for working with PDF files.
A small Python CLI tool for working with PDF files.
The PDF Toolkit is starting to feel like a real application now.
After finishing the main PDF operations and the interactive CLI, I focused this time on adding text extraction and improving the overall reliability of the program.
I added a new PDF → Text operation using PyMuPDF.
The tool goes through the pages of a PDF, extracts the text and saves everything into a .txt file.
This makes it possible to quickly get the text from a PDF without manually copying it page by page.
The extracted text keeps the content from all pages in the document.
I also spent some time making the CLI more reliable.
The program now handles common problems such as:
Instead of crashing immediately, the CLI can display an error and return to the main menu.
The CLI now gives clearer feedback when an operation finishes.
For example:
✓ PDF merged successfully!
If an operation fails, the user gets an error message instead of being left with a Python traceback.
This makes the tool much easier to use, especially for someone who doesn’t know how the code works internally.
I also added basic command-line options to make the program easier to use outside of the interactive menu.
The application now supports:
--help
for displaying information about the available commands and options, and:
--version
for displaying the current version of PDF Toolkit.
These are small additions, but they make the project feel much more like a proper command-line application.
At this point, PDF Toolkit supports:
--help--versionThe project is now much more complete than when I started.
I’ve been testing the different operations both individually and through the CLI.
The main goal is to make sure that the normal workflow works correctly while also handling common user mistakes without crashing the application.
There are still things I want to test more thoroughly before calling the project finished, especially when packaging it for other computers.
The core functionality is now basically finished.
The next step is no longer about adding lots of new features. I want to focus on actually shipping the project.
The next stage will be:
.exe
v1.0.0 🚀
The goal is to have a version that someone can download and use without needing to manually set up the Python environment.
The first usable version of the PDF Toolkit CLI is now complete.
I created cli.py and connected all of the PDF operations that were already implemented to a single interactive interface.
The CLI is built using Questionary for the terminal menu and Tkinter file dialogs for selecting input and output files.
The CLI currently supports:
Each operation can now be selected directly from the terminal.
Instead of requiring users to manually type file paths, the CLI uses Tkinter file dialogs to select files and folders.
For example, when merging PDFs, the user can:
The same approach is used for the other operations where appropriate.
The CLI asks the user for the page number and then allows them to choose where the generated image should be saved.
For splitting PDFs, the user can select:
This keeps the generated files organized.
The CLI also supports the page selection syntax implemented in the extraction function.
For example:
1-5
or:
1,3,5-8
The selected pages are then saved into a new PDF.
The core PDF operations are now implemented and accessible through the CLI.
The project has moved from individual PDF functions to an actual usable command-line application.
The next step is to improve the CLI experience and make the tool more reliable.
Possible improvements include:
I’ve started building PDF Toolkit, a small Python command-line utility for working with PDF files.
The goal is to keep it simple and modular, while gradually adding useful PDF operations.
PDF-Toolkit/
├── main.py
├── requirements.txt
├── operations/
│ ├── __init__.py
│ ├── merge.py
│ ├── convert.py
│ ├── split.py
│ └── extract.py
└── tests/
├── __init__.py
└── test_merge.py
The PDF operations are separated into individual modules instead of putting everything into one file.
Added support for combining multiple PDF files into a single PDF.
The merge operation uses PyMuPDF and accepts multiple input files.
Added support for converting a specific PDF page into an image.
Current options include:
Added support for splitting a PDF into individual pages.
For example, a multi-page PDF can be split into separate files:
page_1.pdf
page_2.pdf
page_3.pdf
...
Added support for extracting selected pages into a new PDF.
Pages can be specified individually or as ranges.
Example:
2,5,8-10
This creates a new PDF containing pages 2, 5, 8, 9 and 10.
The next step is to connect all the existing operations through a simple CLI interface.
The user will be able to start PDF Toolkit and select an operation from a menu:
PDF Toolkit
1. Merge PDFs
2. PDF → Image
3. Split PDF
4. Extract Pages
5. Exit
This will make the current features easier to use without having to call the Python functions manually.
After the CLI is working, I plan to continue expanding the toolkit with more PDF operations.
Planned features:
For now, the focus is on getting the existing features working properly and making them easy to use through the CLI.