Migrating
Table of Contents
From Version 2.0 to 2.1
What has changed
In version 2.1 a timestamp signature feature was implemented which results in separating the appearance classes from the main signature modules. This change ends in a backward incompatible change.
Backward Incompatible Changes
In version 2.0 the SetaPDF_Signer_Signature_Appearance_AbstractAppearance
class implements the SetaPDF_Signer_Signature_Module_ModuleInterface
interface to allow chaining of appearance and signature modules. Since version 2.1 the appearance classes are decoupled from the signature modules and need to be passed separately to the signer instance.
Furthermore the constructor arguments have changed in the SetaPDF_Signer_Signature_Appearance_XObject
class.
Dynamic Appearance
Refactoring code that uses the dynamic appearance class has to be done as follows:
// create an OpenSSL module instance $module = new \SetaPDF_Signer_Signature_Module_OpenSsl(); ... // create a Signature appearance $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_Dynamic($module); ... // sign the document with the appearance $signer->sign($visibleAppearance);
becomes:
// create an OpenSSL module instance $module = new \SetaPDF_Signer_Signature_Module_OpenSsl(); ... // create a Signature appearance $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_Dynamic($module); // Attach the visible appearance to the signer instance $signer->setAppearance($visibleAppearance); // NEW ... // sign the document with the appearance $signer->sign($module); // PASS THE SIGNATURE MODULE INSTEAD OF THE APPEARANCE
XObject Appearance
Refactoring code that uses the XObject appearance class has to be done as follows:
// create an OpenSSL module instance $module = new \SetaPDF_Signer_Signature_Module_OpenSsl(); ... // create a static visible appearance from the xObject $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_XObject($module, $xObject); ... // sign the document with the appearance $signer->sign($visibleAppearance);
becomes:
// create an OpenSSL module instance $module = new \SetaPDF_Signer_Signature_Module_OpenSsl(); ... // create a static visible appearance from the xObject $visibleAppearance = new \SetaPDF_Signer_Signature_Appearance_XObject($module, $xObject); // Attach the visible appearance to the signer instance $signer->setAppearance($visibleAppearance); // NEW ... // sign the document with the appearance $signer->sign($module); // PASS THE SIGNATURE MODULE INSTEAD OF THE APPEARANCE