Digitally Sign PDF Files

I have a digital certificate that identifies the user. I need to use it to digitally sign PDF files.

Does anyone have an example that doesn't use a third-party component? I need to do this, but it would be nice to fully understand how this is done.

C # examples, please :)

+48
c # pdf digital-signature
Dec 18 '08 at 15:46
source share
4 answers

The iTextSharp open source library will let you do this. Here's a post explaining how to sign a PDF file digitally. If you do not want to use a third-party library, then you can implement it yourself, but it can be a difficult task → you can start by reading the pdf specification (8.6MB)

+36
Dec 18 '08 at 19:58
source share

Signing a PDF properly is a very difficult task. There are several files that do not meet the PDF specification (broken xrefs, etc.), and your code should handle all of them. Then, different versions of Acrobat handle certain things in signed fields differently. Therefore, if you need to complete a task (and not learn how it works), you must rely on a third-party solution, for example, our PDFBlackbox .

+10
Dec 20 '08 at 10:37
source share

Digitally signing a PDF document without using a third-party component does a lot of work and is usually best avoided.

The components do all the hard work for you, so you don't need to. You must find great free PDF components that will suit your needs.

The following example, written in C #, shows how easy it is to digitally sign a PDF using ABCpdf:

Doc theDoc = new Doc(); theDoc.Read(Server.MapPath("../Rez/Authorization.pdf")); Signature theSig = (Signature)theDoc.Form["Signature"]; theSig.Location = "Washington"; theSig.Reason = "Schedule Agreed"; theSig.Sign(Server.MapPath("../Rez/JohnSmith.pfx"), "111111"); theDoc.Save(Server.MapPath("Signed.pdf")); 

Source: ABCpdf Documentation - Sign Method

+5
May 6 '10 at 5:33
source share

Lost my first answer. May want to give DocQ a try link text . They have their own certificate and they can do it for you free / cheap to print and encrypt PDF files. They also have an API that you can use.

+1
May 10 '10 at 20:37
source share



All Articles