org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible

## Interface PDFTemplateBuilder

All Known Implementing Classes:
  PDVisibleSigBuilder

    public interface PDFTemplateBuilder

That class builds visible signature template which will be added in our PDF document.

Author:
  Vakhtang Koroghlishvili

### Method Summary

All Methods Instance Methods Abstract Methods
`void` `closeTemplate(PDDocument template)` Closes template
`void` `createAcroForm(PDDocument template)` Creates Acro forms in the template.
`void` `createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField)` Create AcroForm Dictionary.
`void` `createAffineTransform(AffineTransform affineTransform)` In order to create Affine Transform, using parameters.
`void` `createAppearanceDictionary(PDFormXObject holderForm, PDSignatureField signatureField)` Creates appearance dictionary
`void` `createBackgroundLayerForm(PDResources innerFormResource, PDRectangle bbox)` Creates the background layer form (n0).
`void` `createFormatterRectangle(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.
`void` `createHolderForm(PDResources holderFormResources, PDStream holderFormStream, PDRectangle bbox)` Creates Form
`void` `createHolderFormResources()` Creates resources of form
`void` `createHolderFormStream(PDDocument template)` Create a holder for the form stream.
`void` `createImageForm(PDResources imageFormResources, PDResources innerFormResource, PDStream imageFormStream, PDRectangle bbox, AffineTransform affineTransform, PDImageXObject img)` Creates Image form
`void` `createImageFormResources()` Create resource of image form
`void` `createImageFormStream(PDDocument template)` Create image form stream.
`void` `createInnerForm(PDResources innerFormResources, PDStream innerFormStream, PDRectangle bbox)` Creates InnerForm.
`void` `createInnerFormResource()` Creates InnerForm
`void` `createInnerFormStream(PDDocument template)` Create a holder for the inner form stream.
`void` `createPage(PDVisibleSignDesigner properties)` Creates specified size page.
`void` `createProcSetArray()` Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI.
`void` `createSignature(PDSignatureField pdSignatureField, PDPage page, 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.
`void` `createSignatureField(PDAcroForm acroForm)` Creates signature fields.
`void` `createSignatureImage(PDDocument template, BufferedImage image)` Creates signature image.
`void` `createSignatureRectangle(PDSignatureField signatureField, PDVisibleSignDesigner properties)` Creates SignatureRectangle.
`void` `createTemplate(PDPage page)` Creates template using page.
`void` `createVisualSignature(PDDocument template)` just to create visible signature
`void` `createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)` adds Widget Dictionary
`PDFTemplateStructure` `getStructure()` Returns the PDF template Structure
`void` `injectAppearanceStreams(PDStream holderFormStream, PDStream innerFormStream, PDStream imageFormStream, COSName imageFormName, COSName imageName, COSName innerFormName, PDVisibleSignDesigner properties)` injects appearance streams
`void` `injectProcSetArray(PDFormXObject innerForm, PDPage page, PDResources innerFormResources, PDResources imageFormResources, PDResources holderFormResources, COSArray procSet)` Inject procSetArray
`void` `insertInnerFormToHolderResources(PDFormXObject innerForm, PDResources holderFormResources)` Insert given from as inner form.

### Method Detail

#### createAffineTransform

    void createAffineTransform(AffineTransform affineTransform)

In order to create Affine Transform, using parameters.

Parameters:
  `affineTransform` - the affine transformation to be used

#### createPage

    void createPage(PDVisibleSignDesigner properties)

Creates specified size page.

Parameters:
  `properties` - page properties

#### createTemplate

    void createTemplate(PDPage page)
                 throws IOException

Creates template using page.

Parameters:
  `page` - page to be added
Throws:
  `IOException` - if the template could not be created

#### createAcroForm

    void createAcroForm(PDDocument template)

Creates Acro forms in the template.

Parameters:
  `template` - the document the acroform is added to

#### createSignatureField

    void createSignatureField(PDAcroForm acroForm)
                       throws IOException

Creates signature fields.

Parameters:
  `acroForm` - the acroform the signature is added to
Throws:
  `IOException` - if the signature could not be created

#### createSignature

    void createSignature(PDSignatureField pdSignatureField,
                         PDPage page,
                         String signerName)
                  throws IOException

Creates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.

Parameters:
  `pdSignatureField` - the signature filed the signatur is added to
  `page` - the page the widgt ist added to
  `signerName` - 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:
  `IOException` - if the signature could not be created

#### createAcroFormDictionary

    void createAcroFormDictionary(PDAcroForm acroForm,
                                  PDSignatureField signatureField)
                           throws IOException

Create AcroForm Dictionary.

Parameters:
  `acroForm` - the acroform the signature field is added to
  `signatureField` - the signature filed to be added
Throws:
  `IOException` - if the signature field could not be added

#### createSignatureRectangle

    void createSignatureRectangle(PDSignatureField signatureField,
                                  PDVisibleSignDesigner properties)
                           throws IOException

Creates SignatureRectangle.

Parameters:
  `signatureField` - the signature field the rectangle is added to
  `properties` - the properties used to create the rectangle
Throws:
  `IOException` - if the rectangle could not be created

#### createProcSetArray

    void createProcSetArray()

Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI.

#### createSignatureImage

    void createSignatureImage(PDDocument template,
                              BufferedImage image)
                       throws IOException

Creates signature image.

Parameters:
  `template` - the document the image is added to
  `image` - to imager to be added
Throws:
  `IOException` - if the image could not be added

#### createFormatterRectangle

    void createFormatterRectangle(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. These boundaries shall be used to clip the form XObject and to determine its size for caching.

Parameters:
  `params` - the parameters of the formatter rectangle

#### createHolderFormStream

    void createHolderFormStream(PDDocument template)

Create a holder for the form stream.

Parameters:
  `template` - the document to be used to create the new stream

#### createHolderFormResources

    void createHolderFormResources()

Creates resources of form

#### createHolderForm

    void createHolderForm(PDResources holderFormResources,
                          PDStream holderFormStream,
                          PDRectangle bbox)

Creates Form

Parameters:
  `holderFormResources` - resources to be used for the form object
  `holderFormStream` - the stream to be used for the form object
  `bbox` - the bounding box of the form object

#### createAppearanceDictionary

    void createAppearanceDictionary(PDFormXObject holderForm,
                                    PDSignatureField signatureField)
                             throws IOException

Creates appearance dictionary

Parameters:
  `holderForm` - form object to be used for the appearance stream
  `signatureField` - the signature field the appearance stream is added to
Throws:
  `IOException` - if the appearance stream could not be created

#### createInnerFormStream

    void createInnerFormStream(PDDocument template)

Create a holder for the inner form stream.

Parameters:
  `template` - the document to be used to create the new stream

#### createInnerFormResource

    void createInnerFormResource()

Creates InnerForm

#### createInnerForm

    void createInnerForm(PDResources innerFormResources,
                         PDStream innerFormStream,
                         PDRectangle bbox)

Creates InnerForm.

Parameters:
  `innerFormResources` - resources to be used for the inner form object
  `innerFormStream` - the stream to be used for the inner form object
  `bbox` - the bounding box of the inner form object

#### insertInnerFormToHolderResources

    void insertInnerFormToHolderResources(PDFormXObject innerForm,
                                          PDResources holderFormResources)

Insert given from as inner form.

Parameters:
  `innerForm` - the form object to be inserted
  `holderFormResources` - resources the form object is added to

#### createImageFormStream

    void createImageFormStream(PDDocument template)

Create image form stream.

Parameters:
  `template` - the document to be used to create the new stream

#### createImageFormResources

    void createImageFormResources()

Create resource of image form

#### createImageForm

    void createImageForm(PDResources imageFormResources,
                         PDResources innerFormResource,
                         PDStream imageFormStream,
                         PDRectangle bbox,
                         AffineTransform affineTransform,
                         PDImageXObject img)
                  throws IOException

Creates Image form

Parameters:
  `imageFormResources` - the resources of the form object
  `innerFormResource` - the resources the image object is added
  `imageFormStream` - the stream of the form object
  `bbox` - the bounding box of the form object
  `affineTransform` - the matrix of the form object
  `img` - the image object to be used for the form object
Throws:
  `IOException` - if the form object could not be created

#### createBackgroundLayerForm

    void createBackgroundLayerForm(PDResources innerFormResource,
                                   PDRectangle bbox)
                            throws IOException

Creates the background layer form (n0).

Parameters:
  `innerFormResource` - resources to be used for the form object
  `bbox` - the bounding box of the form object
Throws:
  `IOException` - if the form object could not be created

#### injectProcSetArray

    void injectProcSetArray(PDFormXObject innerForm,
                            PDPage page,
                            PDResources innerFormResources,
                            PDResources imageFormResources,
                            PDResources holderFormResources,
                            COSArray procSet)

Inject procSetArray

Parameters:
  `innerForm` - form object the given proc set array is added to
  `page` - page the given proc set array is added to
  `innerFormResources` - inner form resources the given proc set array is added to
  `imageFormResources` - inner image resources the given proc set array is added to
  `holderFormResources` - holder form resources the given proc set array is added to
  `procSet` - the pro set array to be added

#### injectAppearanceStreams

    void injectAppearanceStreams(PDStream holderFormStream,
                                 PDStream innerFormStream,
                                 PDStream imageFormStream,
                                 COSName imageFormName,
                                 COSName imageName,
                                 COSName innerFormName,
                                 PDVisibleSignDesigner properties)
                          throws IOException

injects appearance streams

Parameters:
  `holderFormStream` - the holder form stream
  `innerFormStream` - the inner form stream
  `imageFormStream` - the image form stream
  `imageFormName` - the name of the form image to be used
  `imageName` - the name of the image to be used
  `innerFormName` - the name of the form object to be used
  `properties` - properties to be used to create the appearance stream
Throws:
  `IOException` - if the appearance stream could not be created

#### createVisualSignature

    void createVisualSignature(PDDocument template)

just to create visible signature

Parameters:
  `template` - the document holding the visible signature

#### createWidgetDictionary

    void createWidgetDictionary(PDSignatureField signatureField,
                                PDResources holderFormResources)
                         throws IOException

adds Widget Dictionary

Parameters:
  `signatureField` - the field to be used as widget dictionary
  `holderFormResources` - the resources to be added to the widget dictionary
Throws:
  `IOException` - if the widget dictionary could not be created

#### getStructure

    PDFTemplateStructure getStructure()

Returns the PDF template Structure

Returns:
  PDF template Structure

#### closeTemplate

    void closeTemplate(PDDocument template)
                throws IOException

Closes template

Parameters:
  `template` - the document to be closed
Throws:
  `IOException` - if the document could not be closed