pyocr-toolkit 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/.env.example +27 -0
  2. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/CHANGELOG.md +30 -0
  3. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/PKG-INFO +81 -9
  4. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/README.md +56 -6
  5. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/pyproject.toml +15 -4
  6. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/__init__.py +1 -1
  7. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/api.py +112 -45
  8. pyocr_toolkit-0.5.0/src/pyocr_toolkit/brands.py +56 -0
  9. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/cli.py +88 -15
  10. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/config.py +52 -0
  11. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/credentials.py +23 -8
  12. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/documents.py +90 -18
  13. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/env.example +27 -0
  14. pyocr_toolkit-0.5.0/src/pyocr_toolkit/export.py +146 -0
  15. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/jobs.py +23 -8
  16. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/anthropic_provider.py +2 -0
  17. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/base.py +6 -13
  18. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/gemini_provider.py +1 -0
  19. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/openai_provider.py +3 -0
  20. pyocr_toolkit-0.5.0/src/pyocr_toolkit/ocr/__init__.py +34 -0
  21. pyocr_toolkit-0.5.0/src/pyocr_toolkit/ocr/base.py +271 -0
  22. pyocr_toolkit-0.5.0/src/pyocr_toolkit/ocr/cloud.py +301 -0
  23. pyocr_toolkit-0.5.0/src/pyocr_toolkit/ocr/local.py +188 -0
  24. pyocr_toolkit-0.5.0/src/pyocr_toolkit/ocr/tesseract.py +71 -0
  25. pyocr_toolkit-0.5.0/src/pyocr_toolkit/pdftext.py +217 -0
  26. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/service.py +133 -20
  27. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/common.js +34 -1
  28. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/compare.js +5 -2
  29. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/document.js +29 -6
  30. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/README.md +12 -0
  31. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/claude.svg +1 -0
  32. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/googlecloud.svg +1 -0
  33. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/googlegemini.svg +1 -0
  34. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/mistralai.svg +1 -0
  35. pyocr_toolkit-0.5.0/src/pyocr_toolkit/static/logos/paddlepaddle.svg +1 -0
  36. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/providers.js +29 -2
  37. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/reader.js +4 -1
  38. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/search.js +6 -2
  39. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/styles.css +36 -0
  40. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/workspace.js +143 -25
  41. pyocr_toolkit-0.5.0/src/pyocr_toolkit/templates/_brand.html +9 -0
  42. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/_llm_picker.html +1 -1
  43. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/base.html +1 -1
  44. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/document.html +16 -3
  45. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/help.html +39 -5
  46. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/home.html +6 -5
  47. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/providers.html +82 -37
  48. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/workspace.html +15 -4
  49. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/workspace_detail.html +1 -1
  50. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/web.py +6 -3
  51. pyocr_toolkit-0.5.0/tests/test_ocr_engines.py +503 -0
  52. pyocr_toolkit-0.5.0/tests/test_pdftext.py +140 -0
  53. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_web.py +59 -1
  54. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/.gitignore +0 -0
  55. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/CONTRIBUTING.md +0 -0
  56. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/LICENSE +0 -0
  57. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/README.md +0 -0
  58. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/HeroDemo.tsx +0 -0
  59. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/Root.tsx +0 -0
  60. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/assets.d.ts +0 -0
  61. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/index.ts +0 -0
  62. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/motion.tsx +0 -0
  63. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/CatchScene.tsx +0 -0
  64. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/ColdOpenScene.tsx +0 -0
  65. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/MeasureScene.tsx +0 -0
  66. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/MontageScene.tsx +0 -0
  67. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/OutroScene.tsx +0 -0
  68. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/scenes/ThreeWaysScene.tsx +0 -0
  69. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/theme.ts +0 -0
  70. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/hero-video/src/ui.tsx +0 -0
  71. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/__main__.py +0 -0
  72. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/compare.py +0 -0
  73. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/__init__.py +0 -0
  74. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/catalog.py +0 -0
  75. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/llm/prompts.py +0 -0
  76. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/preprocess.py +0 -0
  77. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/search.py +0 -0
  78. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/jobs.js +0 -0
  79. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/library.js +0 -0
  80. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/models.js +0 -0
  81. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/static/workspaces.js +0 -0
  82. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/_doc_card.html +0 -0
  83. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/_doctabs.html +0 -0
  84. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/_icons.html +0 -0
  85. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/compare.html +0 -0
  86. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/error.html +0 -0
  87. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/jobs.html +0 -0
  88. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/library.html +0 -0
  89. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/models.html +0 -0
  90. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/reader.html +0 -0
  91. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/search.html +0 -0
  92. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/templates/workspaces.html +0 -0
  93. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/src/pyocr_toolkit/workspaces.py +0 -0
  94. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/__init__.py +0 -0
  95. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/conftest.py +0 -0
  96. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_api.py +0 -0
  97. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_batch.py +0 -0
  98. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_core.py +0 -0
  99. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_makefile.py +0 -0
  100. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_models.py +0 -0
  101. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_preprocess.py +0 -0
  102. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_providers.py +0 -0
  103. {pyocr_toolkit-0.4.0 → pyocr_toolkit-0.5.0}/tests/test_workspaces.py +0 -0
@@ -35,6 +35,33 @@ GEMINI_API_KEY=
35
35
  # OPENAI_COMPATIBLE_MODEL=qwen2.5vl:7b
36
36
  # OPENAI_COMPATIBLE_API_KEY=
37
37
 
38
+ # --- Extra OCR engines (Tesseract needs no settings) ------------------------------
39
+ # Local engines need an extra install, e.g. pip install "pyocr-toolkit[easyocr]"
40
+ # (extras: rapidocr, easyocr, paddleocr, doctr, textract). See `pyocr engines`.
41
+ # EASYOCR_LANGUAGES=en # comma-separated, e.g. en,de
42
+ # PADDLEOCR_LANGUAGE=en # e.g. en, ch, german, japan
43
+ # OCR_GPU=false # EasyOCR / PaddleOCR / docTR on a CUDA GPU
44
+ # OCR_MAX_EDGE_PX=4000 # longest edge of the image given to these engines
45
+ # OCR_TIMEOUT_S=120
46
+
47
+ # Google Cloud Vision (an API key with the Cloud Vision API enabled)
48
+ GOOGLE_VISION_API_KEY=
49
+ # GOOGLE_VISION_LANGUAGE_HINTS= # e.g. en,de; empty = auto-detect
50
+
51
+ # Azure AI Document Intelligence (prebuilt-read)
52
+ AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT=
53
+ AZURE_DOCUMENT_INTELLIGENCE_KEY=
54
+
55
+ # AWS Textract (credentials may also come from ~/.aws or AWS_PROFILE)
56
+ # AWS_REGION=us-east-1
57
+ # AWS_ACCESS_KEY_ID=
58
+ # AWS_SECRET_ACCESS_KEY=
59
+ # AWS_SESSION_TOKEN=
60
+
61
+ # Mistral OCR
62
+ MISTRAL_API_KEY=
63
+ # MISTRAL_OCR_MODEL=mistral-ocr-latest
64
+
38
65
  # --- Storage, rendering and OCR ---------------------------------------------------
39
66
  # DATA_DIR=data
40
67
  # MAX_UPLOAD_MB=200
@@ -2,6 +2,36 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.5.0 - 2026-11-27
6
+
7
+ - **More OCR engines.** Besides Tesseract: RapidOCR, EasyOCR, PaddleOCR and docTR (local, optional extras such as
8
+ `pip install "pyocr-toolkit[easyocr]"`), and Google Cloud Vision, Azure AI Document Intelligence, AWS Textract
9
+ and Mistral OCR (cloud, configured with environment variables). Each engine is a separate source
10
+ (`ocr:<engine>`; `ocr` stays Tesseract) that can be searched, compared and exported.
11
+ - The page inspector, Overview extract form, background jobs and the CLI (`--engine ocr:<engine>`,
12
+ `--ocr-engine`, `pyocr engines`) can pick the OCR engine. The Providers page lists every engine with its status
13
+ and a Test button, and cloud OCR keys and engine settings can be saved there like LLM provider credentials.
14
+ - New settings: `GOOGLE_VISION_API_KEY`, `GOOGLE_VISION_LANGUAGE_HINTS`, `AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT`,
15
+ `AZURE_DOCUMENT_INTELLIGENCE_KEY`, `AWS_REGION` (plus the usual AWS credentials), `MISTRAL_API_KEY`,
16
+ `MISTRAL_OCR_MODEL`, `EASYOCR_LANGUAGES`, `PADDLEOCR_LANGUAGE`, `OCR_GPU`, `OCR_MAX_EDGE_PX`, `OCR_TIMEOUT_S`.
17
+ - Existing Tesseract results (`ocr/<page>.json`) are read as before; other engines cache under `ocr/<engine>/`.
18
+ - **Other PDF libraries.** Besides PyMuPDF, the text layer can be read with pypdf, pdfplumber, pdfminer.six and
19
+ pypdfium2 (optional: `pip install "pyocr-toolkit[pdf]"`). Each installed library is its own source
20
+ (`native:<library>`; `native` stays PyMuPDF) that can be compared and exported. The page inspector's Native tab
21
+ has a library picker and a **Test all libraries** button that shows which libraries get text out of the page.
22
+ CLI: `--engine native:<library>` and `pyocr libraries`; API: `?library=` on `/text/native`, a new
23
+ `/pages/{page}/text/native/libraries` endpoint, and `text_libraries` in `/api/config`. Results are cached under
24
+ `native/<library>/<page>.json` and re-read when the library version changes.
25
+ - **Export all sources.** Download everything extracted for a document in one file: Overview → *Export all*,
26
+ the Full text *Download* menu, or `GET /api/documents/{id}/export/all?fmt=json|jsonl|csv|md|zip`.
27
+ JSON keeps each page's text per source, CSV puts sources side by side (a column each), and ZIP bundles the JSON
28
+ and CSV with a TXT and Markdown file per source. Like single-source export, it only reads cached results.
29
+ - Logos for LLM providers and OCR engines across the UI (bundled locally, no external requests).
30
+ - The upload file pickers now offer `.txt`, `.cbr` and `.pam` files, which the server already accepted.
31
+ - Fix: running Tesseract on two documents at once (e.g. two OCR jobs) failed with "Attempt to use Leptonica from
32
+ 2 threads at once"; Tesseract calls are now serialised across the whole process.
33
+ - LLM prompts and cache keys are unchanged, so existing results stay valid.
34
+
5
35
  ## 0.4.0 - 2026-11-27
6
36
 
7
37
  - Several pages per LLM request: set **Pages per request** on the Overview page, `--pages-per-request N` on
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pyocr-toolkit
3
- Version: 0.4.0
4
- Summary: Inspect and compare PDF/image text extraction - native text, Tesseract OCR and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser.
3
+ Version: 0.5.0
4
+ Summary: Inspect and compare PDF/image text extraction - native text, OCR engines (Tesseract, EasyOCR, PaddleOCR, docTR, RapidOCR, Google Vision, Azure, Textract, Mistral) and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser.
5
5
  Project-URL: Homepage, https://github.com/utkarsh5026/pyocr
6
6
  Project-URL: Issues, https://github.com/utkarsh5026/pyocr/issues
7
7
  Author: utkarsh5026
@@ -207,7 +207,7 @@ License: Apache License
207
207
  See the License for the specific language governing permissions and
208
208
  limitations under the License.
209
209
  License-File: LICENSE
210
- Keywords: claude,document-ai,llm,ocr,openai,pdf,pymupdf,rag,tesseract,text-extraction
210
+ Keywords: claude,doctr,document-ai,easyocr,llm,ocr,openai,paddleocr,pdf,pdfplumber,pymupdf,pypdf,rag,tesseract,text-extraction,textract
211
211
  Classifier: Development Status :: 4 - Beta
212
212
  Classifier: Environment :: Web Environment
213
213
  Classifier: Framework :: FastAPI
@@ -226,6 +226,7 @@ Requires-Python: >=3.10
226
226
  Requires-Dist: anthropic>=1.0
227
227
  Requires-Dist: fastapi>=0.110
228
228
  Requires-Dist: google-genai>=1.0
229
+ Requires-Dist: httpx>=0.27
229
230
  Requires-Dist: jinja2>=3.1
230
231
  Requires-Dist: openai>=1.40
231
232
  Requires-Dist: pillow>=10.1
@@ -236,9 +237,30 @@ Requires-Dist: rapidfuzz>=3.6
236
237
  Requires-Dist: uvicorn[standard]>=0.29
237
238
  Provides-Extra: dev
238
239
  Requires-Dist: httpx>=0.27; extra == 'dev'
240
+ Requires-Dist: pdfminer-six>=20231228; extra == 'dev'
241
+ Requires-Dist: pdfplumber>=0.11; extra == 'dev'
242
+ Requires-Dist: pypdf>=4; extra == 'dev'
243
+ Requires-Dist: pypdfium2>=4; extra == 'dev'
239
244
  Requires-Dist: pytest>=8; extra == 'dev'
240
245
  Requires-Dist: rich>=13; extra == 'dev'
241
246
  Requires-Dist: ruff>=0.5; extra == 'dev'
247
+ Provides-Extra: doctr
248
+ Requires-Dist: python-doctr[torch]>=0.10; extra == 'doctr'
249
+ Provides-Extra: easyocr
250
+ Requires-Dist: easyocr>=1.7; extra == 'easyocr'
251
+ Provides-Extra: paddleocr
252
+ Requires-Dist: paddleocr>=3; extra == 'paddleocr'
253
+ Requires-Dist: paddlepaddle>=3; extra == 'paddleocr'
254
+ Provides-Extra: pdf
255
+ Requires-Dist: pdfminer-six>=20231228; extra == 'pdf'
256
+ Requires-Dist: pdfplumber>=0.11; extra == 'pdf'
257
+ Requires-Dist: pypdf>=4; extra == 'pdf'
258
+ Requires-Dist: pypdfium2>=4; extra == 'pdf'
259
+ Provides-Extra: rapidocr
260
+ Requires-Dist: onnxruntime>=1.17; extra == 'rapidocr'
261
+ Requires-Dist: rapidocr>=2; extra == 'rapidocr'
262
+ Provides-Extra: textract
263
+ Requires-Dist: boto3>=1.34; extra == 'textract'
242
264
  Description-Content-Type: text/markdown
243
265
 
244
266
  <div align="center">
@@ -276,8 +298,8 @@ checking that step. Upload a document and you get three versions of every page:
276
298
 
277
299
  | | Source | What it is | Good at | Weak at |
278
300
  |---|---|---|---|---|
279
- | 📄 | **Native text** | Text already embedded in the file (PyMuPDF) | Born-digital PDFs. Exact and instant. | Scans have none. Broken font maps produce gibberish. |
280
- | 🔍 | **Tesseract OCR** | Classic OCR on the rendered page image | Free, local, fast, gives word positions | Tables, columns, poor scans, handwriting |
301
+ | 📄 | **Native text** | Text already embedded in the file (PyMuPDF, or pypdf / pdfplumber / pdfminer.six / pypdfium2) | Born-digital PDFs. Exact and instant. | Scans have none. Broken font maps produce gibberish. |
302
+ | 🔍 | **OCR** | Tesseract, or any of 8 other OCR engines (below), on the rendered page image | Free/local or cheap cloud, gives word positions | Varies by engine: Tesseract struggles with tables, columns, poor scans, handwriting |
281
303
  | ✨ | **LLM transcription** | A vision LLM told to copy the page *verbatim* | Hard pages, layout, context | Costs money. May quietly "fix" or skip text. |
282
304
 
283
305
  Then you can:
@@ -285,11 +307,16 @@ Then you can:
285
307
  - **Extract** page by page, a range like `1-5,9`, or the whole document, as background jobs
286
308
  - **Compare** any two sources: character and word error rate (CER/WER), word-level diffs, a per-page chart
287
309
  - **Search** across every document and every source at once
288
- - **Export** clean text as TXT, Markdown, JSON or JSONL for your pipeline
310
+ - **Export** clean text as TXT, Markdown, JSON or JSONL for your pipeline, or every source at once as JSON, CSV,
311
+ Markdown, JSONL or a ZIP
289
312
 
290
313
  **LLM providers:** Claude (Anthropic API), OpenAI, Azure OpenAI, Claude on Azure (Microsoft Foundry), Google
291
314
  Gemini, and any OpenAI-compatible server (Ollama, vLLM, LM Studio, OpenRouter) for local or private models.
292
315
 
316
+ **OCR engines:** Tesseract (default), plus RapidOCR, EasyOCR, PaddleOCR and docTR running locally, and Google
317
+ Cloud Vision, Azure AI Document Intelligence, AWS Textract and Mistral OCR in the cloud. Each engine is its own
318
+ source, so you can score engines against each other or against an LLM.
319
+
293
320
  **Inputs:** PDF, XPS, EPUB, CBZ, MOBI, FB2, SVG, PNG, JPEG, TIFF (multi-page), BMP, GIF, WebP and anything else
294
321
  [PyMuPDF](https://pymupdf.readthedocs.io/) opens.
295
322
 
@@ -374,7 +401,7 @@ Everything you upload and extract is stored in `./data` (change it with `DATA_DI
374
401
  | **Home** `/` | Drop files to upload; see setup status and recent documents. |
375
402
  | **Library** `/documents` | Document cards showing native / OCR / LLM coverage and how many pages still have no text. Filter by status, workspace or name; delete. |
376
403
  | **Workspaces** `/workspaces` | Named groups of documents. Uploading several files or a `.zip` offers to create one, with suggested names (from the file names, or `adjective-scientist` like `festive-albattani`). Open one to rename it, add files or remove documents. |
377
- | **Overview** `/documents/{id}` | Start background extraction (Tesseract or any LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
404
+ | **Overview** `/documents/{id}` | Start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
378
405
  | **Page inspector** `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; per-page diff; a *Side by side* tab with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
379
406
  | **Full text** `/documents/{id}/text` | Read the whole document from one source, optionally beside the page images; find, copy, download. |
380
407
  | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page (opens on the worst page). Works for OCR vs LLM, native vs LLM, or **model vs model**. |
@@ -405,17 +432,62 @@ and the hint under each model box say whether a model suits transcription (custo
405
432
  images. For a fully local setup, run Ollama with a vision model and set
406
433
  `OPENAI_COMPATIBLE_BASE_URL=http://localhost:11434/v1`.
407
434
 
435
+ ## Configure OCR engines
436
+
437
+ Tesseract is the default engine. Every other engine is optional, and the Providers page (and `pyocr engines`) shows
438
+ which are ready, with a **Test** button for each. Cloud keys and engine settings can be set there too, or as
439
+ environment variables. Local engines run on your machine; the first run downloads the
440
+ model weights. Cloud engines send the rendered page image to that service, and nowhere else.
441
+
442
+ | Engine | Kind | Install / required settings | Optional |
443
+ |---|---|---|---|
444
+ | Tesseract | local | system package (`apt install tesseract-ocr`, `brew install tesseract`) | `TESSERACT_LANGUAGE` |
445
+ | RapidOCR | local | `pip install "pyocr-toolkit[rapidocr]"` (ONNX Runtime, no PyTorch) | – |
446
+ | EasyOCR | local | `pip install "pyocr-toolkit[easyocr]"` (PyTorch) | `EASYOCR_LANGUAGES`, `OCR_GPU` |
447
+ | PaddleOCR | local | `pip install "pyocr-toolkit[paddleocr]"` (PaddlePaddle) | `PADDLEOCR_LANGUAGE` |
448
+ | docTR | local | `pip install "pyocr-toolkit[doctr]"` (PyTorch) | `OCR_GPU` |
449
+ | Google Cloud Vision | cloud | `GOOGLE_VISION_API_KEY` | `GOOGLE_VISION_LANGUAGE_HINTS` |
450
+ | Azure AI Document Intelligence | cloud | `AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT`, `AZURE_DOCUMENT_INTELLIGENCE_KEY` | – |
451
+ | AWS Textract | cloud | `pip install "pyocr-toolkit[textract]"`, `AWS_REGION` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` (or `~/.aws`) |
452
+ | Mistral OCR | cloud | `MISTRAL_API_KEY` | `MISTRAL_OCR_MODEL` (default `mistral-ocr-latest`) |
453
+
454
+ Mistral OCR returns Markdown without word positions, so its search hits can't be drawn on the page image. In the
455
+ API, OCR sources are `ocr` (Tesseract) and `ocr:<engine>`, e.g. `ocr:easyocr`.
456
+
457
+ ## PDF libraries
458
+
459
+ Native text comes from PyMuPDF, but Python has other PDF libraries, and they don't all read a text layer the same
460
+ way: reading order, spacing, ligatures and odd font encodings come out differently. If your pipeline uses one of
461
+ them, check *that* library on your PDFs. Each installed library is its own source, `native:<library>`:
462
+
463
+ | Library | Source | Notes |
464
+ |---|---|---|
465
+ | PyMuPDF | `native` | always installed; word boxes |
466
+ | pypdf | `native:pypdf` | pure Python; used by many LangChain / LlamaIndex loaders |
467
+ | pdfplumber | `native:pdfplumber` | built on pdfminer.six; word boxes |
468
+ | pdfminer.six | `native:pdfminer` | pure-Python layout analysis |
469
+ | pypdfium2 | `native:pypdfium2` | PDFium, the engine in Chrome |
470
+
471
+ Install them all with `pip install "pyocr-toolkit[pdf]"` (or just the ones you need). In the page inspector, the
472
+ **Native** tab has a library picker and a **Test all libraries** button that reads the page with each one and shows
473
+ whether it got text out, how much, and how fast. The Compare page and exports list every installed library, so you
474
+ can score `native:pypdf` against `native` across a whole document. `pyocr libraries` shows what's installed, and
475
+ `pyocr extract FILE --engine native:pdfplumber` extracts with one of them. They read PDF files only.
476
+
408
477
  ## Command line
409
478
 
410
479
  ```bash
411
480
  pyocr extract report.pdf --engine llm -p anthropic --pages 1-5 --format jsonl -o report.jsonl
412
481
  pyocr extract report.pdf --engine llm --pages-per-request 5 # 5 pages in each LLM request
413
482
  pyocr extract scan.tiff --engine ocr --format md # Tesseract, Markdown to stdout
483
+ pyocr extract scan.pdf --engine ocr:easyocr # any OCR engine (see `pyocr engines`)
414
484
  pyocr extract born-digital.pdf --engine native # embedded text only, no network
485
+ pyocr extract born-digital.pdf --engine native:pypdf # the same text layer as pypdf reads it
415
486
  pyocr compare scan.pdf -p openai -m gpt-6.2-sol # per-page OCR / native CER vs an LLM
416
487
  pyocr extract scan.pdf -p anthropic --preprocess 'gray;auto;contrast=1.5' # adjust the image first (or a preset: clean, bw, ...)
417
488
  pyocr import a.pdf b.pdf scans.zip folder/ -w invoices # add many files as one workspace (zips unpacked)
418
489
  pyocr providers # which providers are ready
490
+ pyocr engines # which OCR engines are ready
419
491
  python -m pyocr_toolkit --help # same CLI without the script on PATH
420
492
  ```
421
493
 
@@ -446,8 +518,8 @@ you ask otherwise.
446
518
 
447
519
  1. **Native text.** A PDF page is a list of drawing instructions ("glyph 37 at (72, 700)"). Born-digital files map
448
520
  each glyph back to a character, so the text can be rebuilt exactly. A scan is only a picture, so it has no text.
449
- 2. **OCR.** The page is rendered to pixels (300 DPI) and Tesseract recognises characters from their shapes,
450
- reporting a box for each word. That is why search can highlight OCR hits on the page.
521
+ 2. **OCR.** The page is rendered to pixels (300 DPI) and an OCR engine (Tesseract by default) recognises characters
522
+ from their shapes, reporting a box for each word (or line, split into words). That is why search can highlight OCR hits on the page.
451
523
  3. **LLM.** The page image goes to a vision model with a strict "transcribe, don't correct" prompt
452
524
  ([`prompts.py`](https://github.com/utkarsh5026/pyocr/blob/main/src/pyocr_toolkit/llm/prompts.py)). It reads in context, so it is strong on hard pages, but it can
453
525
  "fix" typos, which the diff view exposes.
@@ -33,8 +33,8 @@ checking that step. Upload a document and you get three versions of every page:
33
33
 
34
34
  | | Source | What it is | Good at | Weak at |
35
35
  |---|---|---|---|---|
36
- | 📄 | **Native text** | Text already embedded in the file (PyMuPDF) | Born-digital PDFs. Exact and instant. | Scans have none. Broken font maps produce gibberish. |
37
- | 🔍 | **Tesseract OCR** | Classic OCR on the rendered page image | Free, local, fast, gives word positions | Tables, columns, poor scans, handwriting |
36
+ | 📄 | **Native text** | Text already embedded in the file (PyMuPDF, or pypdf / pdfplumber / pdfminer.six / pypdfium2) | Born-digital PDFs. Exact and instant. | Scans have none. Broken font maps produce gibberish. |
37
+ | 🔍 | **OCR** | Tesseract, or any of 8 other OCR engines (below), on the rendered page image | Free/local or cheap cloud, gives word positions | Varies by engine: Tesseract struggles with tables, columns, poor scans, handwriting |
38
38
  | ✨ | **LLM transcription** | A vision LLM told to copy the page *verbatim* | Hard pages, layout, context | Costs money. May quietly "fix" or skip text. |
39
39
 
40
40
  Then you can:
@@ -42,11 +42,16 @@ Then you can:
42
42
  - **Extract** page by page, a range like `1-5,9`, or the whole document, as background jobs
43
43
  - **Compare** any two sources: character and word error rate (CER/WER), word-level diffs, a per-page chart
44
44
  - **Search** across every document and every source at once
45
- - **Export** clean text as TXT, Markdown, JSON or JSONL for your pipeline
45
+ - **Export** clean text as TXT, Markdown, JSON or JSONL for your pipeline, or every source at once as JSON, CSV,
46
+ Markdown, JSONL or a ZIP
46
47
 
47
48
  **LLM providers:** Claude (Anthropic API), OpenAI, Azure OpenAI, Claude on Azure (Microsoft Foundry), Google
48
49
  Gemini, and any OpenAI-compatible server (Ollama, vLLM, LM Studio, OpenRouter) for local or private models.
49
50
 
51
+ **OCR engines:** Tesseract (default), plus RapidOCR, EasyOCR, PaddleOCR and docTR running locally, and Google
52
+ Cloud Vision, Azure AI Document Intelligence, AWS Textract and Mistral OCR in the cloud. Each engine is its own
53
+ source, so you can score engines against each other or against an LLM.
54
+
50
55
  **Inputs:** PDF, XPS, EPUB, CBZ, MOBI, FB2, SVG, PNG, JPEG, TIFF (multi-page), BMP, GIF, WebP and anything else
51
56
  [PyMuPDF](https://pymupdf.readthedocs.io/) opens.
52
57
 
@@ -131,7 +136,7 @@ Everything you upload and extract is stored in `./data` (change it with `DATA_DI
131
136
  | **Home** `/` | Drop files to upload; see setup status and recent documents. |
132
137
  | **Library** `/documents` | Document cards showing native / OCR / LLM coverage and how many pages still have no text. Filter by status, workspace or name; delete. |
133
138
  | **Workspaces** `/workspaces` | Named groups of documents. Uploading several files or a `.zip` offers to create one, with suggested names (from the file names, or `adjective-scientist` like `festive-albattani`). Open one to rename it, add files or remove documents. |
134
- | **Overview** `/documents/{id}` | Start background extraction (Tesseract or any LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
139
+ | **Overview** `/documents/{id}` | Start background extraction (any OCR engine or LLM) for all pages or a range such as `1-5,9`, typed or picked on a clickable page map (Shift-click for a range; presets for scans only or pages without text yet); choose pages per LLM request; follow progress; see every *source* (engine + model + prompt) with token usage; export; page thumbnails. |
135
140
  | **Page inspector** `/documents/{id}/pages/{n}` | Page image next to native, OCR and LLM text; run OCR or an LLM on just this page; per-page diff; a *Side by side* tab with all three texts in synced columns; search hits drawn on the image; *Adjust* to preprocess the image the LLM receives (filters, fine-tuning, crop/rotate) and A/B it against the original. Keyboard: `←/→`, `/`, `1-5`, `t`, `o`, `e`. |
136
141
  | **Full text** `/documents/{id}/text` | Read the whole document from one source, optionally beside the page images; find, copy, download. |
137
142
  | **Compare** `/documents/{id}/compare` | Score source B against source A on every page: document-level CER/WER, a clickable CER-per-page chart, and an aligned side-by-side diff of the selected page (opens on the worst page). Works for OCR vs LLM, native vs LLM, or **model vs model**. |
@@ -162,17 +167,62 @@ and the hint under each model box say whether a model suits transcription (custo
162
167
  images. For a fully local setup, run Ollama with a vision model and set
163
168
  `OPENAI_COMPATIBLE_BASE_URL=http://localhost:11434/v1`.
164
169
 
170
+ ## Configure OCR engines
171
+
172
+ Tesseract is the default engine. Every other engine is optional, and the Providers page (and `pyocr engines`) shows
173
+ which are ready, with a **Test** button for each. Cloud keys and engine settings can be set there too, or as
174
+ environment variables. Local engines run on your machine; the first run downloads the
175
+ model weights. Cloud engines send the rendered page image to that service, and nowhere else.
176
+
177
+ | Engine | Kind | Install / required settings | Optional |
178
+ |---|---|---|---|
179
+ | Tesseract | local | system package (`apt install tesseract-ocr`, `brew install tesseract`) | `TESSERACT_LANGUAGE` |
180
+ | RapidOCR | local | `pip install "pyocr-toolkit[rapidocr]"` (ONNX Runtime, no PyTorch) | – |
181
+ | EasyOCR | local | `pip install "pyocr-toolkit[easyocr]"` (PyTorch) | `EASYOCR_LANGUAGES`, `OCR_GPU` |
182
+ | PaddleOCR | local | `pip install "pyocr-toolkit[paddleocr]"` (PaddlePaddle) | `PADDLEOCR_LANGUAGE` |
183
+ | docTR | local | `pip install "pyocr-toolkit[doctr]"` (PyTorch) | `OCR_GPU` |
184
+ | Google Cloud Vision | cloud | `GOOGLE_VISION_API_KEY` | `GOOGLE_VISION_LANGUAGE_HINTS` |
185
+ | Azure AI Document Intelligence | cloud | `AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT`, `AZURE_DOCUMENT_INTELLIGENCE_KEY` | – |
186
+ | AWS Textract | cloud | `pip install "pyocr-toolkit[textract]"`, `AWS_REGION` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` (or `~/.aws`) |
187
+ | Mistral OCR | cloud | `MISTRAL_API_KEY` | `MISTRAL_OCR_MODEL` (default `mistral-ocr-latest`) |
188
+
189
+ Mistral OCR returns Markdown without word positions, so its search hits can't be drawn on the page image. In the
190
+ API, OCR sources are `ocr` (Tesseract) and `ocr:<engine>`, e.g. `ocr:easyocr`.
191
+
192
+ ## PDF libraries
193
+
194
+ Native text comes from PyMuPDF, but Python has other PDF libraries, and they don't all read a text layer the same
195
+ way: reading order, spacing, ligatures and odd font encodings come out differently. If your pipeline uses one of
196
+ them, check *that* library on your PDFs. Each installed library is its own source, `native:<library>`:
197
+
198
+ | Library | Source | Notes |
199
+ |---|---|---|
200
+ | PyMuPDF | `native` | always installed; word boxes |
201
+ | pypdf | `native:pypdf` | pure Python; used by many LangChain / LlamaIndex loaders |
202
+ | pdfplumber | `native:pdfplumber` | built on pdfminer.six; word boxes |
203
+ | pdfminer.six | `native:pdfminer` | pure-Python layout analysis |
204
+ | pypdfium2 | `native:pypdfium2` | PDFium, the engine in Chrome |
205
+
206
+ Install them all with `pip install "pyocr-toolkit[pdf]"` (or just the ones you need). In the page inspector, the
207
+ **Native** tab has a library picker and a **Test all libraries** button that reads the page with each one and shows
208
+ whether it got text out, how much, and how fast. The Compare page and exports list every installed library, so you
209
+ can score `native:pypdf` against `native` across a whole document. `pyocr libraries` shows what's installed, and
210
+ `pyocr extract FILE --engine native:pdfplumber` extracts with one of them. They read PDF files only.
211
+
165
212
  ## Command line
166
213
 
167
214
  ```bash
168
215
  pyocr extract report.pdf --engine llm -p anthropic --pages 1-5 --format jsonl -o report.jsonl
169
216
  pyocr extract report.pdf --engine llm --pages-per-request 5 # 5 pages in each LLM request
170
217
  pyocr extract scan.tiff --engine ocr --format md # Tesseract, Markdown to stdout
218
+ pyocr extract scan.pdf --engine ocr:easyocr # any OCR engine (see `pyocr engines`)
171
219
  pyocr extract born-digital.pdf --engine native # embedded text only, no network
220
+ pyocr extract born-digital.pdf --engine native:pypdf # the same text layer as pypdf reads it
172
221
  pyocr compare scan.pdf -p openai -m gpt-6.2-sol # per-page OCR / native CER vs an LLM
173
222
  pyocr extract scan.pdf -p anthropic --preprocess 'gray;auto;contrast=1.5' # adjust the image first (or a preset: clean, bw, ...)
174
223
  pyocr import a.pdf b.pdf scans.zip folder/ -w invoices # add many files as one workspace (zips unpacked)
175
224
  pyocr providers # which providers are ready
225
+ pyocr engines # which OCR engines are ready
176
226
  python -m pyocr_toolkit --help # same CLI without the script on PATH
177
227
  ```
178
228
 
@@ -203,8 +253,8 @@ you ask otherwise.
203
253
 
204
254
  1. **Native text.** A PDF page is a list of drawing instructions ("glyph 37 at (72, 700)"). Born-digital files map
205
255
  each glyph back to a character, so the text can be rebuilt exactly. A scan is only a picture, so it has no text.
206
- 2. **OCR.** The page is rendered to pixels (300 DPI) and Tesseract recognises characters from their shapes,
207
- reporting a box for each word. That is why search can highlight OCR hits on the page.
256
+ 2. **OCR.** The page is rendered to pixels (300 DPI) and an OCR engine (Tesseract by default) recognises characters
257
+ from their shapes, reporting a box for each word (or line, split into words). That is why search can highlight OCR hits on the page.
208
258
  3. **LLM.** The page image goes to a vision model with a strict "transcribe, don't correct" prompt
209
259
  ([`prompts.py`](https://github.com/utkarsh5026/pyocr/blob/main/src/pyocr_toolkit/llm/prompts.py)). It reads in context, so it is strong on hard pages, but it can
210
260
  "fix" typos, which the diff view exposes.
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "pyocr-toolkit"
3
- version = "0.4.0"
4
- description = "Inspect and compare PDF/image text extraction - native text, Tesseract OCR and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser."
3
+ version = "0.5.0"
4
+ description = "Inspect and compare PDF/image text extraction - native text, OCR engines (Tesseract, EasyOCR, PaddleOCR, docTR, RapidOCR, Google Vision, Azure, Textract, Mistral) and LLMs (Claude, GPT, Gemini, Azure, local) - in your browser."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
7
7
  license = { file = "LICENSE" }
8
8
  authors = [{ name = "utkarsh5026" }]
9
- keywords = ["ocr", "pdf", "tesseract", "llm", "document-ai", "text-extraction", "rag", "pymupdf", "claude", "openai"]
9
+ keywords = ["ocr", "pdf", "tesseract", "easyocr", "paddleocr", "doctr", "textract", "llm", "document-ai", "text-extraction", "rag", "pymupdf", "pypdf", "pdfplumber", "claude", "openai"]
10
10
  classifiers = [
11
11
  "Development Status :: 4 - Beta",
12
12
  "Environment :: Web Environment",
@@ -35,10 +35,21 @@ dependencies = [
35
35
  "anthropic>=1.0",
36
36
  "openai>=1.40",
37
37
  "google-genai>=1.0",
38
+ "httpx>=0.27",
38
39
  ]
39
40
 
40
41
  [project.optional-dependencies]
41
- dev = ["pytest>=8", "httpx>=0.27", "ruff>=0.5", "rich>=13"]
42
+ dev = ["pytest>=8", "httpx>=0.27", "ruff>=0.5", "rich>=13",
43
+ "pypdf>=4", "pdfplumber>=0.11", "pdfminer.six>=20231228", "pypdfium2>=4"]
44
+ # Other PDF libraries to read the text layer with, next to PyMuPDF (native:<library> sources).
45
+ pdf = ["pypdf>=4", "pdfplumber>=0.11", "pdfminer.six>=20231228", "pypdfium2>=4"]
46
+ # Optional OCR engines (Tesseract needs only the system binary). Google Vision,
47
+ # Azure Document Intelligence and Mistral OCR need no extra packages.
48
+ rapidocr = ["rapidocr>=2", "onnxruntime>=1.17"]
49
+ easyocr = ["easyocr>=1.7"]
50
+ paddleocr = ["paddleocr>=3", "paddlepaddle>=3"]
51
+ doctr = ["python-doctr[torch]>=0.10"]
52
+ textract = ["boto3>=1.34"]
42
53
 
43
54
  [project.urls]
44
55
  Homepage = "https://github.com/utkarsh5026/pyocr"
@@ -1,3 +1,3 @@
1
1
  """pyocr-toolkit - inspect PDF/image text extraction: native text vs Tesseract OCR vs LLM transcription."""
2
2
 
3
- __version__ = "0.4.0"
3
+ __version__ = "0.5.0"