@opendataloader/pdf 2.5.11 → 2.5.12

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.
package/README.md CHANGED
@@ -130,7 +130,7 @@ opendataloader_pdf.convert(
130
130
  | Standard digital PDF | Fast (default) | `pip install opendataloader-pdf` | None needed | `opendataloader-pdf file1.pdf file2.pdf folder/` |
131
131
  | Complex or nested tables | **Hybrid** | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --port 5002` | `opendataloader-pdf --hybrid docling-fast file1.pdf file2.pdf folder/` |
132
132
  | Scanned / image-based PDF | Hybrid + OCR | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --port 5002 --force-ocr` | `opendataloader-pdf --hybrid docling-fast file1.pdf file2.pdf folder/` |
133
- | Non-English scanned PDF | Hybrid + OCR | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --port 5002 --force-ocr --ocr-lang "ko,en"` | `opendataloader-pdf --hybrid docling-fast file1.pdf file2.pdf folder/` |
133
+ | Non-English scanned PDF | Hybrid + OCR | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --port 5002 --force-ocr --ocr-engine <engine> --ocr-lang <codes>` — see [Choosing an OCR Engine](#choosing-an-ocr-engine) | `opendataloader-pdf --hybrid docling-fast file1.pdf file2.pdf folder/` |
134
134
  | Mathematical formulas | Hybrid + formula | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --enrich-formula` | `opendataloader-pdf --hybrid docling-fast --hybrid-mode full file1.pdf file2.pdf folder/` |
135
135
  | Charts needing description | Hybrid + picture | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --enrich-picture-description` | `opendataloader-pdf --hybrid docling-fast --hybrid-mode full file1.pdf file2.pdf folder/` |
136
136
  | Nested sections for RAG chunking | Hybrid + heading levels | `pip install "opendataloader-pdf[hybrid]"` | `opendataloader-pdf-hybrid --port 5002 --heading-hierarchy` | `opendataloader-pdf --hybrid docling-fast file1.pdf file2.pdf folder/` |
@@ -229,7 +229,44 @@ For non-English documents, specify the language:
229
229
  opendataloader-pdf-hybrid --port 5002 --force-ocr --ocr-lang "ko,en"
230
230
  ```
231
231
 
232
- Supported languages: `en`, `ko`, `ja`, `ch_sim`, `ch_tra`, `de`, `fr`, `ar`, and more.
232
+ The language codes above are for the default engine (EasyOCR): `en`, `ko`, `ja`, `ch_sim`, `ch_tra`, `de`, `fr`, `ar`, and more.
233
+
234
+ #### Choosing an OCR Engine
235
+
236
+ OCR quality varies with the engine, the language, and the document itself (scan resolution, fonts, layout). No engine is best for every document, so run a few representative pages through several engines and compare the output before processing a whole collection.
237
+
238
+ Select the engine with `--ocr-engine`. Each engine uses its own language code system for `--ocr-lang`:
239
+
240
+ | Engine | `--ocr-engine` | `--ocr-lang` example | Platform / extra install |
241
+ |--------|----------------|----------------------|--------------------------|
242
+ | EasyOCR (default) | `easyocr` | `ko,en` (ISO 639-1) | Included in `opendataloader-pdf[hybrid]` |
243
+ | RapidOCR | `rapidocr` | `korean` (RapidOCR codes: `en`, `ch`, `japan`, `korean`, ...) | `pip install rapidocr onnxruntime` |
244
+ | Tesseract (CLI) | `tesseract` | `kor,eng` (ISO 639-2) | Tesseract binary + language data (e.g. `tesseract-ocr-kor`) |
245
+ | Tesseract (Python binding) | `tesserocr` | `kor,eng` (ISO 639-2) | `pip install tesserocr` + libtesseract |
246
+ | Apple Vision | `ocrmac` | `ko-KR,en-US` (BCP-47) | macOS only, `pip install ocrmac` |
247
+ | NVIDIA Nemotron OCR | `nemotron-ocr` | `multilingual` or `english` | Linux x86_64 + CUDA, `pip install "docling[feat-ocr-nemotron]"` |
248
+ | Automatic | `auto` | Not configurable | Docling picks an available engine |
249
+
250
+ To compare engines on a sample, start one server per engine and send the same file to each.
251
+
252
+ **Terminal 1** — EasyOCR server:
253
+
254
+ ```bash
255
+ opendataloader-pdf-hybrid --port 5002 --force-ocr --ocr-engine easyocr --ocr-lang "ko,en"
256
+ ```
257
+
258
+ **Terminal 2** — Tesseract server:
259
+
260
+ ```bash
261
+ opendataloader-pdf-hybrid --port 5003 --force-ocr --ocr-engine tesseract --ocr-lang "kor,eng"
262
+ ```
263
+
264
+ **Terminal 3** — Send the same sample to both:
265
+
266
+ ```bash
267
+ opendataloader-pdf sample.pdf --hybrid docling-fast --hybrid-mode full --hybrid-url http://localhost:5002 -o out-easyocr
268
+ opendataloader-pdf sample.pdf --hybrid docling-fast --hybrid-mode full --hybrid-url http://localhost:5003 -o out-tesseract
269
+ ```
233
270
 
234
271
  ### Formula Extraction (LaTeX)
235
272
 
@@ -270,14 +307,45 @@ opendataloader-pdf --hybrid docling-fast --hybrid-mode full file1.pdf file2.pdf
270
307
  Output in JSON:
271
308
  ```json
272
309
  {
273
- "type": "picture",
310
+ "type": "image",
311
+ "pdfua_tag": "Figure",
312
+ "id": 285,
274
313
  "page number": 1,
275
314
  "bounding box": [72.0, 400.0, 540.0, 650.0],
276
- "description": "A bar chart showing waste generation by region from 2016 to 2030..."
315
+ "alt": "A bar chart showing waste generation by region from 2016 to 2030...",
316
+ "alt_source": "ai-generated"
277
317
  }
278
318
  ```
279
319
 
320
+ `alt_source` says where the text came from: `original` (the PDF's own /Alt), `ai-generated`,
321
+ or `missing` — and when it is `missing`, there is no `alt` field at all.
322
+
323
+ With `--enrich-picture-description`, every picture goes to the model whatever its size. The
324
+ server reports the tally per request, so a picture that came back without a description shows
325
+ up in the log rather than only in the output:
326
+
327
+ ```
328
+ picture_description pictures=4 described=4
329
+ ```
330
+
331
+ Cost follows the number of pictures, not their size: a 40×20 pt logo costs about what a
332
+ full-page chart does, and on CPU one picture can take over a minute. A document full of icons
333
+ is therefore minutes of work per page, and conversions are serialized, so other requests wait.
334
+ `--picture-area-threshold 0.05` spends the model only on pictures covering at least 5% of
335
+ their page:
336
+
337
+ ```
338
+ picture_description pictures=4 described=1 skipped=3 threshold=0.05
339
+ ```
340
+
341
+ Skips are logged at INFO when you set a threshold, and at WARNING when you did not — in that
342
+ case nothing was asked to drop them, so the cause is worth a look.
343
+
280
344
  > Uses SmolVLM (256M), a lightweight vision model. Custom prompts supported via `--picture-description-prompt`.
345
+ > Since the picture count comes from the uploaded file, a server reachable by untrusted callers
346
+ > should set `--picture-area-threshold`, and `--max-file-size` to cap the conversion work one
347
+ > file can ask for. That limit is applied once the request body has been received, so it bounds
348
+ > conversion cost rather than upload bandwidth or temporary disk.
281
349
 
282
350
  ### Heading Hierarchy
283
351
 
@@ -542,11 +610,11 @@ Yes. OpenDataLoader runs 100% locally. No API calls, no data transmission — yo
542
610
 
543
611
  ### Does it support OCR for scanned PDFs?
544
612
 
545
- Yes, via hybrid mode. Install with `pip install "opendataloader-pdf[hybrid]"`, start the backend with `--force-ocr`, then process as usual. Supports multiple languages including Korean, Japanese, Chinese, Arabic, and more via `--ocr-lang`.
613
+ Yes, via hybrid mode. Install with `pip install "opendataloader-pdf[hybrid]"`, start the backend with `--force-ocr`, then process as usual. Supports multiple languages including Korean, Japanese, Chinese, Arabic, and more via `--ocr-lang`, with a choice of OCR engines via `--ocr-engine`. Quality varies by engine, language, and document — see [Choosing an OCR Engine](#choosing-an-ocr-engine).
546
614
 
547
615
  ### Does it work with Korean, Japanese, or Chinese documents?
548
616
 
549
- Yes. For digital PDFs, text extraction works out of the box. For scanned PDFs, use hybrid mode with `--force-ocr --ocr-lang "ko,en"` (or `ja`, `ch_sim`, `ch_tra`). Coming soon: [Hancom Data Loader](https://sdk.hancom.com/en/services/1?utm_source=github&utm_medium=readme&utm_campaign=opendataloader-pdf) integration — enterprise-grade AI document analysis with built-in production-grade OCR and customer-customized models optimized for your specific document types and workflows.
617
+ Yes. For digital PDFs, text extraction works out of the box. For scanned PDFs, use hybrid mode with `--force-ocr --ocr-lang "ko,en"` (or `ja`, `ch_sim`, `ch_tra`), and compare OCR engines on a sample of your documents — see [Choosing an OCR Engine](#choosing-an-ocr-engine). Coming soon: [Hancom Data Loader](https://sdk.hancom.com/en/services/1?utm_source=github&utm_medium=readme&utm_campaign=opendataloader-pdf) integration — enterprise-grade AI document analysis with built-in production-grade OCR and customer-customized models optimized for your specific document types and workflows.
550
618
 
551
619
  ### How fast is it?
552
620
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opendataloader/pdf",
3
- "version": "2.5.11",
3
+ "version": "2.5.12",
4
4
  "description": "A Node.js wrapper for the opendataloader-pdf Java CLI.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",