/ocr-pdf

Convert PDFs to OCR.

Primary LanguagePythonMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License


Logo

OCR PDF

PDF OCR conversion tool
Explore the docs »

Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgements

About The Project

This code snippet will search a given directory for PDF files that are non-searchable and convert them to searchable PDFs (OCR). When you obtain manuscript PDF files from online databases, they may not be in a searchable format. This means you are unable to highlight and search for text within the PDF. This small Python function will recursively search though a directory containing PDF files, determine the PDF files that are non-searchable, and convert to a searchable format. Optical Character Recognition (OCR) is a method to enable text recognition within images and documents. PDFs contain vector graphics that can contain raster objects (.png, .jpg etc.). The OCR process will first rasterize each page of the PDF file then an OCR "layer" is created.

This python function wraps the command-line program OCRmyPDF.

Built With

  • Python version: 3.9

Getting Started

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

Prerequisites

Installation

  1. In a terminal, clone the repo by running:

    git clone https://github.com/greydongilmore/ocr-pdf.git
  2. Change into the project directory (update path to reflect where you stored this project directory):

    cd /home/user/Documents/Github/ocr-pdf
  3. Install the required Python packages:

    python -m pip install -r requirements.txt

Usage

  1. In a terminal, move into the project directory

    cd /home/user/Documents/Github/ocr-pdf
  2. Run the following to execute the epoch script:

    python main.py -i "full/path/to/PDF/storage/diectory"
  • -i: full directory path to the PDF storage directory

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  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

License

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

Contact

Greydon Gilmore - @GilmoreGreydon - greydon.gilmore@gmail.com

Project Link: https://github.com/greydongilmore/ocr-pdf

Acknowledgements