Repository navigation
Recover truncated inline-image PDF text per page with optional PyMuPDF - #2556
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 2 commits into
Open
Çağdaş Yürekli (cagdasyurekli) wants to merge 2 commits into
Çağdaş Yürekli (cagdasyurekli) wants to merge 2 commits into
Conversation
Contributor
Author
|
Updated the branch with current main ( Validation on Python 3.12 with PyMuPDF 1.28.2: Black 23.7.0 and git diff --check pass; full core pytest: 1059 passed, 57 skipped under the repository CI skip policy. The optional PDF recovery regression tests ran successfully. |
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.
PDF text can stop at an inline image while conversion still returns a plausible prefix. This adds optional, local, per-page recovery through
markitdown[pdf,pdf-recovery].The recovery backend inspects decoded images, including compressed page streams, and replaces a plain page only when its extracted words strictly extend the primary word sequence. Empty primary pages are eligible. Pages recognized as forms/tables retain their existing Markdown, and there is no whole-document length gate or replacement. Backend absence/failure keeps the primary extraction. PyMuPDF is not added to the
allorpdfextras.Relates to #1870; alternative to #1883, #1889 and #2092, incorporating the per-page preservation and compressed-stream review concerns. This is not a claim that every affected PDF is recovered: reordered text and form/table pages are deliberately left alone, and there is no OCR.
Validation:
~terminator that PyMuPDF tolerates while pdfminer consumes following text. Fixture provenance is included. This demonstrates the parser-divergence case, not that all valid inline images cause truncation.git diff --checkpass.Trade-off: installing the optional backend adds a second local PDF inspection pass. Without it, the normal extraction path is retained.