- Getting Started
- The Main Class
- Create a Signature Field
- Signature Appearance Modules
- Signature Modules
- Timestamp Modules
- Asynchronous Signature Workflow
- Sign Several Times
- Signing PDF Forms
- Trust Settings
- API Reference
Signature Appearance Modules
Table of Contents
A digital signature in a PDF document can be created with an invisible or visible signature field.
The SetaPDF-Signer component comes with simple modules that may create the signature appearance for a visible signature field for you or allow you to define your own appearance.
In version 2.0 an appearance module was a proxy module for a signature module and also implements the
Since version 2.1 the modules are separated and a refactor is needed!
The SetaPDF-Signer comes with an appearance module that will create a signature appearance simliar to the appearance that can be created with e.g. Acrobat.
The module allows you to define a background, a graphic and it will automatically extract information from the signature certificate. Its simplest output will look like:
The graphic is the text or graphic that should be displayed in the left row of the appearance. A boolean value defines if the graphic will be shown or not. If you pass an XObject to its setter method the XObject will be displayed:
The right column displays data that was extracted from the certificate that was passed to the signature module. The configuration of this text pieces can be controlled by the
setShowTpl() methods. Their names are represented via class constants (CONFIG_XXX).
By default the appearance class uses the standard font
SetaPDF_Core_Font_Standard_Helvetica. It is also possible to use an embedded TrueType subset font which allows you to use characters which are not available in the standard encoding (
WinAnsi) used by
Following example shows how to format the labels, hide a value and format the date value individually while using a TrueType font:
SetaPDF_Signer_Signature_Appearance_XObject representing a signature appearance based on an existing XObject.
To create an appearance of an existing image, you just have to pass the image instance to the constructor of the module:
... // load the image $image = SetaPDF_Core_Image::getByPath('files/pdfs/tektown/Logo.png'); // get an XObject instance of it $xObject = $image->toXObject($document); // pass it to the appearance modules constructor $appearance = new SetaPDF_Signer_Signature_Appearance_XObject($xObject); // pass the appearance $signer->setAppearance($appearance); // pass the module to the sign method $signer->sign($module);
An XObject can also be created from a page of an existing document:
... // load a document $appDocument = SetaPDF_Core_Document::loadByFilename('files/pdfs/handwritten-signature.pdf'); $pageXObject = $appDocument ->getCatalog() ->getPages() ->getPage(1)->toXObject($document, SetaPDF_Core_PageBoundaries::ART_BOX); // create a static visible appearance from the xObject $appearance = new SetaPDF_Signer_Signature_Appearance_XObject($pageXObject); // pass the appearance $signer->setAppearance($appearance); // pass the module to the sign method $signer->sign($module);
At the end it is also possible to create an XObject instance manually and create the appearance by its Canvas instance.
The SetaPDF-Signer component does not support multiple appearances of a single signature field.
A simple quote from the Digital Signature Appearances specifications of Adobe will confirm this limitation:
The location of a signature within a document can have a bearing on its legal meaning. For this reason, signature fields never refer to more than one annotation. If more than one location is associated with a signature, the meaning may become ambiguous.[...]