Skip to content

Latest commit

 

History

History
283 lines (222 loc) · 10.7 KB

README.md

File metadata and controls

283 lines (222 loc) · 10.7 KB

PDF Toolbox

Commits Contributors Issues License

About The Project

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
  1. About The Project
  2. Getting Started
  3. Roadmap
  4. Contributing
  5. License
  6. Contact

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • Adobe
    • Place Adobe PDF Extract API credentials in root of repository. Credentials are available from Adobe with a 1000 credit/six month free trial.
  • Pillow/PIL
    • Install Python Imaging Library (or the Pillow fork) for your OS. Installation instructions available at the Pillow documentation.
  • TesseractOCR
    • Install Tesseract OCR for your OS. Installation instructions available at the Tesseract OCR github repository.
  • MuPDF
    • Install MuPDF for your OS. Installation instructions available at the MuPDF website.

Installation

  1. Get a free API Key/Credentials at Adobe.
  2. Clone the repo
    git clone https://github.com/hreikin/pdf-toolbox.git
  3. Create and source a Python virtual environment.
    python3 -m venv .venv
    source .venv/bin/activate
  4. Install requirements with pip
    pip install -r requirements.txt

Known Issues

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)

Comparison Scores

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.

(back to top)

Roadmap

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Personal Website: https://hreikin.co.uk

Project Link: https://github.com/hreikin/pdf-toolbox

(back to top)