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

## Class PDVisibleSignDesigner

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

    public class PDVisibleSignDesigner
    extends Object

Class for visible signature design properties. Setters use param() instead of setParam() to allow chaining.

Author:
  Vakhtang Koroghlishvili

### Constructor Summary

Constructors
Constructor and Description
`PDVisibleSignDesigner(InputStream imageStream)` Constructor usable for signing existing signature fields.
`PDVisibleSignDesigner(PDDocument document, BufferedImage image, int page)` Constructor.
`PDVisibleSignDesigner(PDDocument document, InputStream imageStream, int page)` Constructor.
`PDVisibleSignDesigner(org.apache.pdfbox.io.RandomAccessRead documentSource, BufferedImage image, int page)` Constructor.
`PDVisibleSignDesigner(org.apache.pdfbox.io.RandomAccessRead documentSource, InputStream imageStream, int page)` Constructor.
`PDVisibleSignDesigner(String filename, BufferedImage image, int page)` Constructor.
`PDVisibleSignDesigner(String filename, InputStream imageStream, int page)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`PDVisibleSignDesigner` `adjustForRotation()` Adjust signature for page rotation.
`PDVisibleSignDesigner` `coordinates(float x, float y)`
`PDVisibleSignDesigner` `formatterRectangleParameters(int[] formatterRectangleParameters)` Sets formatter PDRectangle
`int[]` `getFormatterRectangleParameters()`
`float` `getHeight()`
`BufferedImage` `getImage()`
`float` `getImageSizeInPercents()` get image size in percents
`float` `getPageHeight()`
`float` `getPageWidth()`
`String` `getSignatureFieldName()`
`String` `getSignatureText()` returns visible signature text
`protected float` `getTemplateHeight()`
`AffineTransform` `getTransform()`
`float` `getWidth()`
`float` `getxAxis()`
`float` `getyAxis()`
`PDVisibleSignDesigner` `height(float height)`
`void` `imageSizeInPercents(float imageSizeInPercents)`
`PDVisibleSignDesigner` `pageWidth(float pageWidth)`
`PDVisibleSignDesigner` `signatureFieldName(String signatureFieldName)`
`PDVisibleSignDesigner` `signatureImage(String path)` Set the image for the signature.
`PDVisibleSignDesigner` `signatureText(String signatureText)`
`PDVisibleSignDesigner` `transform(AffineTransform affineTransform)`
`PDVisibleSignDesigner` `width(float width)`
`PDVisibleSignDesigner` `xAxis(float xAxis)`
`PDVisibleSignDesigner` `yAxis(float yAxis)`
`PDVisibleSignDesigner` `zoom(float percent)` Zoom signature image with some percent.

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

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

### Constructor Detail

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(String filename,
                                 InputStream imageStream,
                                 int page)
                          throws IOException

Constructor.

Parameters:
  `filename` - Path of the PDF file
  `imageStream` - image as a stream
  `page` - The 1-based page number for which the page size should be calculated.
Throws:
  `IOException` - if the new instance of PDVisibleSignDesigner could not be created

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(org.apache.pdfbox.io.RandomAccessRead documentSource,
                                 InputStream imageStream,
                                 int page)
                          throws IOException

Constructor.

Parameters:
  `documentSource` - Original PDF document as RandomAccessRead
  `imageStream` - Image as a stream
  `page` - The 1-based page number for which the page size should be calculated.
Throws:
  `IOException` - if the new instance of PDVisibleSignDesigner could not be created

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(PDDocument document,
                                 InputStream imageStream,
                                 int page)
                          throws IOException

Constructor.

Parameters:
  `document` - Already created PDDocument of your PDF document.
  `imageStream` - Image as a stream.
  `page` - The 1-based page number for which the page size should be calculated.
Throws:
  `IOException` - If we can't read, flush, or can't close stream.

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(String filename,
                                 BufferedImage image,
                                 int page)
                          throws IOException

Constructor.

Parameters:
  `filename` - Path of the PDF file
  `image` - the image to be used for the visible signature
  `page` - The 1-based page number for which the page size should be calculated.
Throws:
  `IOException` - if the new instance of PDVisibleSignDesigner could not be created

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(org.apache.pdfbox.io.RandomAccessRead documentSource,
                                 BufferedImage image,
                                 int page)
                          throws IOException

Constructor.

Parameters:
  `documentSource` - Original PDF document as RandomAccessRead
  `image` - the image to be used for the visible signature
  `page` - The 1-based page number for which the page size should be calculated.
Throws:
  `IOException` - if the new instance of PDVisibleSignDesigner could not be created

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(PDDocument document,
                                 BufferedImage image,
                                 int page)

Constructor.

Parameters:
  `document` - Already created PDDocument of your PDF document.
  `image` - the image to be used for the visible signature
  `page` - The 1-based page number for which the page size should be calculated.

#### PDVisibleSignDesigner

    public PDVisibleSignDesigner(InputStream imageStream)
                          throws IOException

Constructor usable for signing existing signature fields.

Parameters:
  `imageStream` - image as a stream
Throws:
  `IOException` - if the new instance of PDVisibleSignDesigner could not be created

### Method Detail

#### adjustForRotation

    public PDVisibleSignDesigner adjustForRotation()

Adjust signature for page rotation. This is optional, call this after all x and y coordinates have been set if you want the signature to be positioned regardless of page orientation.

Returns:
  Visible Signature Configuration Object

#### signatureImage

    public PDVisibleSignDesigner signatureImage(String path)
                                         throws IOException

Set the image for the signature.

Parameters:
  `path` - Path of the image file.
Returns:
  Visible Signature Configuration Object
Throws:
  `IOException` - if the image for the signature could not be set

#### zoom

    public PDVisibleSignDesigner zoom(float percent)

Zoom signature image with some percent.

Parameters:
  `percent` - increase (positive value) or decrease (negative value) image with x percent.
Returns:
  Visible Signature Configuration Object

#### coordinates

    public PDVisibleSignDesigner coordinates(float x,
                                             float y)

Parameters:
  `x` - - x coordinate
  `y` - - y coordinate
Returns:
  Visible Signature Configuration Object

#### getxAxis

    public float getxAxis()

Returns:
  xAxis - gets x coordinates

#### xAxis

    public PDVisibleSignDesigner xAxis(float xAxis)

Parameters:
  `xAxis` - - x coordinate
Returns:
  Visible Signature Configuration Object

#### getyAxis

    public float getyAxis()

Returns:
  yAxis

#### yAxis

    public PDVisibleSignDesigner yAxis(float yAxis)

Parameters:
  `yAxis` - y coordinate
Returns:
  Visible Signature Configuration Object

#### getWidth

    public float getWidth()

Returns:
  signature image width

#### width

    public PDVisibleSignDesigner width(float width)

Parameters:
  `width` - signature image width
Returns:
  Visible Signature Configuration Object

#### getHeight

    public float getHeight()

Returns:
  signature image height

#### height

    public PDVisibleSignDesigner height(float height)

Parameters:
  `height` - signature image height
Returns:
  Visible Signature Configuration Object

#### getTemplateHeight

    protected float getTemplateHeight()

Returns:
  template height

#### getSignatureFieldName

    public String getSignatureFieldName()

Returns:
  signature field name

#### signatureFieldName

    public PDVisibleSignDesigner signatureFieldName(String signatureFieldName)

Parameters:
  `signatureFieldName` - the name of the signature field
Returns:
  Visible Signature Configuration Object

#### getImage

    public BufferedImage getImage()

Returns:
  image Image

#### getTransform

    public AffineTransform getTransform()

Returns:
  Affine Transform parameters for PDF Matrix

#### transform

    public PDVisibleSignDesigner transform(AffineTransform affineTransform)

Parameters:
  `affineTransform` - the affine transformation
Returns:
  Visible Signature Configuration Object

#### getFormatterRectangleParameters

    public int[] getFormatterRectangleParameters()

Returns:
  formatter PDRectangle parameters

#### formatterRectangleParameters

    public PDVisibleSignDesigner formatterRectangleParameters(int[] formatterRectangleParameters)

Sets formatter PDRectangle

Parameters:
  `formatterRectangleParameters` - rectangle parameter of the formatter
Returns:
  Visible Signature Configuration Object

#### getPageWidth

    public float getPageWidth()

Returns:
  page width

#### pageWidth

    public PDVisibleSignDesigner pageWidth(float pageWidth)

Parameters:
  `pageWidth` - pageWidth
Returns:
  Visible Signature Configuration Object

#### getPageHeight

    public float getPageHeight()

Returns:
  page height

#### getImageSizeInPercents

    public float getImageSizeInPercents()

get image size in percents

Returns:
  the image size in percent

#### imageSizeInPercents

    public void imageSizeInPercents(float imageSizeInPercents)

Parameters:
  `imageSizeInPercents` - image size in percents

#### getSignatureText

    public String getSignatureText()

returns visible signature text

Returns:
  the visible signature's text

#### signatureText

    public PDVisibleSignDesigner signatureText(String signatureText)

Parameters:
  `signatureText` - - adds the text on visible signature
Returns:
  the signature design