Skip to content

fix(flash): index PDF streams from any cursor position - #719

Open
DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/flash-pdf-stream-position
Open

DivyamTalwar wants to merge 1 commit into
VectifyAI:mainfrom
DivyamTalwar:fix/flash-pdf-stream-position

Conversation

@DivyamTalwar

Copy link
Copy Markdown

Summary

Calling page_index_flash() with an in-memory PDF used to require the caller to rewind it first. A populated BytesIO commonly sits at the end after a PDF writer finishes. Flash checked for the PDF header at that cursor and rejected the valid document.

Read the header at byte zero and restore the caller's position. Preserve that position after PDFium layout extraction as well.

Validation

  • The new tests index a two-page in-memory PDF through the public API with the stream at its middle or end. Main rejects both; the patch produces the same tree as an initial-position stream and preserves the original position.
  • 5 targeted Flash tests passed, including file-input and no-heading behavior.
  • git diff --check passes.

This branch has not been deployed

No deployments
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