Skip to content

[Bug]: PDF.js javascript not working in fillable PDF #19926

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

Open
JMarcosHP opened this issue May 14, 2025 · 3 comments
Open

[Bug]: PDF.js javascript not working in fillable PDF #19926

JMarcosHP opened this issue May 14, 2025 · 3 comments

Comments

@JMarcosHP
Copy link

JMarcosHP commented May 14, 2025

Attach (recommended) or Link to PDF file

I have fillable PDF with a form to introduce numeric values and then at the bottom of the table get the total sum of the values. But is not working using the demo version of PDF,js, Firefox 138 for android, and Firefox 138 Snap for Ubuntu.

S-21_E.pdf

Web browser and its version

Firefox 138

Operating system and its version

Ubuntu 25.04, Windows 11 24H2

PDF.js version

5.1.73 [a6a997fe4]

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Just open the PDF file.
  2. Try to fill with numbers
  3. The code is not executing

What is the expected behavior?

Get the total of all the values

PDF working in adobe reader:

Image

What went wrong?

The code is not executing when I introduce the values and then I press enter to get the sum.

PDF in PDF.js demo:

Image

PDF in Firefox 138:

Image

Link to a viewer

No response

Additional context

PDF file created with:

[1.4 Acrobat Distiller 15.0 (Windows); modified using iTextSharp™ 5.5.3 ©2000-2014 iText Group NV (AGPL-version)

I'm not the owner of this PDF file as it is propietary with copyright and embedded fonts from the author not available for download. Sometimes this fonts not render with the correct size if you save using PDF.js

@calixteman
Copy link
Contributor

The AcroForm dictionary has a Fields entry but this one is empty and consequently we don't create a sandbox.

Image

@calixteman
Copy link
Contributor

More generally, if the AcroForm doesn't contain some fields, when we meet an annotation with some js actions then we could collect all the form annotations in the document, that would require to get all the pages to look for all their annotations, and then trigger a sandbox creation.
We need to get all the pages because an annotation on page 1 could modify an other one on page 1234.
Fortunately, most of the time form fields are in documents with only few pages.

@JMarcosHP
Copy link
Author

JMarcosHP commented May 14, 2025

More generally, if the AcroForm doesn't contain some fields, when we meet an annotation with some js actions then we could collect all the form annotations in the document, that would require to get all the pages to look for all their annotations, and then trigger a sandbox creation.
We need to get all the pages because an annotation on page 1 could modify an other one on page 1234.
Fortunately, most of the time form fields are in documents with only few pages.

In this case the document only has one page. And just that fillable column has the Javascript code to count the total.

How can I help to fix this?

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

3 participants