SetaPDF_Signer_Signature_Appearance_Dynamic Class representing a dynamic visible signature appearance

File: /SetaPDF v2/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

$_font

A font that is used for rendering text.


Methods

__construct()

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()

Draw the background logo of the signature appearance.

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_drawGraphic()

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

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_drawText()

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 : string
 
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 

_getN2XObject()

_prepareText()

Prepares the text string.

Parameters
$signer : SetaPDF_Signer
 

cleanUp()

Release memory/cycled references.

createAppearance()

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

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

getBackgroundLogo()

Get the current background logo.

getBackgroundLogoOpacity()

Get the background logo opacity.

getCertificateInfo()

Returns information about the supplied certificate.

Exceptions

Throws SetaPDF_Signer_Exception

getConfig()

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

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.

getFont()

Get the font that should be used for displaying text.

getGraphic()

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

getShow()

public SetaPDF_Signer_Signature_Appearance_Dynamic::getShow (
string $name
): boolean

Get whether a text part will be shown or not.

Parameters
$name : string
 
See

getShowFormat()

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

Get the format for a specific value.

Parameters
$name : string
 
See

getShowTpl()

Get a defined template for a specific text part.

Parameters
$name : string
 
See

getTextAlign()

Get the text align.

setBackgroundLogo()

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

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()

Set the background logo opacity.

Parameters
$opacity : float

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

setConfig()

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.

setFont()

Set the font that should be used for displaying text.

Parameters
$font : SetaPDF_Core_Font|null
 

setGraphic()

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 SetaPDF_Signer_Signature_Appearance_Dynamic::setShow (
string $name [, boolean $show = true ]
): $this|bool

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 SetaPDF_Signer_Signature_Appearance_Dynamic::setShowFormat (
string $name, string $format
): $this|bool

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 SetaPDF_Signer_Signature_Appearance_Dynamic::setShowTpl (
string $name, string $tpl
): $this|bool

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 SetaPDF_Signer_Signature_Appearance_Dynamic::setTextAlign (
string $textAlign
): $this

Set the text align.

Parameters
$textAlign : string
 
See