Skip to content

fix(engines): tolerate unreadable pages when opening a document - #784

Open
calebkish wants to merge 1 commit into
embedpdf:v2from
calebkish:fix/resilient-page-open
Open

fix(engines): tolerate unreadable pages when opening a document#784
calebkish wants to merge 1 commit into
embedpdf:v2from
calebkish:fix/resilient-page-open

Conversation

@calebkish

Copy link
Copy Markdown

A single page whose dictionary PDFium cannot parse previously failed the entire openDocumentBuffer call. Fall back to a 0x0 size for that page and keep going, matching the resilient page-reading behavior of the v3 engine (PagesReader in @embedpdf/engine-services).

Also normalize EPDF_GetPageRotationByIndex: it returns -1 on error, which the downstream rotation & 3 math would otherwise treat as 270 degrees. Clamp a failed read to 0.

    A single page whose dictionary PDFium cannot parse previously failed the
    entire openDocumentBuffer call. Fall back to a 0x0 size for that page and
    keep going, matching the resilient page-reading behavior of the v3 engine
    (PagesReader in @embedpdf/engine-services).

    Also normalize EPDF_GetPageRotationByIndex: it returns -1 on error, which
    the downstream `rotation & 3` math would otherwise treat as 270 degrees.
    Clamp a failed read to 0.
@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

@calebkish is attempting to deploy a commit to the CloudPDF Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant