Skip to main content

A Python binding to poppler-cpp

Project description

Python build and tests Code style: black

python-poppler

python-poppler is a Python binding to the poppler-cpp library. It allows to read, render, or modify PDF documents. More specifically, it currently allows to:

  • read an modify document meta data;
  • list and read embedded documents;
  • list the fonts used by the document;
  • search or extract text on a given page of the document;
  • render a page to a raw image;
  • get info about transitions effects between the pages;
  • read the table of contents of the document.

How to build

This package is currently distributed as source only, and is currently tested on Linux only. It requires poppler 0.62 or higher (but 0.87 is recommended). I will provide a WIndows build once I figure out how to compile poppler for Windows.

You need poppler-cpp with headers, python (3.7 or 3.8) with headers, and cmake. On Arch linux, you need the poppler package. On Ubuntu, you need to install libpoppler-cpp-dev.

The whole build process is handled by the setup.py file.

For instance, to install in the current environment:

$ python setup.py install

This will compile the binary packages, and install the library.

Tests are run using tox:

$ tox

Usage

The package is installed as poppler. It follows the interface of poppler-cpp. Therefore, you can refer to the documentation of the C++ library.

Example:

from poppler import load_from_file, PageRenderer

pdf_document = load_from_file("sample.pdf")
page_1 = pdf_document.create_page(0)
page_1_text = page_1.text()

renderer = PageRenderer()
image = renderer.render_page(page_1)
image_data = image.data

Project details


Download files

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

Source Distribution

python-poppler-0.1.2.tar.gz (621.8 kB view details)

Uploaded Source

File details

Details for the file python-poppler-0.1.2.tar.gz.

File metadata

  • Download URL: python-poppler-0.1.2.tar.gz
  • Upload date:
  • Size: 621.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for python-poppler-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f393bca63e2b127cc09341cb1e30279249a1beb87ee1c89a9e080e58fbcd8342
MD5 bd492e43cec1ca948bf543585099ae71
BLAKE2b-256 06fa705faf4ee1c43952c1d1ac9d93efc9493a5283fbfad5c6b9b82359798d88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page