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.

Currently, pdfnaut provides a low-level interface for reading and writing PDF objects as defined in the PDF 2.0 specification.

Examples

The newer high-level API

from pdfnaut import PdfDocument

pdf = PdfDocument.from_filename("tests/docs/sample.pdf")
first_page = next(pdf.flattened_pages)

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

The more mature low-level API

from pdfnaut import PdfParser

with open("tests/docs/sample.pdf", "rb") as doc:
    pdf = PdfParser(doc.read())
    pdf.parse()

    pages = pdf.trailer["Root"]["Pages"]

    first_page_stream = pages["Kids"][0]["Contents"]
    print(first_page_stream.decode())

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.7.0.tar.gz (54.7 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.7.0-py3-none-any.whl (56.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pdfnaut-0.7.0.tar.gz
Algorithm Hash digest
SHA256 1c1b5ebffb957af9d6b18a1a07234383b871d0e9b662b498889d42572861c0ad
MD5 9a8d5c98a6e85e749ffdd2e4f976f0d0
BLAKE2b-256 660d81cf0209f7dd8bcec15cbd63525fc7d3a8f9cddd74559c5896f77f810c60

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdfnaut-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 56.5 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 618dcd1207323bea2a4c7ab7194fb8d53ec2a66086627c7ba81106a5f719a971
MD5 4e230df07cbb0cd3e3f0792ab520d131
BLAKE2b-256 e7fd657a1c7013ad62fc00b92a736495f177a4840e9620433d149bae1ea14cde

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