Metadata-Version: 2.4
Name: RabbitPDF
Version: 0.1.0
Summary: A small Python toolkit to create, view, and OCR PDF files.
Project-URL: Homepage, https://github.com/juca-soft/RabbitPDF
Project-URL: Repository, https://github.com/juca-soft/RabbitPDF
Project-URL: Issues, https://github.com/juca-soft/RabbitPDF/issues
Author: Juca Soft
License-Expression: MIT
License-File: LICENSE
Keywords: ocr,pdf,reportlab,tesseract,viewer
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Text Processing
Requires-Python: >=3.9
Requires-Dist: reportlab>=4.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: twine>=5.0; extra == 'dev'
Provides-Extra: ocr
Requires-Dist: pillow>=10; extra == 'ocr'
Requires-Dist: pymupdf>=1.24; extra == 'ocr'
Requires-Dist: pytesseract>=0.3.10; extra == 'ocr'
Description-Content-Type: text/markdown

# RabbitPDF

RabbitPDF is a small Python library for PDF workflows:

- create PDFs from text, lines, or images;
- open PDFs in the local browser/default viewer;
- run OCR on PDF pages and return plain text.

Version `0.1.0` is intentionally compact and friendly for scripts, CLIs, and small apps.

## Install

```bash
pip install RabbitPDF
```

For OCR support:

```bash
pip install "RabbitPDF[ocr]"
```

OCR also needs the Tesseract binary installed on the machine.

## Quick Start

```python
from rabbitpdf import PDFCreator, PDFViewer, ocr_pdf

PDFCreator(title="Invoice").create_from_text(
    "Hello from RabbitPDF!",
    "hello.pdf",
)

PDFViewer("hello.pdf").open()

text = ocr_pdf("scanned.pdf", lang="por+eng")
print(text)
```

## CLI

Create a PDF:

```bash
rabbitpdf create hello.pdf --text "Hello from RabbitPDF"
```

If the console script is not on your `PATH`, use:

```bash
python -m rabbitpdf create hello.pdf --text "Hello from RabbitPDF"
```

Create a PDF from a text file:

```bash
rabbitpdf create output.pdf --text-file input.txt --title "My Document"
```

Create a PDF from images:

```bash
rabbitpdf create album.pdf --images page-1.png page-2.jpg --page-size A4
```

Open a PDF:

```bash
rabbitpdf view output.pdf
```

Run OCR:

```bash
rabbitpdf ocr scanned.pdf --lang por+eng --output scanned.txt
```

## Build for PyPI

```bash
python -m pip install -e ".[dev]"
python -m pytest
python -m build
twine check dist/*
twine upload dist/*
```

## Notes

- `PDFCreator` uses ReportLab.
- `PDFViewer` delegates rendering to the local browser/default PDF viewer.
- `ocr_pdf()` uses PyMuPDF to render pages and pytesseract to read text.
- Tesseract language packs must be installed separately, for example Portuguese (`por`) and English (`eng`).
