Class PDVisibleSigBuilder
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigBuilder
-
- All Implemented Interfaces:
PDFTemplateBuilder
public class PDVisibleSigBuilder extends java.lang.Object implements PDFTemplateBuilder
Implementation ofPDFTemplateBuilder. This builds the signature PDF but doesn't keep the elements, these are kept in its PDF template structure.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.commons.logging.LogLOGprivate PDFTemplateStructurepdfStructure
-
Constructor Summary
Constructors Constructor Description PDVisibleSigBuilder()Constructor, creates PDF template structure.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendRawCommands(java.io.OutputStream os, java.lang.String commands)voidcloseTemplate(PDDocument template)Closes templatevoidcreateAcroForm(PDDocument template)Creates Acro forms in the template.voidcreateAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField)Create AcroForm Dictionary.voidcreateAffineTransform(java.awt.geom.AffineTransform affineTransform)In order to create Affine Transform, using parameters.voidcreateAppearanceDictionary(PDFormXObject holderForm, PDSignatureField signatureField)Creates appearance dictionaryvoidcreateBackgroundLayerForm(PDResources innerFormResource, PDRectangle bbox)Creates the background layer form (n0).voidcreateFormatterRectangle(int[] params)An array of four numbers in the form coordinate system, giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject’s bounding box.voidcreateHolderForm(PDResources holderFormResources, PDStream holderFormStream, PDRectangle bbox)Creates FormvoidcreateHolderFormResources()Creates resources of formvoidcreateHolderFormStream(PDDocument template)Create a holder for the form stream.voidcreateImageForm(PDResources imageFormResources, PDResources innerFormResource, PDStream imageFormStream, PDRectangle bbox, java.awt.geom.AffineTransform at, PDImageXObject img)Creates Image formvoidcreateImageFormResources()Create resource of image formvoidcreateImageFormStream(PDDocument template)Create image form stream.voidcreateInnerForm(PDResources innerFormResources, PDStream innerFormStream, PDRectangle bbox)Creates InnerForm.voidcreateInnerFormResource()Creates InnerFormvoidcreateInnerFormStream(PDDocument template)Create a holder for the inner form stream.voidcreatePage(PDVisibleSignDesigner properties)Creates specified size page.voidcreateProcSetArray()Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI.voidcreateSignature(PDSignatureField pdSignatureField, PDPage page, java.lang.String signerName)Creates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.voidcreateSignatureField(PDAcroForm acroForm)Creates signature fields.voidcreateSignatureImage(PDDocument template, java.awt.image.BufferedImage image)Creates signature image.voidcreateSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner properties)Creates SignatureRectangle.voidcreateTemplate(PDPage page)Creates a PDDocument and adds the page parameter to it and keeps this as a template in the PDF template Structure.voidcreateVisualSignature(PDDocument template)just to create visible signaturevoidcreateWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)adds Widget DictionaryPDFTemplateStructuregetStructure()Returns the PDF template StructurevoidinjectAppearanceStreams(PDStream holderFormStream, PDStream innerFormStream, PDStream imageFormStream, COSName imageFormName, COSName imageName, COSName innerFormName, PDVisibleSignDesigner properties)injects appearance streamsvoidinjectProcSetArray(PDFormXObject innerForm, PDPage page, PDResources innerFormResources, PDResources imageFormResources, PDResources holderFormResources, COSArray procSet)Inject procSetArrayvoidinsertInnerFormToHolderResources(PDFormXObject innerForm, PDResources holderFormResources)Insert given from as inner form.
-
-
-
Field Detail
-
pdfStructure
private final PDFTemplateStructure pdfStructure
-
LOG
private static final org.apache.commons.logging.Log LOG
-
-
Method Detail
-
createPage
public void createPage(PDVisibleSignDesigner properties)
Description copied from interface:PDFTemplateBuilderCreates specified size page.- Specified by:
createPagein interfacePDFTemplateBuilder- Parameters:
properties- page properties
-
createTemplate
public void createTemplate(PDPage page) throws java.io.IOException
Creates a PDDocument and adds the page parameter to it and keeps this as a template in the PDF template Structure.- Specified by:
createTemplatein interfacePDFTemplateBuilder- Parameters:
page- the page to be added- Throws:
java.io.IOException- if the document could not be created
-
createAcroForm
public void createAcroForm(PDDocument template)
Description copied from interface:PDFTemplateBuilderCreates Acro forms in the template.- Specified by:
createAcroFormin interfacePDFTemplateBuilder- Parameters:
template- the document the acroform is added to
-
getStructure
public PDFTemplateStructure getStructure()
Description copied from interface:PDFTemplateBuilderReturns the PDF template Structure- Specified by:
getStructurein interfacePDFTemplateBuilder- Returns:
- PDF template Structure
-
createSignatureField
public void createSignatureField(PDAcroForm acroForm) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates signature fields.- Specified by:
createSignatureFieldin interfacePDFTemplateBuilder- Parameters:
acroForm- the acroform the signature is added to- Throws:
java.io.IOException- if the signature could not be created
-
createSignature
public void createSignature(PDSignatureField pdSignatureField, PDPage page, java.lang.String signerName) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.- Specified by:
createSignaturein interfacePDFTemplateBuilder- Parameters:
pdSignatureField- the signature filed the signatur is added topage- the page the widgt ist added tosignerName- the name of the person or authority signing the document. According to the PDF specification, this value should be used only when it is not possible to extract the name from the signature.- Throws:
java.io.IOException- if the signature could not be created
-
createAcroFormDictionary
public void createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreate AcroForm Dictionary.- Specified by:
createAcroFormDictionaryin interfacePDFTemplateBuilder- Parameters:
acroForm- the acroform the signature field is added tosignatureField- the signature filed to be added- Throws:
java.io.IOException- if the signature field could not be added
-
createSignatureRectangle
public void createSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner properties) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates SignatureRectangle.- Specified by:
createSignatureRectanglein interfacePDFTemplateBuilder- Parameters:
signatureField- the signature field the rectangle is added toproperties- the properties used to create the rectangle- Throws:
java.io.IOException- if the rectangle could not be created
-
createAffineTransform
public void createAffineTransform(java.awt.geom.AffineTransform affineTransform)
Description copied from interface:PDFTemplateBuilderIn order to create Affine Transform, using parameters.- Specified by:
createAffineTransformin interfacePDFTemplateBuilder- Parameters:
affineTransform- the affine transformation to be used
-
createProcSetArray
public void createProcSetArray()
Description copied from interface:PDFTemplateBuilderCreates procSetArray of PDF,Text,ImageB,ImageC,ImageI.- Specified by:
createProcSetArrayin interfacePDFTemplateBuilder
-
createSignatureImage
public void createSignatureImage(PDDocument template, java.awt.image.BufferedImage image) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates signature image.- Specified by:
createSignatureImagein interfacePDFTemplateBuilder- Parameters:
template- the document the image is added toimage- to imager to be added- Throws:
java.io.IOException- if the image could not be added
-
createFormatterRectangle
public void createFormatterRectangle(int[] params)
Description copied from interface:PDFTemplateBuilderAn array of four numbers in the form coordinate system, giving the coordinates of the left, bottom, right, and top edges, respectively, of the form XObject’s bounding box. These boundaries shall be used to clip the form XObject and to determine its size for caching.- Specified by:
createFormatterRectanglein interfacePDFTemplateBuilder- Parameters:
params- the parameters of the formatter rectangle
-
createHolderFormStream
public void createHolderFormStream(PDDocument template)
Description copied from interface:PDFTemplateBuilderCreate a holder for the form stream.- Specified by:
createHolderFormStreamin interfacePDFTemplateBuilder- Parameters:
template- the document to be used to create the new stream
-
createHolderFormResources
public void createHolderFormResources()
Description copied from interface:PDFTemplateBuilderCreates resources of form- Specified by:
createHolderFormResourcesin interfacePDFTemplateBuilder
-
createHolderForm
public void createHolderForm(PDResources holderFormResources, PDStream holderFormStream, PDRectangle bbox)
Description copied from interface:PDFTemplateBuilderCreates Form- Specified by:
createHolderFormin interfacePDFTemplateBuilder- Parameters:
holderFormResources- resources to be used for the form objectholderFormStream- the stream to be used for the form objectbbox- the bounding box of the form object
-
createAppearanceDictionary
public void createAppearanceDictionary(PDFormXObject holderForm, PDSignatureField signatureField) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates appearance dictionary- Specified by:
createAppearanceDictionaryin interfacePDFTemplateBuilder- Parameters:
holderForm- form object to be used for the appearance streamsignatureField- the signature field the appearance stream is added to- Throws:
java.io.IOException- if the appearance stream could not be created
-
createInnerFormStream
public void createInnerFormStream(PDDocument template)
Description copied from interface:PDFTemplateBuilderCreate a holder for the inner form stream.- Specified by:
createInnerFormStreamin interfacePDFTemplateBuilder- Parameters:
template- the document to be used to create the new stream
-
createInnerFormResource
public void createInnerFormResource()
Description copied from interface:PDFTemplateBuilderCreates InnerForm- Specified by:
createInnerFormResourcein interfacePDFTemplateBuilder
-
createInnerForm
public void createInnerForm(PDResources innerFormResources, PDStream innerFormStream, PDRectangle bbox)
Description copied from interface:PDFTemplateBuilderCreates InnerForm.- Specified by:
createInnerFormin interfacePDFTemplateBuilder- Parameters:
innerFormResources- resources to be used for the inner form objectinnerFormStream- the stream to be used for the inner form objectbbox- the bounding box of the inner form object
-
insertInnerFormToHolderResources
public void insertInnerFormToHolderResources(PDFormXObject innerForm, PDResources holderFormResources)
Description copied from interface:PDFTemplateBuilderInsert given from as inner form.- Specified by:
insertInnerFormToHolderResourcesin interfacePDFTemplateBuilder- Parameters:
innerForm- the form object to be insertedholderFormResources- resources the form object is added to
-
createImageFormStream
public void createImageFormStream(PDDocument template)
Description copied from interface:PDFTemplateBuilderCreate image form stream.- Specified by:
createImageFormStreamin interfacePDFTemplateBuilder- Parameters:
template- the document to be used to create the new stream
-
createImageFormResources
public void createImageFormResources()
Description copied from interface:PDFTemplateBuilderCreate resource of image form- Specified by:
createImageFormResourcesin interfacePDFTemplateBuilder
-
createImageForm
public void createImageForm(PDResources imageFormResources, PDResources innerFormResource, PDStream imageFormStream, PDRectangle bbox, java.awt.geom.AffineTransform at, PDImageXObject img) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates Image form- Specified by:
createImageFormin interfacePDFTemplateBuilder- Parameters:
imageFormResources- the resources of the form objectinnerFormResource- the resources the image object is addedimageFormStream- the stream of the form objectbbox- the bounding box of the form objectat- the matrix of the form objectimg- the image object to be used for the form object- Throws:
java.io.IOException- if the form object could not be created
-
createBackgroundLayerForm
public void createBackgroundLayerForm(PDResources innerFormResource, PDRectangle bbox) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCreates the background layer form (n0).- Specified by:
createBackgroundLayerFormin interfacePDFTemplateBuilder- Parameters:
innerFormResource- resources to be used for the form objectbbox- the bounding box of the form object- Throws:
java.io.IOException- if the form object could not be created
-
injectProcSetArray
public void injectProcSetArray(PDFormXObject innerForm, PDPage page, PDResources innerFormResources, PDResources imageFormResources, PDResources holderFormResources, COSArray procSet)
Description copied from interface:PDFTemplateBuilderInject procSetArray- Specified by:
injectProcSetArrayin interfacePDFTemplateBuilder- Parameters:
innerForm- form object the given proc set array is added topage- page the given proc set array is added toinnerFormResources- inner form resources the given proc set array is added toimageFormResources- inner image resources the given proc set array is added toholderFormResources- holder form resources the given proc set array is added toprocSet- the pro set array to be added
-
injectAppearanceStreams
public void injectAppearanceStreams(PDStream holderFormStream, PDStream innerFormStream, PDStream imageFormStream, COSName imageFormName, COSName imageName, COSName innerFormName, PDVisibleSignDesigner properties) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderinjects appearance streams- Specified by:
injectAppearanceStreamsin interfacePDFTemplateBuilder- Parameters:
holderFormStream- the holder form streaminnerFormStream- the inner form streamimageFormStream- the image form streamimageFormName- the name of the form image to be usedimageName- the name of the image to be usedinnerFormName- the name of the form object to be usedproperties- properties to be used to create the appearance stream- Throws:
java.io.IOException- if the appearance stream could not be created
-
appendRawCommands
public void appendRawCommands(java.io.OutputStream os, java.lang.String commands) throws java.io.IOException- Throws:
java.io.IOException
-
createVisualSignature
public void createVisualSignature(PDDocument template)
Description copied from interface:PDFTemplateBuilderjust to create visible signature- Specified by:
createVisualSignaturein interfacePDFTemplateBuilder- Parameters:
template- the document holding the visible signature
-
createWidgetDictionary
public void createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderadds Widget Dictionary- Specified by:
createWidgetDictionaryin interfacePDFTemplateBuilder- Parameters:
signatureField- the field to be used as widget dictionaryholderFormResources- the resources to be added to the widget dictionary- Throws:
java.io.IOException- if the widget dictionary could not be created
-
closeTemplate
public void closeTemplate(PDDocument template) throws java.io.IOException
Description copied from interface:PDFTemplateBuilderCloses template- Specified by:
closeTemplatein interfacePDFTemplateBuilder- Parameters:
template- the document to be closed- Throws:
java.io.IOException- if the document could not be closed
-
-