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 (default 200)
delete_files = True, # delete temporary files (default True)
page_delineation = '\n--------\n', # page deination text (default '\n--------\n')
verbose = False, # output verbosity (default False)
temp_dir = str(uuid.uuid4()), # location of temp directory to use (default local unique directory)
)
=====
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 (default 200)
delete_files = True, # delete temporary files (default True)
page_delineation = '\n--------\n', # page deination text (default '\n--------\n')
verbose = False, # output verbosity (default False)
temp_dir = str(uuid.uuid4()), # location of temp directory to use (default local unique directory)
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file yapot-0.0.6.dev25.g29a9424.tar.gz
.
File metadata
- Download URL: yapot-0.0.6.dev25.g29a9424.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dee845588cc1f259727655f2a478c5097a0de7faafb210a81a2c4ae15e35973 |
|
MD5 | 6e37a73975a623a8e7a1fd05b415d9ae |
|
BLAKE2b-256 | 5211f5e0903eabca9a409e7c3cdd9374dbaabafb11a6cb2ef3fcdd1b3fb7c4cf |