SetaPDF_Signer_Signature_Appearance_Dynamic Class representing a dynamic visible signature appearance

File: /SetaPDF/Signer/Signature/Appearance/Dynamic.php

This signature appearance allows you to define a background image or xobject and a logo. The appearance will also display certificate details extracted from the used certificate and some signature properties like location.

Class hierarchy

Summary

Constants

CONFIG_BACKGROUND_LOGO

CONFIG_BACKGROUND_LOGO_OPACITY

CONFIG_DATE

CONFIG_DISTINGUISHED_NAME

CONFIG_GRAPHIC

CONFIG_LABELS

CONFIG_LOCATION

CONFIG_NAME

CONFIG_REASON

CONFIG_SHOW_DATE

CONFIG_SHOW_DATE_FORMAT

CONFIG_SHOW_DATE_TPL

CONFIG_SHOW_DISTINGUISHED_NAME

CONFIG_SHOW_DISTINGUISHED_NAME_TPL

CONFIG_SHOW_LABELS

CONFIG_SHOW_LOCATION

CONFIG_SHOW_LOCATION_TPL

CONFIG_SHOW_NAME

CONFIG_SHOW_NAME_TPL

CONFIG_SHOW_REASON

CONFIG_SHOW_REASON_TPL

CONFIG_TEXT_ALIGN


Properties

$_certificateInfo

The certificate info returned from openssl_x509_parse()

$_config

The configuration array


Methods

__construct()

public SetaPDF_Signer_Signature_Appearance_Dynamic::__construct ( SetaPDF_Signer_Signature_Module_ModuleInterface $module )

The constructor.

Just pass a signature module that offers a getCertificate() method to the constructor. The data for the appearance will be extracted automatically.

Parameters
$module : SetaPDF_Signer_Signature_Module_ModuleInterface
 
Exceptions

Throws InvalidArgumentException

_drawBackground()

protected void SetaPDF_Signer_Signature_Appearance_Dynamic::_drawBackground ( SetaPDF_Core_XObject_Form $xObject, SetaPDF_Core_Document $document )

Draw the background logo of the signature appearance.

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_drawGraphic()

protected void SetaPDF_Signer_Signature_Appearance_Dynamic::_drawGraphic ( SetaPDF_Core_XObject_Form $xObject, SetaPDF_Core_Document $document )

Draws the graphic on the left side of the signature appearance.

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_drawText()

protected void SetaPDF_Signer_Signature_Appearance_Dynamic::_drawText ( array $text, SetaPDF_Core_XObject_Form $xObject, SetaPDF_Core_Document $document )

Draws the text on the appearance.

If no graphic is set the text will be placed on the full width of the appearance.

Parameters
$text : array
 
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_getN2XObject()

protected SetaPDF_Core_XObject_Form SetaPDF_Signer_Signature_Appearance_Dynamic::_getN2XObject ( SetaPDF_Signer_SignatureField $field, SetaPDF_Core_Document $document, SetaPDF_Signer $signer )

Creates the "n2" layer appearance.

Parameters
$field : SetaPDF_Signer_SignatureField
 
$document : SetaPDF_Core_Document
 
$signer : SetaPDF_Signer
 

_prepareText()

protected array SetaPDF_Signer_Signature_Appearance_Dynamic::_prepareText ( SetaPDF_Signer $signer )

Prepares the text string.

Parameters
$signer : SetaPDF_Signer
 

cleanUp()

public void SetaPDF_Signer_Signature_Appearance_Dynamic::cleanUp ( void )

Release memory/cycled references.

createAppearance()

public void SetaPDF_Signer_Signature_Appearance_AbstractAppearance::createAppearance ( SetaPDF_Signer_SignatureField $field, SetaPDF_Core_Document $document, SetaPDF_Signer $signer )

Creates the XObject structure and "layers" (n0 + n2).

Parameters
$field : SetaPDF_Signer_SignatureField
 
$document : SetaPDF_Core_Document
 
$signer : SetaPDF_Signer
 

getBackgroundLogo()

public mixed SetaPDF_Signer_Signature_Appearance_Dynamic::getBackgroundLogo ( void )

Get the current background logo.

getBackgroundLogoOpacity()

public float SetaPDF_Signer_Signature_Appearance_Dynamic::getBackgroundLogoOpacity ( void )

Get the background logo opacity.

getCertificateInfo()

public array|null SetaPDF_Signer_Signature_Appearance_Dynamic::getCertificateInfo ( void )

Returns information about the supplied certificate.

Exceptions

Throws SetaPDF_Signer_Exception

getConfig()

public bool|mixed SetaPDF_Signer_Signature_Appearance_Dynamic::getConfig ( string $key )

Get a specific configuration value.

Parameters
$key : string

The key of the config. See and use SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_XXX for a valid key.

Return Values

Returns false if the key is invalid.

getGraphic()

public mixed SetaPDF_Signer_Signature_Appearance_Dynamic::getGraphic ( void )

Get if and how the graphic on the left side is displayed.

getShow()

public boolean SetaPDF_Signer_Signature_Appearance_Dynamic::getShow ( string $name )

Get whether a text part will be shown or not.

Parameters
$name : string
 
See

getShowFormat()

public bool|mixed SetaPDF_Signer_Signature_Appearance_Dynamic::getShowFormat ( string $name )

Get the format for a specific value.

Parameters
$name : string
 
See

getShowTpl()

public string SetaPDF_Signer_Signature_Appearance_Dynamic::getShowTpl ( string $name )

Get a defined template for a specific text part.

Parameters
$name : string
 
See

getTextAlign()

public string SetaPDF_Signer_Signature_Appearance_Dynamic::getTextAlign ( void )

Get the text align.

setBackgroundLogo()

public $this|bool SetaPDF_Signer_Signature_Appearance_Dynamic::setBackgroundLogo ( [ SetaPDF_Core_XObject $xObject = null [, float $opacity = 1.0 ]] )

Set a background logo and its opacity.

The background logo is displayed in the center of the appearance.

Parameters
$xObject : SetaPDF_Core_XObject
 
$opacity : float
 

setBackgroundLogoOpacity()

public $this SetaPDF_Signer_Signature_Appearance_Dynamic::setBackgroundLogoOpacity ( float $opacity )

Set the background logo opacity.

Parameters
$opacity : float

A value between 0 (not visible) an 1 (full opacity)

setConfig()

public boolean|SetaPDF_Signer_Signature_Appearance_Dynamic SetaPDF_Signer_Signature_Appearance_Dynamic::setConfig ( string $key, mixed $value )

Set a specific configuration value.

Parameters
$key : string

The key of the config. See and use SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_XXX for a valid key.

$value : mixed
 
Return Values

Returns false if the key is invalid.

setGraphic()

public $this SetaPDF_Signer_Signature_Appearance_Dynamic::setGraphic ( SetaPDF_Core_XObject|boolean $graphic )

Set how and if a graphic is displayed on the left side of the appearance.

If a XObject is passed it will be used as the graphic, if true is passed the common name of the certificate will be used. If false is passed no graphic will be shown.

Parameters
$graphic : SetaPDF_Core_XObject|boolean

A XObject or a boolean value

setShow()

public $this|bool SetaPDF_Signer_Signature_Appearance_Dynamic::setShow ( string $name [, boolean $show = true ] )

Defines whether a text part will be shown or not.

Available names are: - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_NAME - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_REASON - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DATE - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_LABELS - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DISTINGUISHED_NAME - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_LOCATION

Parameters
$name : string
 
$show : boolean
 

setShowFormat()

public $this|bool SetaPDF_Signer_Signature_Appearance_Dynamic::setShowFormat ( string $name, string $format )

Sets a format for a specific value.

Currently only the $name SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DATE is supported.

Parameters
$name : string
 
$format : string
 

setShowTpl()

public $this|bool SetaPDF_Signer_Signature_Appearance_Dynamic::setShowTpl ( string $name, string $tpl )

Defines a template for a specific text.

The template will be used as a label of a specific value. The value is passed via sprintf() to this template.

Following names are possible: - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_NAME - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_REASON - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DATE - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_DISTINGUISHED_NAME - SetaPDF_Signer_Signature_Appearance_Dynamic::CONFIG_LOCATION

Parameters
$name : string
 
$tpl : string
 

setTextAlign()

public $this SetaPDF_Signer_Signature_Appearance_Dynamic::setTextAlign ( string $textAlign )

Set the text align.

Parameters
$textAlign : string
 
See