A small Python toolkit to create, view, and OCR PDF files.
Project description
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
pip install RabbitPDF
For OCR support:
pip install "RabbitPDF[ocr]"
OCR also needs the Tesseract binary installed on the machine.
Quick Start
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:
rabbitpdf create hello.pdf --text "Hello from RabbitPDF"
If the console script is not on your PATH, use:
python -m rabbitpdf create hello.pdf --text "Hello from RabbitPDF"
Create a PDF from a text file:
rabbitpdf create output.pdf --text-file input.txt --title "My Document"
Create a PDF from images:
rabbitpdf create album.pdf --images page-1.png page-2.jpg --page-size A4
Open a PDF:
rabbitpdf view output.pdf
Run OCR:
rabbitpdf ocr scanned.pdf --lang por+eng --output scanned.txt
Build for PyPI
python -m pip install -e ".[dev]"
python -m pytest
python -m build
twine check dist/*
twine upload dist/*
Notes
PDFCreatoruses ReportLab.PDFViewerdelegates 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).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rabbitpdf-0.1.0.tar.gz.
File metadata
- Download URL: rabbitpdf-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f59443e14e2597fcf7174aae0e6080953ca745df0b5ff10c7d06fdd448a3e51
|
|
| MD5 |
1e781fcc3a2cde3177ebb21611dc2e2f
|
|
| BLAKE2b-256 |
5e4aea037b2fab53b3fe532afe346f777695fadc3a4dbfdc963f63f7ed00d999
|
Provenance
The following attestation bundles were made for rabbitpdf-0.1.0.tar.gz:
Publisher:
publish.yml on juca-soft/RabbitPDF
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rabbitpdf-0.1.0.tar.gz -
Subject digest:
4f59443e14e2597fcf7174aae0e6080953ca745df0b5ff10c7d06fdd448a3e51 - Sigstore transparency entry: 2088102520
- Sigstore integration time:
-
Permalink:
juca-soft/RabbitPDF@7d59ea68a837c3eeed524cdd42f184fc35cedb32 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/juca-soft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d59ea68a837c3eeed524cdd42f184fc35cedb32 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rabbitpdf-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rabbitpdf-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00f4ea963bbe266028a68e1953d41f5c25b63e05631f7784921942f819093e4b
|
|
| MD5 |
908e470641170f3c2adb746e5ca2d928
|
|
| BLAKE2b-256 |
f89b61aef5a19f52d8c062405e4ea85c78747d0c006d258a5bca0147b35ae6e6
|
Provenance
The following attestation bundles were made for rabbitpdf-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on juca-soft/RabbitPDF
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rabbitpdf-0.1.0-py3-none-any.whl -
Subject digest:
00f4ea963bbe266028a68e1953d41f5c25b63e05631f7784921942f819093e4b - Sigstore transparency entry: 2088102640
- Sigstore integration time:
-
Permalink:
juca-soft/RabbitPDF@7d59ea68a837c3eeed524cdd42f184fc35cedb32 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/juca-soft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7d59ea68a837c3eeed524cdd42f184fc35cedb32 -
Trigger Event:
release
-
Statement type: