Giter Site home page Giter Site logo

yapot's Introduction

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
)

yapot's People

Contributors

thequbit avatar ryansb avatar ralphbean avatar

Watchers

James Cloos avatar Akash Talreja avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.