PDF Toolbox aims to be a PDF content extraction, conversion and creation
program. The goal is to extract content via various methods and store it in
a database for use in other document creation.
This should hopefully allow easier conversion to other formats and also let
you create new documents using any text, tables pictures, etc you may
already have available in other file formats.
All development work currently happens on the development
branch and changes
are merged frequently into main
. Once a solid base has been formed a 0.1
release will be created and merges from the development
branch will only be
for security fixes, bug fixes and new versions.
Table of Contents
To get a local copy up and running follow these simple steps.
- Adobe
- Place
Adobe PDF Extract API
credentials in root of repository. Credentials are available from Adobe with a 1000 credit/six month free trial.
- Place
- Pillow/PIL
- Install
Python Imaging Library
(or thePillow fork
) for your OS. Installation instructions available at the Pillow documentation.
- Install
- TesseractOCR
- Install
Tesseract OCR
for your OS. Installation instructions available at the Tesseract OCR github repository.
- Install
- MuPDF
- Install
MuPDF
for your OS. Installation instructions available at the MuPDF website.
- Install
- Get a free API Key/Credentials at Adobe.
- Clone the repo
git clone https://github.com/hreikin/pdf-toolbox.git
- Create and source a Python virtual environment.
python3 -m venv .venv source .venv/bin/activate
- Install requirements with
pip
pip install -r requirements.txt
On Linux (Windows/Mac untested) the file .venv/lib64/python3.9/site-packages/ado be/pdfservices/operation/internal/io/file_ref_impl.py
from pdfservices-sdk
inside the venv
you create needs a few changes otherwise it might fail with a
false cross-device link
error.
Add import shutil
to the top of the file and on line 46 alter it to the
following to successfully save the JsonSchema/zip file it outputs. This does not
deal with deleting the temporary file as it only copies it however with it being
in temp it should be deleted on a reboot anyway so for now this hacky workaround
should be ok:
shutil.copy(self._file_path, abs_path)
The file confidence.py
creates three text files for comparison to create a
rudimentary confidence check as one isn't provided by the API. The score is a
comparison between the API's extraction and other extraction techniques. Scores
are calculated using the SequenceMatcher
class and get_close_matches
method
from difflib
.
A score of 0.6 for any of the calculated scores is considered a close match. All scores are stored in a dictionary and a text file is created with the results.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Personal Website: https://hreikin.co.uk
Project Link: https://github.com/hreikin/pdf-toolbox