Closed totalism53 closed 1 year ago
@totalism53 I'm getting this same issue. But only for one document. Other documents work fine
Some features of PDF > 1.3 such as streams and linearization are not supported. Your signed document uses those.
https://github.com/vbuch/node-signpdf/issues?q=+label%3A%22PDF+%3E+1.3%22
@vbuch Yes this is a PDF version 1.4 document. The code i've written the PDF is generated by using a chrome headless print to pdf, so i have only THIS document not working, but all the other 1000+ documents have worked.
I'm quite confused as to why it's only the one document.
trailer
<</Size 206
/Root 29 0 R
/Info 1 0 R>>
startxref
137505
%%EOF
I don;t know what else to try to debug it. i'm on 1.5.0
It just can't seem to determine the position to add the signature when calling plainAddPlaceholder
This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions.
Just for other people's awareness. I was using version 1.3.3. I had the word "trailer" in the content i was adding. And it caused the error. What a mission to figure that out.
Describe the bug and the expected behaviour I tried to sign the document after the document signed on Adobe Acrobat but I found that after using node-signpdf there is an error which is "SignPdfError: Expected xref at NaN but found other content." but if I use this lib as the starter, it can be sign twice or more without any error.
Is it a bug in signing or in the helpers? I guess it might be in signing.
To Reproduce Here is the code and file that I used.
import { SignPdf } from 'node-signpdf'; import fs from 'fs'; import { Buffer } from 'buffer'; import { plainAddPlaceholder } from 'node-signpdf/dist/helpers/index.js';
const pathSignedPdf = 'resource/pdf_a_signed_signed.pdf' const p12Buffer = fs.readFileSync('resource/certificate.p12'); const pdfBuffer = fs.readFileSync('resource/pdf_a_signed.pdf'); const pdfBufferToSign = plainAddPlaceholder({ pdfBuffer, reason: 'twice', signatureLength: p12Buffer.length }); const signer = new SignPdf() const signedPdf = signer.sign(pdfBufferToSign, p12Buffer); console.log(signedPdf)
const bufferPdf = Buffer.from(signedPdf) fs.createWriteStream(pathSignedPdf).write(bufferPdf);
Here is the log from console.log(prefix.toString().replace(/\s*/g, '')) in readRefTable.js
Is there any suggestion or example?
Thank you for your help.
the original file signed by acrobat signed twice with node-signpdf