-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Can't add multiple signature appearance at once. #47
Comments
Feel free to make a PR adding that feature |
Sorry, I don't understand the meaning of PR |
Hi, $file_content = file_get_contents($argv[1]);
$obj = PDFDoc::from_string($file_content);
$obj->set_signature_certificate("path_to_certfile1", $password1)
$docsigned = $obj->to_pdf_file_s();
$obj2 = PDFDoc::from_string($doc_signed);
$obj2->set_signature_certificate("path_to_certfile2", $password2)
$docsigned2 = $obj2->to_pdf_file_s();
echo $docsigned2 |
I'm sorry, but I think I did not read the question properly... The PDF document cannot add multiple signature appearances for one single digital signature. It is possible to embed a whole object, but this library does not support it. The idea is to add a more complex signature (e.g. add some text), but it is not possible at this time, because the library has no support for creating text. This is one of the future works, but it is not a priority, now. |
Hi, Actually the library is already doing the work. I managed to modify the code to make |
Reading the method |
Hi, well, you do not need to save the document. As in the example I gave you in a previous comment, you can use The reason why I separated the creation of a signature from the eventual next one is to make sure that the user of the library understands the concept of signing a PDF document: when you sign a document using one certificate, you are making a photo of that document saying "I certify that this document has exactly this content". If you add a new signature, It would mean something like "I certify that this document has exactly this content and a certificate". That needs two steps: one certificate and the other. (*) giving an appearance like an image or a text is an extended feature that offers the digital signature. I think that your reasoning is about having a so-called function like |
Hi, I added the function $certificates = [ ... ]
foreach ($certificates as $certificate) {
$document = $document->sign_document($certificate);
}
echo $document->to_pdf_file_s(); Please, check if that solver your problem. |
Hi @dealfonso, Thanks for your reply. I already had a function like So, what I want is to add multiple signatures without altering the PDF first signatures to just say "We certify that this document has exactly this content". Look at this PDF, I modified the code to add the first certificate and let the second one as a placeholder by calling just As you can see in the image, From Acrobat I selected the second certificate to fill the empty one, Acrobat allow me to save a new PDF and the magic is that the first certificate is still valid like if the document have never been modified. This is what I need to do from coding. I understand this is not a priority for you, but, I really need this feature. If you could explain what does your code from line |
Hi, |
Hi @dealfonso, Could you solve the problem please? |
Hi, Sorry but no. Moreover, I found that it depends on the original document. I found that documents coming from Windows are prone to this problem. |
PR means Pull Request, you can make a debug to find the problem, then you make a PR with the fix here |
Hi, It would be great if I can add multiple signature appearance at once.
The problem is, if I add a signature, save the pdf and add another one, The pdf signature is now invalid because after signing, modification is not allowed. That's the whole point of signing a document with a digital signature.
The text was updated successfully, but these errors were encountered: