Metadata-Version: 2.4
Name: pdfjetdev
Version: 0.1.1
Summary: 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-URL: Homepage, https://pdfjet.dev
Project-URL: Documentation, https://pdfjet.dev/#docs
Project-URL: Source, https://github.com/workollab/pdfjet-api
Author-email: PDFjet <support@workollab.com>
License: MIT
Keywords: document,extract,langchain,llamaindex,llm,markdown,ocr,pdf,pdfjet,rag
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Markup
Requires-Python: >=3.8
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-core>=0.10; extra == 'llamaindex'
Description-Content-Type: text/markdown

# 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](https://pdfjet.dev). 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

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

## Quick start

```python
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

```python
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

```python
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](https://pdfjet.dev)
