Class PdfSignaturePagePreferences

java.lang.Object
se.idsec.signservice.integration.document.pdf.PdfSignaturePagePreferences
All Implemented Interfaces:
Serializable, Extensible

public class PdfSignaturePagePreferences extends Object implements Extensible
Representation of preferences for adding or modifying a PdfSignaturePage. See ExtendedSignServiceIntegrationService.preparePdfSignaturePage(String, byte[], PdfSignaturePagePreferences).

Note: If ExtendedSignServiceIntegrationService.preparePdfSignaturePage(String, byte[], PdfSignaturePagePreferences) is called several times for the same document, i.e., when the document is signed more than once, the values for signaturePageReference/signaturePage and insertPageAt must be equal to those values used in the first invocation.

Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
See Also:
  • Constructor Details

  • Method Details

    • getExtension

      public Extension getExtension()
      Returns the extension parameters for the instance.
      Specified by:
      getExtension in interface Extensible
      Returns:
      the extension, or null if no extensions are set
    • setExtension

      public void setExtension(Extension extension)
      Assigns the extension parameters for the instance.
      Specified by:
      setExtension in interface Extensible
      Parameters:
      extension - the extension
    • builder

    • toBuilder

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getSignaturePageReference

      public String getSignaturePageReference()
      Reference to a PDF signature page to be inserted (see PdfSignaturePage.getId()). This signature page must be configured within the current policy. As an alternative to giving the reference an entire PdfSignaturePage (see setSignaturePage(PdfSignaturePage)).

      It is an error to specify both signaturePageReference and signaturePage. If neither signaturePageReference or signaturePage is given, the default signature page for the policy will be used, and if no signature page has been configured for the policy an error is reported.

      Returns:
      a reference of the PDF signature page to be inserted
    • setSignaturePageReference

      public void setSignaturePageReference(String signaturePageReference)
      Reference to a PDF signature page to be inserted (see PdfSignaturePage.getId()). This signature page must be configured within the current policy. As an alternative to giving the reference an entire PdfSignaturePage (see setSignaturePage(PdfSignaturePage)).

      It is an error to specify both signaturePageReference and signaturePage. If neither signaturePageReference or signaturePage is given, the default signature page for the policy will be used, and if no signature page has been configured for the policy an error is reported.

      Parameters:
      signaturePageReference - the reference of the PDF signature page to be inserted
    • getSignaturePage

      public PdfSignaturePage getSignaturePage()
      As an alternative to specifying a signPageReference (see setSignaturePageReference(String)) the actual sign page can be provided in the preferences.

      It is an error to specify both signaturePageReference and signaturePage. If neither signaturePageReference or signaturePage is given, the default signature page for the policy will be used, and if no signature page has been configured for the policy an error is reported.

      Returns:
      the PDF signature page to add
    • setSignaturePage

      public void setSignaturePage(PdfSignaturePage signaturePage)
      As an alternative to specifying a signPageReference (see setSignaturePageReference(String)) the actual sign page can be provided in the preferences.

      It is an error to specify both signaturePageReference and signaturePage. If neither signaturePageReference or signaturePage is given, the default signature page for the policy will be used, and if no signature page has been configured for the policy an error is reported.

      Parameters:
      signaturePage - the PDF signature page to add
    • getVisiblePdfSignatureUserInformation

      public VisiblePdfSignatureUserInformation getVisiblePdfSignatureUserInformation()
      The input regarding the user information that is to be used when generating a VisiblePdfSignatureRequirement object. Using the object's values (signer name and other field values) and combining with information regarding the PDF signature image found in getSignaturePageReference() or getSignaturePage() a complete VisiblePdfSignatureRequirement object can be created.
      Returns:
      user information input for creating a VisiblePdfSignatureRequirement object
    • setVisiblePdfSignatureUserInformation

      public void setVisiblePdfSignatureUserInformation(VisiblePdfSignatureUserInformation visiblePdfSignatureUserInformation)
      The input regarding the user information that is to be used when generating a VisiblePdfSignatureRequirement object. Using the object's values (signer name and other field values) and combining with information regarding the PDF signature image found in getSignaturePageReference() or getSignaturePage() a complete VisiblePdfSignatureRequirement object can be created.
      Parameters:
      visiblePdfSignatureUserInformation - user information input for creating a VisiblePdfSignatureRequirement object
    • isFailWhenSignPageFull

      public boolean isFailWhenSignPageFull()
      A PdfSignaturePage has a limit on how many PDF signature images it can hold (see PdfSignaturePage.getMaxSignatureImages()). If ExtendedSignServiceIntegrationService.preparePdfSignaturePage(String, byte[], PdfSignaturePagePreferences) is invoked with a PDF document that contains a number of signature that equals or exceeds the maximum number of allowed signature images (PdfSignaturePage.getMaxSignatureImages()) for the current PDF signature page the failWhenSignPageFull property tells whether preparePdfSignaturePage should fail (PdfSignaturePageFullException) or whether it should allow proceeding with the signature operation where no PDF signature image is inserted (in that case the resulting PreparedPdfDocument will contain a "null" VisiblePdfSignatureRequirement (see VisiblePdfSignatureRequirement.createNullVisiblePdfSignatureRequirement()).
      Returns:
      whether processing should fail or not when the PDF signature page does not have room for any more sign images
    • setFailWhenSignPageFull

      public void setFailWhenSignPageFull(boolean failWhenSignPageFull)
      A PdfSignaturePage has a limit on how many PDF signature images it can hold (see PdfSignaturePage.getMaxSignatureImages()). If ExtendedSignServiceIntegrationService.preparePdfSignaturePage(String, byte[], PdfSignaturePagePreferences) is invoked with a PDF document that contains a number of signature that equals or exceeds the maximum number of allowed signature images (PdfSignaturePage.getMaxSignatureImages()) for the current PDF signature page the failWhenSignPageFull property tells whether preparePdfSignaturePage should fail (PdfSignaturePageFullException) or whether it should allow proceeding with the signature operation where no PDF signature image is inserted (in that case the resulting PreparedPdfDocument will contain a "null" VisiblePdfSignatureRequirement (see VisiblePdfSignatureRequirement.createNullVisiblePdfSignatureRequirement()).
      Parameters:
      failWhenSignPageFull - whether processing should fail or not when the PDF signature page does not have room for any more sign images (the default is true)
    • getInsertPageAt

      public Integer getInsertPageAt()
      Tells where in a PDF document the PDF signature page should be inserted. A value of 1 represents the first page and a value of 0 (or null) represents the last page. The last page is the default.

      Note: If more than one signature image is added to the sign page and existingSignaturePageNumber is not set, the value of insertPageAt MUST be the same between all calls. Thus, the value refers to the page number in the original document, before the sign page was added.

      Returns:
      the page number in a PDF document where the PDF signature page should be inserted
    • setInsertPageAt

      public void setInsertPageAt(Integer insertPageAt)
      Tells where in a PDF document the PDF signature page should be inserted. A value of 1 represents the first page and a value of 0 (or null) represents the last page. The last page is the default.

      Note: If more than one signature image is added to the sign page and existingSignaturePageNumber is not set, the value of insertPageAt MUST be the same between all calls. Thus, the value refers to the page number in the original document, before the sign page was added.

      Parameters:
      insertPageAt - the page number in a PDF document where the PDF signature page should be inserted
    • getExistingSignaturePageNumber

      public Integer getExistingSignaturePageNumber()
      In the cases where a PDF document already has been signed and a signature page has been inserted, and another signature image is to be added to this page, the caller may use the existingSignaturePageNumber property to inform the Sign Service support service about the document page number of the sign page. This page number corresponds to the VisiblePdfSignatureRequirement.getPage() property from the initial call.

      If not set, the Sign Service support service will have to calculate the page number based on the insertPageAt property and signaturePageReference/signaturePage.

    • setExistingSignaturePageNumber

      public void setExistingSignaturePageNumber(Integer existingSignaturePageNumber)
      In the cases where a PDF document already has been signed and a signature page has been inserted, and another signature image is to be added to this page, the caller may use the existingSignaturePageNumber property to inform the Sign Service support service about the document page number of the sign page. This page number corresponds to the VisiblePdfSignatureRequirement.getPage() property from the initial call.

      If not set, the Sign Service support service will have to calculate the page number based on the insertPageAt property and signaturePageReference/signaturePage.

    • getReturnDocumentReference

      public Boolean getReturnDocumentReference()
      A setting that tells that a document reference (PreparedPdfDocument.getUpdatedPdfDocumentReference()) should be returned instead of the updated document itself. Later when the document is passed in a call to SignServiceIntegrationService.createSignRequest(se.idsec.signservice.integration.SignRequestInput) the TbsDocument.setContentReference(String) is used instead of adding the entire document. This way a potentially large document only has to be "uploaded" once.

      A document reference is only returned in the cases when the current SignService Integration policy profile is running in "stateful" mode. It is an error to request a document reference if the policy is stateless.

      The default behaviour is that returnDocumentReference is true if the current policy is stateful and false if it is stateless.

      Returns:
      whether document references instead of a completely updated document should be returned
    • setReturnDocumentReference

      public void setReturnDocumentReference(Boolean returnDocumentReference)
      A setting that tells that a document reference (PreparedPdfDocument.getUpdatedPdfDocumentReference()) should be returned instead of the updated document itself. Later when the document is passed in a call to SignServiceIntegrationService.createSignRequest(se.idsec.signservice.integration.SignRequestInput) the TbsDocument.setContentReference(String) is used instead of adding the entire document. This way a potentially large document only has to be "uploaded" once.

      A document reference is only returned in the cases when the current SignService Integration policy profile is running in "stateful" mode. It is an error to request a document reference if the policy is stateless.

      The default behaviour is that returnDocumentReference is true if the current policy is stateful and false if it is stateless.

      Parameters:
      returnDocumentReference - whether document references should be returned