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
FieldsModifier and TypeFieldDescriptionprotected com.lowagie.text.pdf.PdfSignatureAppearanceThe visual signature appearanceprotected SignatureImageParametersVisual signature parameters -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor instantiating object with null values -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddColorSpace(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 voidcheckColorSpace(com.lowagie.text.pdf.PdfReader reader) Method to check if the target image's color space is present in the document's catalogprotected abstract DSSFontMetricsReturns the associated with the drawer font metricsprotected abstract com.lowagie.text.pdf.PdfNameReturns color space name for the provided imageprotected intgetFinalRotation(int globalRotation, int pageRotation) Because OpenPDF does not rotate signature field automatically accordingly the page's rotation, we need to rotate manuallyprotected AnnotationBoxReturns the page's boxprotected intReturns the page's rotation where the signature field will be placed inprotected AnnotationBoxgetRotatedAnnotationRelativelyPageRotation(AnnotationBox annotationBox) As OpenPDF does not automatically rotate the provided signature field relatively to the page's rotation, we need to rotate it manuallyvoidinit(SignatureImageParameters parameters, com.lowagie.text.pdf.PdfReader reader, com.lowagie.text.pdf.PdfSignatureAppearance appearance) Initializes the drawerprotected AnnotationBoxtoAnnotationBox(SignatureFieldDimensionAndPosition dimensionAndPosition) Transforms the givendimensionAndPositionto aAnnotationBoxaccording to the given page sizeprotected com.lowagie.text.RectangletoITextRectangle(AnnotationBox annotationBox) TransformsAnnotationBoxto thecom.lowagie.text.RectangleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:ITextSignatureDrawerInitializes the drawer- Specified by:
initin interfaceITextSignatureDrawer- Parameters:
parameters-SignatureImageParametersreader-PdfReaderappearance-PdfSignatureAppearance
-
buildSignatureFieldBox
Builds a signature field dimension and position object- Specified by:
buildSignatureFieldBoxin 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 givendimensionAndPositionto aAnnotationBoxaccording 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-PdfReaderto check color profiles in
-
getExpectedColorSpaceName
protected abstract com.lowagie.text.pdf.PdfName getExpectedColorSpaceName()Returns color space name for the provided image- Returns:
PdfNamecolor 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-PdfDictionaryfrom a PDF document to add a new color space intocolorSpaceName-PdfNamea 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-AnnotationBoxto be rotated- Returns:
AnnotationBox
-
toITextRectangle
TransformsAnnotationBoxto 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
-