Repository navigation
feat(pdf): make PaddleOCR-VL a getPDFReader provider - #146
Closed
chadtalsma-svg wants to merge 3 commits into
Closed
chadtalsma-svg wants to merge 3 commits into
chadtalsma-svg wants to merge 3 commits into
Conversation
provider: 'paddleocr' returns a complete PDFReader: extractText and performOCR go to the PaddleOCR-VL /layout-parsing service; getInfo, metadata, embedded images and page renders run locally through unpdf. Explicit only (auto never selects it), no retry and no local OCR fallback. PaddleOCRClient gains parseImage() for PNG and JPEG. Closes happyvertical#145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refuse every named OCR engine (tesseract included), convert WebP to PNG before OCR, stop inheriting the reader timeout, throw when the service returns a different page count, and honour enableOCR: false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rtical#145) A damaged or encrypted PDF probes as 0 pages locally but may still parse remotely. Also match WebP by canonical format and report an undecodable WebP as EINVAL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 16, 2026
This was referenced Oct 16, 2026
Contributor
|
Reviewed and integrated with original authorship into #148. Fixed the per-image response contract: zero or multiple returned pages now fail instead of being accepted as OCR output. Also replaced the broken pnpm pin under #147. All 218 tests and packed-consumer smoke checks pass; independent review is CLEAN. #148 is running normal same-repository CI and will supersede this PR after merge and release. |
Contributor
|
Released implementation is integrated through #148, which preserved your original commits and passed PR and merge-queue CI. The on-main Publish workflow is now running; closing this superseded source PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes PaddleOCR-VL a full
getPDFReaderbackend, interchangeable withunpdfandkreuzberg, so code written against the reader interface can switch to it by name. For example,@happyvertical/smrt-ingestionbuilds its reader in a child process from{ provider }.getPDFReader({ provider: 'paddleocr' })(orHAVE_PDF_PROVIDER=paddleocr) returns a reader that splits the work as follows:extractText/layout-parsing, returning Markdown with tables as HTML.pagesselects from the parsed pages.performOCR(images)fileType: 1). WebP and raw pixels are converted to PNG first.getInfo,extractMetadata,extractImages,renderPagesRules:
autonever selects it, and it runs on Node only. A missing or invalid service URL fails atgetPDFReader(), not on first use.ocrProviderother thanautois refused, includingtesseract.EPADDLERESPONSErather than passing the gap off as blank pages. A PDF unpdf can't open (0 local pages) skips the check.preferEmbeddedText(option, orHAVE_PDF_PADDLEOCR_PREFER_EMBEDDED_TEXT) reads PDFs that already have a text layer locally.skipOCRFallbackandenableOCR: falseread only the local text layer and send nothing.paddleocr.maxFileSizefalls back to the reader'smaxFileSize. The reader'stimeoutis deliberately not inherited, because a limit sized for local parsing would cut off a cold start.PaddleOCRClientgainsparseImage()for PNG and JPEG.parse()behaves as before.src/index.tsexports only the options type, and the provider loads lazily through the factory.This fits the rule "Keep OCR behavior behind
@happyvertical/ocr": the PR adds no OCR provider logic. It routes the reader's OCR step to the document-parsing service this package already integrates (#142), and the local OCR providers are untouched.Validation:
pnpm lint(5 warnings, all already on main),docs:api:check,typecheckandbuildall pass.pnpm testpasses 215 tests with 2 skipped; the 18 new contract tests run against a local HTTP stub. Live GPU parsing is checked downstream in teamworksfab/teamworks-os.Independent review: Claude Opus 5.5, standard risk, three passes.
enableOCR: falsewas ignored.Closes #145
🤖 Generated with Claude Code