Modify signed PDF without compromising the signature

Discussions about PDF management.
Post Reply
nenea
Posts: 2
Joined: Mon Jan 02, 2017 12:46 pm

Modify signed PDF without compromising the signature

Post by nenea » Mon Jan 02, 2017 1:03 pm

Hi all,
I'm trying to edit a signed PDF without compromising the signature.

In Adobe Acrobat Reader I'm able to insert a note in the signed PDF without compromising the signature (Acrobat Reader gives a warning reporting that the note has been inserted after the signature).

I tried to modify the PDF using GDPicture (code below), but Acrobat Reader reports an error in the signature after doing that.

Is there a way to add annotation to the signed PDF as Acrobat Reader does ?

Code: Select all

GdPicturePDF oGdPicturePDF = new GdPicturePDF();
oGdPicturePDF.LoadFromFile(myFile, true);
oGdPicturePDF.SelectPage(1);
string font_res_name = oGdPicturePDF.AddTrueTypeFont("Arial", false, false, false);
oGdPicturePDF.SetTextMode(PdfTextMode.PdfTextModeFill);
oGdPicturePDF.SetTextSize(30);
oGdPicturePDF.SetFillColor(255, 0, 0, 0); 
oGdPicturePDF.SetOrigin(PdfOrigin.PdfOriginBottomRight);
oGdPicturePDF.SetMeasurementUnit(PdfMeasurementUnit.PdfMeasurementUnitCentimeter);
oGdPicturePDF.DrawText(font_res_name, 1, 1, "Hello World!");
oGdPicturePDF.SaveToFile(_fileSelezionato.ToUpper().Replace(".PDF", "_modified.PDF"));
oGdPicturePDF.CloseDocument();

delbeke
Posts: 91
Joined: Wed Oct 31, 2012 5:07 pm

Re: Modify signed PDF without compromising the signature

Post by delbeke » Tue Jan 03, 2017 11:54 am

Hi Nenea

First of all, happy new year.

You can modify a signed pdf as far you save the modifications with an incremental save method.
see : http://guides.gdpicture.com/content/web ... leInc.html

The modifications are added at the end of the file, letting the old signatures unchanged.

Hope these help.

Best regards
Jean-Luc

nenea
Posts: 2
Joined: Mon Jan 02, 2017 12:46 pm

Re: Modify signed PDF without compromising the signature

Post by nenea » Thu Jan 05, 2017 3:26 pm

Hi Jean-Luc, happy new year!

Using the SaveToFileInc method could be ok, but if I open the resulting file with Acrobat Reader, I receive an error, even if I can recover the properly signed version of the file.

Is there a method to add an annotation to the PDF file?

Regards,
Nazareno

delbeke
Posts: 91
Joined: Wed Oct 31, 2012 5:07 pm

Re: Modify signed PDF without compromising the signature

Post by delbeke » Fri Jan 06, 2017 11:17 am

Hi,

If you want to modify a signed pdf, the first signature must be a certification signature (it contains a DocMDP entry).

see : http://www.adobe.com/devnet-docs/acroba ... in_PDF.pdf
chapter 6.3.11

A document can contain only one signature field that contains a DocMDP transform method, and it must be the first signed field in the document. That signature is called a “certification” signature. This feature enables the author to specify what changes are permitted and what changes invalidate the author’s signature. However, most users will perceive the effect of DocMDP as specifying what they can do to a document.

As far you are not the first signer of the pdf, you can not do better.

Hope this help.
Best regards.
Jean-Luc.

User avatar
avalon86
Posts: 6
Joined: Tue May 08, 2018 12:50 pm

Re: Modify signed PDF without compromising the signature

Post by avalon86 » Tue May 08, 2018 1:37 pm

What can I say, that's the key point of Acrobat. I tried to combine that with GDP as well, but I barely could count all the times it let me down. No I'm done with Adobe's thing for good, but you may consider to try to keep modifying your files and to fix the signature issue then? Yes, quite a solution, but either way, it's better than nothing. Or you should try some other tool instead of Acrobat XI, actually me using this one: https://edit-pdf.pdffiller.com/ It allows to do all the required edits with pdf's, such as to replace fonts, add watermark or signatures, obviously. Furthermore, this one is free and works as web application fine, so all you need here is up-to-dated browser version. Haven't tried to compare it with gdpicture yet, but don't think of it as anything challenging

delbeke
Posts: 91
Joined: Wed Oct 31, 2012 5:07 pm

Re: Modify signed PDF without compromising the signature

Post by delbeke » Thu May 10, 2018 8:27 am

Hi avalon86
The minimum to change a signed pdf without invalidating the signature, is to use an incremental save.
use the SaveToFileInc function for example
see : http://guides.gdpicture.com/content/web ... leInc.html

Hope this help
Jean-Luc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests