Skip to main content

Python client for the PDFjet API (pdfjet.dev): turn PDFs into Markdown, CSV, structured JSON (with provenance), Word, and searchable PDFs — with LangChain and LlamaIndex loaders for RAG.

Project description

pdfjetdev — Python client for PDFjet

Turn any PDF into Markdown, CSV, structured JSON (with provenance), editable Word, or a searchable PDF with a few lines of Python. Wraps the PDFjet API. Files are never stored.

  • Zero dependencies — the core client uses only the Python standard library.
  • Structured JSON with provenance — element types, text, page numbers, and per-element bounding boxes.
  • RAG-ready — LangChain and LlamaIndex loaders included.

Install

pip install pdfjetdev
# with framework loaders:
pip install "pdfjetdev[langchain]"
pip install "pdfjetdev[llamaindex]"

Quick start

from pdfjetdev import Client

client = Client("pj_live_...")          # or set the PDFJET_API_KEY env var

# Structured parse with bounding-box provenance
doc = client.extract_json("invoice.pdf")
print(doc.page_count, "pages, scanned:", doc.scanned)
for block in doc.pages[0].blocks:
    print(block.type, block.bbox, block.text or block.items or "")

# Chunk-ready Markdown for a RAG pipeline
print(doc.to_markdown())

# Other outputs
md   = client.extract_markdown("invoice.pdf")   # str
csv  = client.extract_csv("invoice.pdf")        # str
docx = client.extract_docx("invoice.pdf")       # bytes
pdf  = client.extract_searchable("scan.pdf")    # bytes (searchable PDF)

file can be a path, bytes, or an open binary file. Requests to /extract/* and the utility endpoints automatically retry on 429/5xx with exponential backoff.

Pass provenance=False to extract_json for a leaner text+structure payload (no bounding boxes).

LangChain

from pdfjetdev.integrations.langchain import PDFJetLoader

loader = PDFJetLoader("report.pdf", api_key="pj_live_...")   # one Document per page
docs = loader.load()   # page_content is layout-preserving Markdown; page number in metadata

LlamaIndex

from pdfjetdev.integrations.llamaindex import PDFJetReader

reader = PDFJetReader(api_key="pj_live_...")
docs = reader.load_data("report.pdf")   # one LlamaIndex Document per page

Errors

All errors subclass pdfjetdev.PDFJetError: AuthenticationError (401/403), PaymentRequiredError (402, quota), InvalidInputError (400/413), RateLimitError (429), ServiceUnavailableError (5xx).

License

MIT · pdfjet.dev

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

pdfjetdev-0.1.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

pdfjetdev-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file pdfjetdev-0.1.1.tar.gz.

File metadata

  • Download URL: pdfjetdev-0.1.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pdfjetdev-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4b62c1bbd8ac789350648c3b6a67e5dd0448658f15e48f8c7a43ed17ced44e83
MD5 d6a3100fd7d9ff6caedac13633d401f0
BLAKE2b-256 37306c1c66132a00f9ede787b609ce336a7e4fe5df4d4b469893e944a0449da2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfjetdev-0.1.1.tar.gz:

Publisher: publish-python-sdk.yml on workollab/pdfjet-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdfjetdev-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pdfjetdev-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pdfjetdev-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11147fbb07f8b4cbf9ebc4b1f2d3cb295fb20429b057dae5a199e9fc864853c7
MD5 98747e8a25d36e6f1977bc7ece077603
BLAKE2b-256 f20da1c6dc849871a637a088e1c8fd64b16c7e5ebe141fe5455ff8c5bbc0c99f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdfjetdev-0.1.1-py3-none-any.whl:

Publisher: publish-python-sdk.yml on workollab/pdfjet-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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