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

## Class PDVisibleSigBuilder

- java.lang.Object
- - org.apache.pdfbox.pdmodel.interactive.digitalsignature.visible.PDVisibleSigBuilder

All Implemented Interfaces:
  PDFTemplateBuilder

    public class PDVisibleSigBuilder
    extends Object
    implements PDFTemplateBuilder

Implementation of `PDFTemplateBuilder`. This builds the signature PDF but doesn't keep the elements, these are kept in its PDF template structure.

Author:
  Vakhtang Koroghlishvili

### Constructor Summary

Constructors
Constructor and Description
`PDVisibleSigBuilder()` Constructor, creates PDF template structure.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `appendRawCommands(OutputStream os, String commands)`
`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` `createAffineTransform(byte[] params)` Deprecated. use `createAffineTransform(java.awt.geom.AffineTransform)`
`void` `createAppearanceDictionary(PDFormXObject holderForm, PDSignatureField signatureField)` Creates appearance dictionary
`void` `createBackgroundLayerForm(PDResources innerFormResource, PDRectangle bbox)` Creates the background layer form (n0).
`void` `createFormatterRectangle(byte[] params)` Deprecated. use `createFormatterRectangle(int[])`
`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)`
`void` `createImageForm(PDResources imageFormResources, PDResources innerFormResource, PDStream imageFormStream, PDRectangle bbox, AffineTransform at, PDImageXObject img)` Creates Image form
`void` `createImageFormResources()` Create resource of image form
`void` `createImageFormStream(PDDocument template)`
`void` `createInnerForm(PDResources innerFormResources, PDStream innerFormStream, PDRectangle bbox)`
`void` `createInnerFormResource()` Creates InnerForm
`void` `createInnerFormStream(PDDocument template)`
`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 a PDDocument and adds the page parameter to it and keeps this as a template in the PDF template Structure.
`void` `createVisualSignature(PDDocument template)` just to create visible signature
`void` `createWidgetDictionary(PDSignatureField signatureField, PDResources holderFormResources)` adds Widget Dictionary
`PDFTemplateStructure` `getStructure()`
`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)`

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### PDVisibleSigBuilder

    public PDVisibleSigBuilder()

Constructor, creates PDF template structure.

### Method Detail

#### createPage

    public void createPage(PDVisibleSignDesigner properties)

Description copied from interface: `PDFTemplateBuilder`
Creates specified size page.

Specified by:
  `createPage` in interface `PDFTemplateBuilder`
Parameters:
  `properties` - property value

#### createTemplate

    public void createTemplate(PDPage page)
                        throws IOException

Creates a PDDocument and adds the page parameter to it and keeps this as a template in the PDF template Structure.

Specified by:
  `createTemplate` in interface `PDFTemplateBuilder`
Parameters:
  `page` -
Throws:
  `IOException`

#### createAcroForm

    public void createAcroForm(PDDocument template)

Description copied from interface: `PDFTemplateBuilder`
Creates Acro forms in the template.

Specified by:
  `createAcroForm` in interface `PDFTemplateBuilder`
Parameters:
  `template` - the template document

#### getStructure

    public PDFTemplateStructure getStructure()

Specified by:
  `getStructure` in interface `PDFTemplateBuilder`
Returns:
  - PDF template Structure

#### createSignatureField

    public void createSignatureField(PDAcroForm acroForm)
                              throws IOException

Description copied from interface: `PDFTemplateBuilder`
Creates signature fields.

Specified by:
  `createSignatureField` in interface `PDFTemplateBuilder`
Parameters:
  `acroForm` - the acroform
Throws:
  `IOException` - if something went wrong

#### createSignature

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

Description copied from interface: `PDFTemplateBuilder`
Creates the signature with the given name and assign it to the signature field parameter and assign the page parameter to the widget.

Specified by:
  `createSignature` in interface `PDFTemplateBuilder`
Parameters:
  `pdSignatureField` - signature filed
  `page` - the given page
  `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 something went wrong

#### createAcroFormDictionary

    public void createAcroFormDictionary(PDAcroForm acroForm,
                                         PDSignatureField signatureField)
                                  throws IOException

Description copied from interface: `PDFTemplateBuilder`
Create AcroForm Dictionary.

Specified by:
  `createAcroFormDictionary` in interface `PDFTemplateBuilder`
Parameters:
  `acroForm` - the acroform
  `signatureField` - the signature field
Throws:
  `IOException` - if something went wrong

#### createSignatureRectangle

    public void createSignatureRectangle(PDSignatureField signatureField,
                                         PDVisibleSignDesigner properties)
                                  throws IOException

Description copied from interface: `PDFTemplateBuilder`
Creates SignatureRectangle.

Specified by:
  `createSignatureRectangle` in interface `PDFTemplateBuilder`
Parameters:
  `signatureField` - the signature field
  `properties` - properties
Throws:
  `IOException` - if something went wrong

#### createAffineTransform

    @Deprecated
    public void createAffineTransform(byte[] params)

Deprecated. use `createAffineTransform(java.awt.geom.AffineTransform)`
In order to create Affine Transform, using parameters.

Specified by:
  `createAffineTransform` in interface `PDFTemplateBuilder`
Parameters:
  `params` - parameter values

#### createAffineTransform

    public void createAffineTransform(AffineTransform affineTransform)

Description copied from interface: `PDFTemplateBuilder`
In order to create Affine Transform, using parameters.

Specified by:
  `createAffineTransform` in interface `PDFTemplateBuilder`
Parameters:
  `affineTransform` - the transformation

#### createProcSetArray

    public void createProcSetArray()

Description copied from interface: `PDFTemplateBuilder`
Creates procSetArray of PDF,Text,ImageB,ImageC,ImageI.

Specified by:
  `createProcSetArray` in interface `PDFTemplateBuilder`

#### createSignatureImage

    public void createSignatureImage(PDDocument template,
                                     BufferedImage image)
                              throws IOException

Description copied from interface: `PDFTemplateBuilder`
Creates signature image.

Specified by:
  `createSignatureImage` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document
  `image` - signature image
Throws:
  `IOException` - if something went wrong

#### createFormatterRectangle

    @Deprecated
    public void createFormatterRectangle(byte[] params)

Deprecated. use `createFormatterRectangle(int[])`
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.

Specified by:
  `createFormatterRectangle` in interface `PDFTemplateBuilder`
Parameters:
  `params` - parameters

#### createFormatterRectangle

    public void createFormatterRectangle(int[] params)

Description copied from interface: `PDFTemplateBuilder`
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.

Specified by:
  `createFormatterRectangle` in interface `PDFTemplateBuilder`
Parameters:
  `params` - parameters

#### createHolderFormStream

    public void createHolderFormStream(PDDocument template)

Specified by:
  `createHolderFormStream` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document

#### createHolderFormResources

    public void createHolderFormResources()

Description copied from interface: `PDFTemplateBuilder`
Creates resources of form

Specified by:
  `createHolderFormResources` in interface `PDFTemplateBuilder`

#### createHolderForm

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

Description copied from interface: `PDFTemplateBuilder`
Creates Form

Specified by:
  `createHolderForm` in interface `PDFTemplateBuilder`
Parameters:
  `holderFormResources` - holder form resources
  `holderFormStream` - holder stream
  `bbox` - bounding box

#### createAppearanceDictionary

    public void createAppearanceDictionary(PDFormXObject holderForm,
                                           PDSignatureField signatureField)
                                    throws IOException

Description copied from interface: `PDFTemplateBuilder`
Creates appearance dictionary

Specified by:
  `createAppearanceDictionary` in interface `PDFTemplateBuilder`
Parameters:
  `holderForm` - holder XObject
  `signatureField` - the signature field
Throws:
  `IOException` - if something went wrong

#### createInnerFormStream

    public void createInnerFormStream(PDDocument template)

Specified by:
  `createInnerFormStream` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document

#### createInnerFormResource

    public void createInnerFormResource()

Description copied from interface: `PDFTemplateBuilder`
Creates InnerForm

Specified by:
  `createInnerFormResource` in interface `PDFTemplateBuilder`

#### createInnerForm

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

Specified by:
  `createInnerForm` in interface `PDFTemplateBuilder`
Parameters:
  `innerFormResources` - inner form resources
  `innerFormStream` - inner form stream
  `bbox` - bounding box

#### insertInnerFormToHolderResources

    public void insertInnerFormToHolderResources(PDFormXObject innerForm,
                                                 PDResources holderFormResources)

Specified by:
  `insertInnerFormToHolderResources` in interface `PDFTemplateBuilder`
Parameters:
  `innerForm` - inner form XObject
  `holderFormResources` - holder form resources

#### createImageFormStream

    public void createImageFormStream(PDDocument template)

Specified by:
  `createImageFormStream` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document

#### createImageFormResources

    public void createImageFormResources()

Description copied from interface: `PDFTemplateBuilder`
Create resource of image form

Specified by:
  `createImageFormResources` in interface `PDFTemplateBuilder`

#### createImageForm

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

Description copied from interface: `PDFTemplateBuilder`
Creates Image form

Specified by:
  `createImageForm` in interface `PDFTemplateBuilder`
Parameters:
  `imageFormResources` - image form resources
  `innerFormResource` - inner form resources
  `imageFormStream` - image from stream
  `bbox` - bounding box
  `at` - transformation
  `img` - ImageXObject
Throws:
  `IOException` - if something went wrong

#### createBackgroundLayerForm

    public void createBackgroundLayerForm(PDResources innerFormResource,
                                          PDRectangle bbox)
                                   throws IOException

Description copied from interface: `PDFTemplateBuilder`
Creates the background layer form (n0).

Specified by:
  `createBackgroundLayerForm` in interface `PDFTemplateBuilder`
Parameters:
  `innerFormResource` - inner acroform resources
  `bbox` - rectangle of the formatter
Throws:
  `IOException` - if something went wrong

#### injectProcSetArray

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

Description copied from interface: `PDFTemplateBuilder`
Inject procSetArray

Specified by:
  `injectProcSetArray` in interface `PDFTemplateBuilder`
Parameters:
  `innerForm` - inner form
  `page` - the given page
  `innerFormResources` - inner form resources
  `imageFormResources` - image form resources
  `holderFormResources` - holder form resources
  `procSet` - procset values

#### injectAppearanceStreams

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

Description copied from interface: `PDFTemplateBuilder`
injects appearance streams

Specified by:
  `injectAppearanceStreams` in interface `PDFTemplateBuilder`
Parameters:
  `holderFormStream` - holder form stream
  `innerFormStream` - inner form stream
  `imageFormStream` - image form stream
  `imageFormName` - image form name
  `imageName` - image name
  `innerFormName` - inner form name
  `properties` - property values
Throws:
  `IOException` - if something went wrong

#### appendRawCommands

    public void appendRawCommands(OutputStream os,
                                  String commands)
                           throws IOException

Throws:
  `IOException`

#### createVisualSignature

    public void createVisualSignature(PDDocument template)

Description copied from interface: `PDFTemplateBuilder`
just to create visible signature

Specified by:
  `createVisualSignature` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document

#### createWidgetDictionary

    public void createWidgetDictionary(PDSignatureField signatureField,
                                       PDResources holderFormResources)
                                throws IOException

Description copied from interface: `PDFTemplateBuilder`
adds Widget Dictionary

Specified by:
  `createWidgetDictionary` in interface `PDFTemplateBuilder`
Parameters:
  `signatureField` - the signature field
  `holderFormResources` - holder form resources
Throws:
  `IOException` - if something went wrong

#### closeTemplate

    public void closeTemplate(PDDocument template)
                       throws IOException

Description copied from interface: `PDFTemplateBuilder`
Closes template

Specified by:
  `closeTemplate` in interface `PDFTemplateBuilder`
Parameters:
  `template` - template document
Throws:
  `IOException` - if something went wrong