Class AbstractITextSignatureDrawer
java.lang.Object
eu.europa.esig.dss.pdf.openpdf.visible.AbstractITextSignatureDrawer
- All Implemented Interfaces:
ITextSignatureDrawer
,SignatureDrawer
,SignatureFieldBoxBuilder
- Direct Known Subclasses:
ImageOnlySignatureDrawer
,TextOnlySignatureDrawer
public abstract class AbstractITextSignatureDrawer
extends Object
implements ITextSignatureDrawer, SignatureFieldBoxBuilder
The abstract implementation of an IText (OpenPDF) signature drawer
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.lowagie.text.pdf.PdfSignatureAppearance
The visual signature appearanceprotected SignatureImageParameters
Visual signature parameters -
Constructor Summary
ModifierConstructorDescriptionprotected
Default constructor instantiating object with null values -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addColorSpace
(com.lowagie.text.pdf.PdfDictionary catalog, com.lowagie.text.pdf.PdfName colorSpaceName) This method is used to add a new required color space to a documentBuilds a signature field dimension and position objectprotected void
checkColorSpace
(com.lowagie.text.pdf.PdfReader reader) Method to check if the target image's color space is present in the document's catalogprotected abstract DSSFontMetrics
Returns the associated with the drawer font metricsprotected abstract com.lowagie.text.pdf.PdfName
Returns color space name for the provided imageprotected int
getFinalRotation
(int globalRotation, int pageRotation) Because OpenPDF does not rotate signature field automatically accordingly the page's rotation, we need to rotate manuallyprotected AnnotationBox
Returns the page's boxprotected int
Returns the page's rotation where the signature field will be placed inprotected AnnotationBox
getRotatedAnnotationRelativelyPageRotation
(AnnotationBox annotationBox) As OpenPDF does not automatically rotate the provided signature field relatively to the page's rotation, we need to rotate it manuallyvoid
init
(SignatureImageParameters parameters, com.lowagie.text.pdf.PdfReader reader, com.lowagie.text.pdf.PdfSignatureAppearance appearance) Initializes the drawerprotected AnnotationBox
toAnnotationBox
(SignatureFieldDimensionAndPosition dimensionAndPosition) Transforms the givendimensionAndPosition
to aAnnotationBox
according to the given page sizeprotected com.lowagie.text.Rectangle
toITextRectangle
(AnnotationBox annotationBox) TransformsAnnotationBox
to thecom.lowagie.text.Rectangle
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
Visual signature parameters -
appearance
protected com.lowagie.text.pdf.PdfSignatureAppearance appearanceThe visual signature appearance
-
-
Constructor Details
-
AbstractITextSignatureDrawer
protected AbstractITextSignatureDrawer()Default constructor instantiating object with null values
-
-
Method Details
-
init
public void init(SignatureImageParameters parameters, com.lowagie.text.pdf.PdfReader reader, com.lowagie.text.pdf.PdfSignatureAppearance appearance) Description copied from interface:ITextSignatureDrawer
Initializes the drawer- Specified by:
init
in interfaceITextSignatureDrawer
- Parameters:
parameters
-SignatureImageParameters
reader
-PdfReader
appearance
-PdfSignatureAppearance
-
buildSignatureFieldBox
Builds a signature field dimension and position object- Specified by:
buildSignatureFieldBox
in interfaceSignatureFieldBoxBuilder
- Returns:
SignatureFieldDimensionAndPosition
-
getDSSFontMetrics
Returns the associated with the drawer font metrics- Returns:
DSSFontMetrics
-
getPageAnnotationBox
-
getPageRotation
protected int getPageRotation()Returns the page's rotation where the signature field will be placed in- Returns:
- rotation degree
-
toAnnotationBox
Transforms the givendimensionAndPosition
to aAnnotationBox
according to the given page size- Parameters:
dimensionAndPosition
-SignatureFieldDimensionAndPosition
- Returns:
AnnotationBox
-
checkColorSpace
protected void checkColorSpace(com.lowagie.text.pdf.PdfReader reader) Method to check if the target image's color space is present in the document's catalog- Parameters:
reader
-PdfReader
to check color profiles in
-
getExpectedColorSpaceName
protected abstract com.lowagie.text.pdf.PdfName getExpectedColorSpaceName()Returns color space name for the provided image- Returns:
PdfName
color space name
-
addColorSpace
protected void addColorSpace(com.lowagie.text.pdf.PdfDictionary catalog, com.lowagie.text.pdf.PdfName colorSpaceName) This method is used to add a new required color space to a document- Parameters:
catalog
-PdfDictionary
from a PDF document to add a new color space intocolorSpaceName
-PdfName
a color space name to add
-
getRotatedAnnotationRelativelyPageRotation
As OpenPDF does not automatically rotate the provided signature field relatively to the page's rotation, we need to rotate it manually- Parameters:
annotationBox
-AnnotationBox
to be rotated- Returns:
AnnotationBox
-
toITextRectangle
TransformsAnnotationBox
to thecom.lowagie.text.Rectangle
- Parameters:
annotationBox
-AnnotationBox
- Returns:
Rectangle
-
getFinalRotation
protected int getFinalRotation(int globalRotation, int pageRotation) Because OpenPDF does not rotate signature field automatically accordingly the page's rotation, we need to rotate manually- Parameters:
globalRotation
- calculated global rotationpageRotation
- page's rotation- Returns:
- final rotation value
-