Repository navigation
Conversation
Signed-off-by: wangshun <96341168+xixi-box@users.noreply.github.com>
This branch has not been deployed
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.
Fixes #6131
Description
The builtin PDF parser drops visible signature images when they live in a form widget’s appearance stream. Native PDF image extraction reads page content objects, while scanned-page rendering previously left form drawing uninitialized.
Initialize AcroForm rendering and crop visible signature appearances into the existing native PDF image references. Keep searchable page text and use the remaining embedded-image budget for the new crops. Scanned-page JPEGs show the signature in place and retain their existing OCR routing.
Type of Change
Related Issue
Fixes #6131
Testing
Tests:$(printf '%s\n' docreader/tests/test_pdf_*.py docreader/tests/test_source_locator_pdf.py docreader/tests/test_docreader_stream.py docreader/tests/test_parser_routing.py docreader/tests/test_opendataloader_parser.py | sed 's/.py$ //; s|/|.|g') — pre-change exit 0 (119 tests run, 3 fixture skips). Patched exit 0 (121 tests run, 3 fixture skips).
uv run --project docreader --locked --python 3.10.18 python -m unittest -v docreader.tests.test_pdf_image_sources.PDFImageSourceTest.test_native_pdf_exposes_signature_appearance docreader.tests.test_pdf_image_sources.PDFImageSourceTest.test_forced_scan_renders_signature_appearance.Result: uv run --project docreader --locked --python 3.10.18 python -m unittest -v docreader.tests.test_pdf_image_sources.PDFImageSourceTest.test_native_pdf_exposes_signature_appearance docreader.tests.test_pdf_image_sources.PDFImageSourceTest.test_forced_scan_renders_signature_appearance — on an archive of HEAD with only the final regression test copied in, exit 1 with four behavioral subtest failures. On the patched tree, exit 0, two tests passed.
Result: uv run --project docreader --locked --python 3.10.18 python -m unittest -v
Result: uv run --project docreader --locked --python 3.10.18 python -m compileall -q docreader/main.py docreader/parser docreader/tests — exit 0.
Result: git diff --check — exit 0.
Regression coverage:
docreader/tests/test_pdf_image_sources.py.Checklist
git diff --check origin/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)website-docs/, Swagger annotations, etc.)Screenshots / Recordings
Parser-only change.