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.preparePdfDocument(String, byte[], PdfSignaturePagePreferences, Boolean, String).

Note: If ExtendedSignServiceIntegrationService.preparePdfDocument(String, byte[], PdfSignaturePagePreferences, Boolean, String) 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

    • PdfSignaturePagePreferences

      public PdfSignaturePagePreferences()
  • Method Details

    • getSignaturePageReference

      public String getSignaturePageReference()
      Gets the 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)).
      Returns:
      a reference of the PDF signature page to be inserted
    • setSignaturePageReference

      public void setSignaturePageReference(String signaturePageReference)
      Assigns a 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()
      Gets the signature page.

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

      Returns:
      the PDF signature page to add, or null
    • 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. This method adds this page.

      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()
      Gets the input regarding the user information that is to be used when generating a VisiblePdfSignatureRequirement object.
      Returns:
      user information input for creating a VisiblePdfSignatureRequirement object
    • setVisiblePdfSignatureUserInformation

      public void setVisiblePdfSignatureUserInformation(VisiblePdfSignatureUserInformation visiblePdfSignatureUserInformation)
      Assigns 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()). This method tells whether we should fail (or ignore) when another image is added that does not fit.
      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.preparePdfDocument(String, byte[], PdfSignaturePagePreferences, Boolean, String) 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.
      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.
      Returns:
      the existing page number
    • 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.

      Parameters:
      existingSignaturePageNumber - the existing page number
    • getReturnDocumentReference

      @Deprecated(forRemoval=true) public Boolean getReturnDocumentReference()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Deprecated.
      Returns:
      whether document references instead of a completely updated document should be returned
    • setReturnDocumentReference

      @Deprecated(forRemoval=true) public void setReturnDocumentReference(Boolean returnDocumentReference)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Deprecated.
      Parameters:
      returnDocumentReference - whether document references should be returned
    • 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