Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdfs with flattened forms can't be printed in Adobe Reader or Acrobat #1387

Open
2 tasks done
morleytatro opened this issue Jan 31, 2023 · 5 comments
Open
2 tasks done

Comments

@morleytatro
Copy link

morleytatro commented Jan 31, 2023

What were you trying to do?

Print a pdf flattened with pdf-lib.

How did you attempt to do it?

Open the file in Adobe Reader or Acrobat, and click cmd/ctl + P.

What actually happened?

Two successive errors popped up:

  • The document could not be printed.
  • There were no pages selected to print.

What did you expect to happen?

The pages to print.

How can we reproduce the issue?

Download the flattened form here by clicking the button:
https://jsfiddle.net/Hopding/skevywdz/2/

Open the file in either Adobe Reader or Adobe Acrobat and print it.

Version

1.17.1

What environment are you running pdf-lib in?

Browser, 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

Tested in Acrobat DC Pro 2022.002.20191 on Mac OS 13.0.1

Screenshot 2023-01-31 at 2 16 15 PM

@collinversluis
Copy link

collinversluis commented Mar 9, 2023

This is also happening for me. A few notes from testing that I have.

1.) This does NOT occur with pdfs that only have text input fields with their own unique names
2.) This does occur on a pdf with only text input fields that share a common name

Therefore, It seems to be related to any pdf field that is flattened with child widgets.

Additionally an Acrobat preflight shows "Incorrect value type for array element at index N"

image

I have yet to find a workaround.

@HofmannZ
Copy link

Do you have any updates on this? (We're experiencing the same issue).

@HofmannZ
Copy link

WORKAROUND:

Replace:

pdfForm.flatten();

with:

pdfForm.getFields().forEach((formField) => formField.enableReadOnly());

Additionally, the resulting PDF is smaller. We are not sure how/why.

@morleytatro
Copy link
Author

WORKAROUND:

Replace:

pdfForm.flatten();

with:

pdfForm.getFields().forEach((formField) => formField.enableReadOnly());

Additionally, the resulting PDF is smaller. We are not sure how/why.

Yep, that is the exact same workaround I used.

@gbryant3000
Copy link

This PR fixed the issue for me: #1268

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

No branches or pull requests

4 participants