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.6.0.tar.gz (48.6 kB view details)

Uploaded Source

Built Distribution

pdfnaut-0.6.0-py3-none-any.whl (50.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pdfnaut-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4053f50775b706a6ef4883fe31dddc5410c401cb8eebbaac3835e820b38b379c
MD5 c58b6974cdbbcd1da9b31b55af57b507
BLAKE2b-256 2ce9fd1c0c8b2d6f43b5a81207ba90b8d6bdcd7763a98968b30981b5f809d210

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pdfnaut-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 50.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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95e3a780b95b4584a58db787043212fb2c2f4d0551c9bd95f1515a3df8c0f35e
MD5 9adc4d5cd72ac3d1d3cb0841a5e97566
BLAKE2b-256 0e7bfbfb221b7daa99f9dc5c99a1b5aa91f71a238678801220be3dbc42c973c5

See more details on using hashes here.

Supported by

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