Skip to main content

Explore PDFs with ease

Project description

pdfnaut

Documentation Status PyPI - License PyPI - Downloads PyPI - Version

[!Warning] pdfnaut is currently in an early stage of development and has only been tested with a small set of compliant documents. Some non-compliant documents may work under strict=False. Expect bugs or issues.

pdfnaut aims to become a PDF processor for parsing PDF 2.0 files.

pdfnaut provides both a low-level interface for reading and writing PDF objects as described in the PDF 2.0 specification and a high-level document interface for actions like reading and writing metadata, accessing pages, creating objects, etc.

Installation

pdfnaut requires at least Python 3.9 or later. To install via pip:

python -m pip install pdfnaut

If you plan to work with encrypted or protected PDF documents, you must install one of the supported crypt providers. See this for details.

Examples

Example 1: Accessing the content stream of a page

from pdfnaut import PdfDocument

pdf = PdfDocument.from_filename("example.pdf")
first_page = next(pdf.flattened_pages)

if first_page.content_stream:
    print(first_page.content_stream.contents)

Example 2: Reading document information

from pdfnaut import PdfDocument

pdf = PdfDocument.from_filename("example.pdf")

assert pdf.doc_info is not None, "No document information available."

print(pdf.doc_info.title)
print(pdf.doc_info.producer)

For more examples on what pdfnaut can do, see the examples directory in our repository or see the guides in our documentation.

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

pdfnaut-0.8.0.tar.gz (64.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdfnaut-0.8.0-py3-none-any.whl (65.8 kB view details)

Uploaded Python 3

File details

Details for the file pdfnaut-0.8.0.tar.gz.

File metadata

  • Download URL: pdfnaut-0.8.0.tar.gz
  • Upload date:
  • Size: 64.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for pdfnaut-0.8.0.tar.gz
Algorithm Hash digest
SHA256 95356b19c8533dc378101676cc795d15285d6735b2e77690e9659d30da725689
MD5 5dfc8c535c77b5dbc1ca30e9f16d63e2
BLAKE2b-256 4c266f4c633f7b93759301613424a82131bb324f519bef79ee0f21b8ed7dc7f8

See more details on using hashes here.

File details

Details for the file pdfnaut-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: pdfnaut-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 65.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.9

File hashes

Hashes for pdfnaut-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 288308541048035a910c28867d3b15fa8261811b592822a44ae98cc0a39b9038
MD5 973c084b11e68e4fe064f3d2e7a0d9fa
BLAKE2b-256 a3f6e6cd893852535597e2e6ce627b43144deb9564fe6fa66ddd93acd82cc0ff

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