-
-
Notifications
You must be signed in to change notification settings - Fork 615
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
How to create multiple signature annotations. #278
Comments
Hello @therpobinski! If I understand correctly, you are asking how to add a new widget/annotation reference to an existing document's const pdfDoc = await PDFDocument.load(...)
const annotationRef: PDFRef = ...
const acroForm = pdfDoc.catalog.lookupMaybe(PDFName.of('AcroForm'), PDFDict);
if (acroForm) {
const fields = acroForm.lookup(PDFName.of('Fields'), PDFArray);
fields.push(annotationRef)
} Please also note that I've provided an updated version of my signature example for the latest version of I hope this helps. Please let me know if you have any additional questions! |
Hi, sorry to bother you again! |
I have been able to solve the problem, I do not know if I am using it wrong or something, but when I sign for the first time everything is correct, but I do it for the second time, when placing my |
@therpobinski The reason this happens is that the digest of the file stored in your first signature is invalidated when you add the second one. This happens because This should make intuitive sense. If you modify a file, the signature should be invalidated. After all, signatures are supposed to prove that a file has not been tampered with. So on the one hand, you can view this result as an indication that the digital signature process is working correctly. However, as I'm sure you've observed before, there are plenty of PDFs out there with multiple signatures. And Acrobat allows you to add signatures to files, even after modifying them. This is possible thanks to a feature of PDFs called "Incremental Updates", documented in section 7.5.6 Incremental Updates of the PDF specification:
In Acrobat, when modifications are made to a signed document (including addition of a new signature), the changes necessary to arrive at the new state of the document are simply appended to the end of the file. This makes it possible to retrieve an earlier version of the document when a given signature was applied. Unfortunately, as of today, |
hi, is now posible make incremental updates with pdf-lib? or have any idea how i can doi it? Thanks. |
hi, is now posible make incremental updates with pdf-lib? or have any idea how i can doi it? thanks |
i dont know, i solve my problem with the library endesive in python, is easy to use |
hi,bro ,this https://github.com/vbuch/node-signpdf can do it |
@Hopding @aallvi @taotaow2n @vbuch is it possible now to do incremental update with the pdb-lib? or are there any better alternatives to do a digital signature on a pdf already having digital signature ? |
@ShahMeet3001 I think pdf-lib doesn't have incremental updates yet. @signpdf/placeholder-plain can do the job in simple scenarios so it's worth checking. Once pdf-lib has the support, placeholder-plain will become obsolete. |
i dont know if you can do incremental update with pdf-lib, in my app I do this part with python with the library endesive |
Hi, I followed this guide-issue to create a
placeholder
, to sign a document.Since this guide was made by @Hopding with old code, I was able to attach a new
pdf-lib
code, I am glad that I was able to solve the goal of creating aplaceholder
with this largepdf-lib
library.Now I have a doubt, when I sign several times it is necessary that
AcroForm
and/Type/Dict
be updated with the new references of the annotations. How can I update this? I hope you have understood me and can give me an idea to solve the problem.This is code, from line 180 I create the
AcroForm
.The text was updated successfully, but these errors were encountered: