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

Problems with PDFs > v1.3 #16

Closed
NoahCardoza opened this issue Oct 18, 2020 · 5 comments
Closed

Problems with PDFs > v1.3 #16

NoahCardoza opened this issue Oct 18, 2020 · 5 comments

Comments

@NoahCardoza
Copy link

NoahCardoza commented Oct 18, 2020

It seems that this lib has problems working with fillable PDFs:

(node:24914) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at getXref (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/read-pdf.js:84:34)
    at getFullXrefTable (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/read-pdf.js:63:25)
    at readRefTable (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/read-pdf.js:45:25)
    at Object.readPdf [as default] (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/read-pdf.js:23:20)
    at /Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/plain-add-placeholder.js:61:46
    at step (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/plain-add-placeholder.js:33:23)
    at Object.next (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/plain-add-placeholder.js:14:53)
    at /Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/plain-add-placeholder.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/vulcan/tmp/ns/node_modules/pdf-signer/dist/pdf/node-signpdf/plain-add-placeholder.js:4:12)

From the stack it seems that it's a problem with node-signpdf, so I'll also open an issue there. If you have any insight as to what might be causing this I'd be happy to try and work on a fix.

@NoahCardoza
Copy link
Author

I just created an example repo so you can easily see what I'm working with!

@NoahCardoza
Copy link
Author

After further research, while it does seem to be a problem with the lib not being able to read newer PDFs, I found a simple work around for the time being:

pdftk input.pdf output output.pdf

Is able add the proper trailer to the end of the PDF. In my case the PDF was also protected, so I used:

qpdf --decrypt encrypted.pdf unencrypted.pdf
pdftk unencrypted.pdf output output.pdf

Note: This was able to preserve the form fields!

I hope this helps someone else and saves them the 3 days it took me!

@NoahCardoza NoahCardoza changed the title Problems with fillable PDFs? Problems with PDFs > v1.3? Oct 18, 2020
@NoahCardoza NoahCardoza changed the title Problems with PDFs > v1.3? Problems with PDFs > v1.3 Oct 18, 2020
@saargospa
Copy link

saargospa commented Jul 3, 2021

Is this fixed in any branch ? Actually master doesn't work on PDF > v1.3 , it brokes on 1.7 for example

@pankucsi
Copy link
Collaborator

pankucsi commented Jul 3, 2021

No it is not fixed and it is not a bug. Unfortunately we are not compatible with the new pdf version. You can solve this if you are downgrade the PDF's version.

You can read more about the problem in this issue if you are interested in it: https://github.com/vizicsaba89/pdf-signer/issues/17

@dabi07ravi
Copy link

how to show the green tick validation through this library

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

No branches or pull requests

4 participants