Skip to main content

A simple script to extract contents section from a PDF or DJVU document

Project description

pdf-contents-extractor

Extract contents as text from a pdf- or djvu-document (for use in e.g. handyoutliner)

requires:

  • for PDF, pytesseract and PyMuPDF (both can be easily installed with pip)
  • for DJVU, the ddjvu command available in the path

After installation type in a terminal: extract_contents /path/filename startpage lastpage (e.g.: extract_contents example.djvu 3 6) where startpage and lastpage are pagenumbers of the content pages. The script automatically recognizes the format (pdf or djvu)

The default tesseract language is english. Another language(s) can be set with -l flag (e.g.: -l eng+nld for english and dutch) but it requires the correct tesseract langpack to be installed.

for extra options and help type: extract_contents -h

The contents can be further edited in a text-editor and added to the pdf-file with handyoutliner (http://handyoutlinerfo.sourceforge.net/)

Note on djvu

For djvu files the command djvutxt, on linux, usually works great already (if OCR layer available). Example usage: djvutxt -page=3-6 example.pdf contents.txt

Project details


Download files

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

Files for pdf-contents-extractor, version 0.7
Filename, size File type Python version Upload date Hashes
Filename, size pdf_contents_extractor-0.7-py3-none-any.whl (3.0 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

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