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_GRAPHIC_ALIGN

CONFIG_GRAPHIC_ALIGN_LEFT

CONFIG_GRAPHIC_ALIGN_RIGHT

CONFIG_GRAPHIC_COLOR

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

CONFIG_TEXT_COLOR


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 or a certificate argument to the constructor. The data for the appearance will be extracted automatically.

Parameters
$moduleOrCertificate : SetaPDF_Signer_Signature_Module_ModuleInterface|SetaPDF_Signer_X509_Certificate|string
 
Exceptions

Throws InvalidArgumentException

Throws SetaPDF_Signer_Asn1_Exception

_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 or right side of the signature appearance.

Parameters
$xObject : SetaPDF_Core_XObject_Form
 
$document : SetaPDF_Core_Document
 
$signer : SetaPDF_Signer
 
Exceptions

Throws SetaPDF_Core_Type_Exception

Throws SetaPDF_Signer_Exception

_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
 
Exceptions

Throws SetaPDF_Core_Type_Exception

_prepareText()

Prepares the text string.

Parameters
$signer : SetaPDF_Signer
 
Exceptions

Throws SetaPDF_Signer_Exception

Throws Exception

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 is displayed.

getGraphicAlign()

Get whether the graphic should be displayed on the left or right.

getGraphicColor()

Get the graphic text color.

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.

getTextColor()

Get the text color.

setBackgroundLogo()

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_FontInterface|null
 

setGraphic()

Set how and if a graphic is displayed on 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

setGraphicAlign()

Set whether the graphic should be displayed on the left or right.

Parameters
$align : string

A self::CONFIG_GRAPHIC_ALIGN_* constant.

See
  • self::CONFIG_GRAPHIC_ALIGN_RIGHT
  • self::CONFIG_GRAPHIC_ALIGN_LEFT

setGraphicColor()

public SetaPDF_Signer_Signature_Appearance_Dynamic::setGraphicColor (
string $graphicColor
): $this

Set the graphic text color.

Parameters
$graphicColor : string
 

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:

Parameters
$name : string
 
$tpl : string
 

setTextAlign()

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

Set the text align.

Parameters
$textAlign : string
 
See

setTextColor()

public SetaPDF_Signer_Signature_Appearance_Dynamic::setTextColor (
string $textColor
): $this

Set the text color.

Parameters
$textColor : string