Developer Tools
|
Office Productivity Applications
|
Platform-Agnostic APIs
|
Home | Online Demos | Downloads | Buy Now | Support | About Us | News | Working Together | Contact Us
In September 2009, we introduced the ability to digitally sign PDF documents in PDFtoolkit.
In a PDF document, digital signatures are represented as signature form fields. Signature form fields can be either visible or invisible. Visible signature fields are usually accompanied by the scanned image of a signature of a real person and/or the seal of an organization.
When the requirement is simply to sign a PDF document, then a hidden signature field would be enough. A viewer application such as Adobe Reader would still be able to identify and validate the signature in the document. In this article, we will see a code example on how to create such a document.
The method to add a signature is TgtPDFDocument.AddSignature()
.
It has several overloads for this method. In the following code
example, the overload requires:
PFXFileName: AnsiString
- Pathname of the PFX file
containing the digital certificate. You will get this file from
a Certification Authority (CA).PFXPassword: AnsiString
- Password for the PFX
file.Reason: AnsiString
Text that needs to be
identified as the "reason" for adding the digital signature. For
example, you can specify it as "I agree." Location: AnsiString
- Text that needs to be
identified as the "location" where the digital signature was
added to the document. For example, you can use the CPU host
name or the physical address where the signature was added.ContactInfo: AnsiString
- Text that needs
to be identified as the "contact information" of the owner of
the digital signature. This information can be useful for
the recipient of the document to contact the owner of the
signature.PageNumber: Integer
- Number of the page
where the digital signature is added.FieldName: AnsiString
- Name for the
signature form field representing the digital signature. If a
name is not specified, the PDF document component will generate
a name for it. program TgtPDFDocument_AddSignature_Hidden; {$APPTYPE CONSOLE} uses SysUtils, gtPDFDoc, gtExPDFDoc; var gtPDFDocument1: TgtPDFDocument; begin // Create a document object gtPDFDocument1 := TgtPDFDocument.Create(Nil); try begin // Load input document gtPDFDocument1.LoadFromFile('to_be_signed_doc.pdf'); Writeln('Document opened.'); // Add a hidden signature field to a page gtPDFDocument1.AddSignature( 'F:\Downloads\subhash@gnostice.com-2010-03-04', '-- snipped --', 'To demonstrate digital signing', 'Bangalore', '+91.80.41.726.529', 5, 'fld_sig1'); Writeln('Document signed.'); gtPDFDocument1.SaveToFile('signed_doc.pdf'); Writeln('Document saved.'); end except on Err:Exception do begin Writeln('Sorry, an exception was raised. '); Writeln(Err.Classname + ':' + Err.Message); end; end; // Free resources gtPDFDocument1.Reset; // Destroy document object FreeAndNil(gtPDFDocument1); Writeln('Press Enter to exit.'); Readln; end.
---o0O0o---
Our .NET Developer Tools | |
---|---|
Gnostice Document Studio .NETMulti-format document-processing component suite for .NET developers. |
PDFOne .NETA .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications. |
Our Delphi/C++Builder developer tools | |
---|---|
Gnostice Document Studio DelphiMulti-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms. |
eDocEngine VCLA Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools. |
PDFtoolkit VCLA Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents. |
Our Java developer tools | |
---|---|
Gnostice Document Studio JavaMulti-format document-processing component suite for Java developers. |
PDFOne (for Java)A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications. |
Our Platform-Agnostic Cloud and On-Premises APIs | |
---|---|
StarDocsCloud-hosted and On-Premises REST-based document-processing and document-viewing APIs |
Privacy | Legal | Feedback | Newsletter | Blog | Resellers | © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved. |