Interface ExtendedSignServiceIntegrationService

All Superinterfaces:
SignServiceIntegrationService

public interface ExtendedSignServiceIntegrationService extends SignServiceIntegrationService
An extension to the interface describing the API for the SignService Integration Service.

This extension is optional to implement, but its purpose is to supply the user of the API with utility methods that are useful during signature processing.

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

    • preparePdfSignaturePage

      PreparedPdfDocument preparePdfSignaturePage(String policy, byte[] pdfDocument, PdfSignaturePagePreferences signaturePagePreferences) throws InputValidationException, PdfSignaturePageFullException, SignServiceIntegrationException
      A utility method that can be used to prepare a PDF document that is to be signed with a PDF signature page holding the signature image(s).

      A PDF signature image can be inserted into a signed PDF document to make the signature information "visible". The image along with the coordinates that tell where in the PDF document the image should be inserted is represented using a VisiblePdfSignatureRequirement object. See TbsDocument.getVisiblePdfSignatureRequirement().

      However, for the generic case, where we may not always know how the PDF document that we are signing looks like it may be tricky to determine where in the document the PDF signature image should be inserted. For those cases, a dedicated "PDF signature page" may be added to the PDF document before it is added to a TbsDocument object and sent as input in a signature operation. By using a PDF signature page whose structure and constitution is well known it is easy to include a PDF signature image into any PDF document being signed.

      Also, since a PDF document can be signed several times, using a PDF signature page it is easy to include signature images for all signatures of the document.

      The preparePdfSignaturePage method should invoked before each call to SignServiceIntegrationService.createSignRequest(SignRequestInput) where PDF documents with PDF signature pages is to be used. If a PDF document is to be signed is signed more than once and the PDF signature page supports several signature images, no new PDF signature page is added. Instead, the preparePdfSignaturePage method calculates where in the already existing PDF signature page the next signature image will be inserted.

      Parameters:
      policy - the policy under which the operation is performed (see SignRequestInput.getPolicy())
      pdfDocument - the contents of the PDF document that is to be prepared
      signaturePagePreferences - the PDF signature page preferences
      Returns:
      a PreparedPdfDocument object containing the modified PDF document (if a sign page was added) and the VisiblePdfSignatureRequirement telling how a signature image should be added
      Throws:
      InputValidationException - for input validation errors
      PdfSignaturePageFullException - if the PDF document contains more signatures than there is room for in the PDF signature page (and PdfSignaturePagePreferences.isFailWhenSignPageFull() evaluates to true)
      SignServiceIntegrationException - for other processing errors