stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
450 stars 167 forks source link

Form checkbox not loading as checked #2331

Closed RyanHow closed 1 month ago

RyanHow commented 1 month ago

Does the bug also happen on https://mozilla.github.io/pdf.js/web/viewer.html? (If so, please open the issue at Mozilla's bugtracker).

No

CleanShot 2024-05-14 at 00 22 13@2x

Does the bug also happen on https://pdfviewer.net/simple?

Yes

CleanShot 2024-05-14 at 00 24 34@2x

Describe the bug

Version info Version 18.1.14 and version 20.0.0

Demo PDF file Section 7 checkbox issue.pdf

papes1ns commented 1 month ago

Hello, I am currently experiencing the same issue using version "18.1.9".

For example we are downloading a PDF from our API that has many text fields and checkboxes pre-filled out so the user has less manual entry to do.

In recent versions > 16, the checkboxes currently don't show as checked when they should. We also have a similar issue for pre-filled text field data not showing either but have a workaround in place by binding a modified data object to [(formData)]

Focusing on the checkbox issue here, what's strange is that the checkbox does show as checked when printing the PDF.

RyanHow commented 1 month ago

Thanks for the extra info!

We're not using form binding.

If that's causing the issue, I wonder if there is a way to simply disable it 🤔

stephanrauh commented 1 month ago

I've fixed the issue. Disabling form binding is also a good idea. If everything works according as intended, you won't notice the effect of form binding, but it wastes some CPU resources and adds to our CO2 footprint. I'll keep that in mind.

stephanrauh commented 1 month ago

Along the way, I've also fixed a rare corner case that caused the PDF viewer to render the defaut value of a text field, even though it has been overwritten by Angular. The error showed in the form demo showcase - it displayed the wrong number of "year of job experience".

stephanrauh commented 1 month ago

Your bugfix has landed with version 20.2.0.

Enjoy! Stephan

RyanHow commented 1 month ago

Thank you @stephanrauh !

Sounded like a curly one!