Skip to main content

Yet Another PDF OCR Tool

Project description

yapot
=====

Yet Another PDF OCR Tool


This is a library (tool) that makes PDF -> Text as easy as possble by doing a lot of the hard stuff for you!

You will need ImageMagick and Tesseract to use yapot.

Ubuntu
------
> sudo apt-get install imagemagick libmagickcore-dev
> sudo apt-get install tesseract-ocr

To use yapot, do the following:

> pip install yapot

Then some code:

from yapot import convert_document

success, pdf_text = convert_document('file.pdf')

if success == True:
with open('file.txt', 'w') as f:
f.write(pdf_text)
else:
print "Unable to convert PDF!"

It's that simple!

Some more advanced things you can do are set the resolution, page delineation, and tell yapot not to delete temporary files (this can be useful when debugging nasty pdf's).

success, pdf_text = yapot.convert_document(
pdf_filename = pdf_filename, # The name of the pdf file
base_page_name = base_page_name, # The base of each page's image (default 'page')
resolution = 200, # Image DPI resolution (default 200)
delete_files = True, # delete temporary files (default True)
page_delineation = '\n--------\n', # page deination text (default '\n--------\n')
verbose = True, # output verbosity (default False)
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yapot-b6f158a.tar.gz (17.1 kB view details)

Uploaded Source

File details

Details for the file yapot-b6f158a.tar.gz.

File metadata

  • Download URL: yapot-b6f158a.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yapot-b6f158a.tar.gz
Algorithm Hash digest
SHA256 9b781b4b072a27efeed00632e001d2001b8a66df4880dd068b6c3e13b5c0d658
MD5 33378fdcf5c406b87ae01cf2d579cd30
BLAKE2b-256 7104ecaf064eacd01b650c282eafb7dcfc32f788965fe5506843edc089194be9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page