Skip to main content
Help us improve Python packaging – donate today!

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, Tesseract, and QPDF to use yapot.

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

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
resolution = 200, # Image DPI resolution
delete_files = True, # delete temporary files
page_delineation = '\n--------\n', # page deination text
verbose = False, # output verbosity
temp_dir = str(uuid.uuid4()), # location of temp directory to use
password = '', # password for PDF file
make_thumbs = True, # create thrumbnails for each page
thumb_size = 512, # width of thumbnail image
thumb_dir = './thumbs', # directory to place thumbnails
thumb_prefix = 'thumb_page_', # prefix for thumbnail images
)

Release history Release notifications

This version
History Node

0.4.2

History Node

0.4.1

History Node

0.4.0

History Node

0.3.0

History Node

0.2.0

History Node

0.1.2

History Node

0.1.1.dev31

History Node

0.1.0

History Node

0.1.0.dev30

History Node

0.0.6.dev29

History Node

0.0.4

History Node

0.0.3

History Node

0.0.2

History Node

0.0.1

History Node

0.0.6.dev27.g940c607

History Node

0.0.6.dev25.g29a9424

History Node

0.0.5.dev21.gb6f158a

History Node

b6f158a

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
yapot-0.4.2.tar.gz (18.1 kB) Copy SHA256 hash SHA256 Source None Sep 12, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page