Skip to content

Error: Could not find page for PDFRef 270 0 R #1349

@enoh-barbu

Description

@enoh-barbu

What were you trying to do?

Flatten pdf form

How did you attempt to do it?

const form = pdfDoc.getForm();
form.flatten();

What actually happened?

I received an error:

Error: Could not find page for PDFRef 270 0 R
    at PDFForm.findWidgetPage (/usr/app/node_modules/pdf-lib/src/api/form/PDFForm.ts:713:15)
    at PDFForm.flatten (/usr/app/node_modules/pdf-lib/src/api/form/PDFForm.ts:550:27)
    at /usr/app/src/index.ts:116:18
    at Generator.next (<anonymous>)
    at fulfilled (/usr/app/src/index.ts:5:58)

What did you expect to happen?

I should not receive that error

How can we reproduce the issue?

I can't provide my pdf document, but it seems that the pdf is containing some strange/bkoken form fields

Version

1.17.1

What environment are you running pdf-lib in?

Node

Checklist

  • My report includes a Short, Self Contained, Correct (Compilable) Example.
  • I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions