Class AbstractPdfBoxSignatureDrawer

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

public abstract class AbstractPdfBoxSignatureDrawer extends Object implements PdfBoxSignatureDrawer, eu.europa.esig.dss.pdf.visible.SignatureFieldBoxBuilder
The abstract implementation of PDFBox signature drawer
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.apache.pdfbox.pdmodel.PDDocument
    The PDF document
    protected eu.europa.esig.dss.pades.SignatureImageParameters
    Visual signature parameters
    protected org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions
    Contains options of the visual signature
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor instantiating object with null values
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    eu.europa.esig.dss.pdf.visible.SignatureFieldDimensionAndPosition
    Builds a signature field dimension and position object
    protected void
    checkColorSpace(org.apache.pdfbox.pdmodel.PDDocument pdDocument)
    Method to check if the target image's color space is present in the document's catalog
    protected abstract eu.europa.esig.dss.pdf.visible.DSSFontMetrics
    Gets the corresponding eu.europa.esig.dss.pdf.visible.DSSFontMetrics
    protected abstract String
    Returns color space name for the provided image
    protected org.apache.pdfbox.pdmodel.PDPage
    Gets the page to create a new signature field in
    protected eu.europa.esig.dss.pdf.AnnotationBox
    getPageAnnotationBox(org.apache.pdfbox.pdmodel.PDPage pdPage)
    Gets a page annotation box
    void
    init(eu.europa.esig.dss.pades.SignatureImageParameters parameters, org.apache.pdfbox.pdmodel.PDDocument document, org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions signatureOptions)
    Initializes the drawer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface eu.europa.esig.dss.pdf.visible.SignatureDrawer

    draw
  • Field Details

    • parameters

      protected eu.europa.esig.dss.pades.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(eu.europa.esig.dss.pades.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 eu.europa.esig.dss.pdf.visible.SignatureFieldDimensionAndPosition buildSignatureFieldBox()
      Builds a signature field dimension and position object
      Specified by:
      buildSignatureFieldBox in interface eu.europa.esig.dss.pdf.visible.SignatureFieldBoxBuilder
      Returns:
      SignatureFieldDimensionAndPosition
    • getPage

      protected org.apache.pdfbox.pdmodel.PDPage getPage()
      Gets the page to create a new signature field in
      Returns:
      PDPage
    • getPageAnnotationBox

      protected eu.europa.esig.dss.pdf.AnnotationBox getPageAnnotationBox(org.apache.pdfbox.pdmodel.PDPage pdPage)
      Gets a page annotation box
      Parameters:
      pdPage - PDPage
      Returns:
      AnnotationBox
    • getDSSFontMetrics

      protected abstract eu.europa.esig.dss.pdf.visible.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