Skip to content

Python interface to pdf-extract, HTML extraction from PDF

License

Notifications You must be signed in to change notification settings

bitextor/python-pdfextract

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-pdfextract

A python wrapper for pdf-extract, a Java library for HTML extraction from PDF documents.

Configuration

Dependencies:

  • jpype
  • chardet

The pdf-extract jar files will get fetched and included automatically when building the package.

Installation

Checkout the code:

git clone https://github.com/bitextor/python-pdfextract.git
cd python-pdfextract

virtualenv

virtualenv env
source env/bin/activate
pip install -r requirements.txt
python setup.py install

Fedora

sudo dnf install -y python2-jpype
sudo python setup.py install

Also you can now directly install without explicitly running setup.py or checkout the code:

pip

pip install python-pdfextract # Stable releases
pip install git+https://github.com/bitextor/python-pdfextract.git # master code
pip install git+https://github.com/bitextor/python-pdfextract.git@branchname # development "branchname" code

Usage

Be sure to have set JAVA_HOME properly since jpype depends on this setting.

from pdfextract.extract import Extractor
extractor = Extractor(pdf=your_pdf_data)

An advanced way to create the Extractor is: extractor = Extractor(pdf=your_pdf_data, keepBrTags=0, getPermission=0, logFilePath="", verbose=0, configFile="", timeout=0, sentenceJoinPath="", kenlmPath="")

which contains the same arguments as PDFExtract command line options.

Then, to extract relevant content:

extracted_html = extractor.extract()

About

Python interface to pdf-extract, HTML extraction from PDF

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%