Skip to content

fix: recover PDF text after inline images#1889

Open
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/pdf-inline-image-recovery
Open

fix: recover PDF text after inline images#1889
he-yufeng wants to merge 1 commit into
microsoft:mainfrom
he-yufeng:fix/pdf-inline-image-recovery

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • add a lazy PyMuPDF text-recovery pass for PDFs with inline image operators
  • keep PyMuPDF optional: no default dependency change, and the fallback only runs when the package is installed
  • warn instead of silently returning likely partial text when inline-image recovery is needed but PyMuPDF is unavailable
  • add regression coverage for both the recovery and warning paths

Addresses #1870.

Test plan

  • python -m pytest packages/markitdown/tests/test_pdf_memory.py -q -k "inline_image"
  • python -m pytest packages/markitdown/tests/test_pdf_memory.py packages/markitdown/tests/test_pdf_tables.py -q
  • python -m py_compile packages/markitdown/src/markitdown/converters/_pdf_converter.py packages/markitdown/tests/test_pdf_memory.py
  • python -m mypy --ignore-missing-imports packages/markitdown/src/markitdown/converters/_pdf_converter.py packages/markitdown/tests/test_pdf_memory.py
  • python -m pip install -e "packages/markitdown[pymupdf]"
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants