Class AbstractPdfBoxSignatureDrawer

java.lang.Object
eu.europa.esig.dss.pdf.pdfbox.visible.AbstractPdfBoxSignatureDrawer
All Implemented Interfaces:
PdfBoxSignatureDrawer, SignatureDrawer, SignatureFieldBoxBuilder
Direct Known Subclasses:
DefaultPdfBoxVisibleSignatureDrawer, NativePdfBoxVisibleSignatureDrawer

public abstract class AbstractPdfBoxSignatureDrawer extends Object implements PdfBoxSignatureDrawer, SignatureFieldBoxBuilder
The abstract implementation of PDFBox signature drawer
  • Field Details

    • parameters

      protected SignatureImageParameters parameters
      Visual signature parameters
    • document

      protected org.apache.pdfbox.pdmodel.PDDocument document
      The PDF document
    • signatureOptions

      protected org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions signatureOptions
      Contains options of the visual signature
  • Constructor Details

    • AbstractPdfBoxSignatureDrawer

      protected AbstractPdfBoxSignatureDrawer()
      Default constructor instantiating object with null values
  • Method Details

    • init

      public void init(SignatureImageParameters parameters, org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions signatureOptions) throws IOException
      Description copied from interface: PdfBoxSignatureDrawer
      Initializes the drawer
      Specified by:
      init in interface PdfBoxSignatureDrawer
      Parameters:
      parameters - SignatureImageParameters
      document - PDDocument
      signatureOptions - SignatureOptions
      Throws:
      IOException - if an exception occurs
    • buildSignatureFieldBox

      public SignatureFieldDimensionAndPosition buildSignatureFieldBox()
      Builds a signature field dimension and position object
      Specified by:
      buildSignatureFieldBox in interface SignatureFieldBoxBuilder
      Returns:
      SignatureFieldDimensionAndPosition
    • getDSSFontMetrics

      protected abstract DSSFontMetrics getDSSFontMetrics()
      Gets the corresponding eu.europa.esig.dss.pdf.visible.DSSFontMetrics
      Returns:
      DSSFontMetrics
    • checkColorSpace

      protected void checkColorSpace(org.apache.pdfbox.pdmodel.PDDocument pdDocument) throws IOException
      Method to check if the target image's color space is present in the document's catalog
      Parameters:
      pdDocument - PDDocument to check color profiles in
      Throws:
      IOException - in case of image reading error
    • getExpectedColorSpaceName

      protected abstract String getExpectedColorSpaceName() throws IOException
      Returns color space name for the provided image
      Returns:
      String color space name
      Throws:
      IOException - in case of image reading error
    • addColorSpace

      protected void addColorSpace(org.apache.pdfbox.pdmodel.PDDocumentCatalog catalog, String colorSpaceName)
      This method is used to add a new required color space to a document
      Parameters:
      catalog - PDDocumentCatalog from a PDF document to add a new color space into
      colorSpaceName - String a color space name to add