Package com.evopdf

# Class DigitalSignatureElement

java.lang.Object
com.evopdf.PageElement
com.evopdf.DigitalSignatureElement

public class DigitalSignatureElement extends PageElement
Represents a digital signature in the PDF document

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DigitalSignatureElement(byte[] pfxData, String pfxPassword, int certificateIndex)`
  Constructs a digital signature element that can be applied to a PDF document in the position where the last PDF element was rendered
  `DigitalSignatureElement(RectangleFloat bounds, byte[] pfxData, String pfxPassword, int certificateIndex)`
  Constructs a digital signature element that can be applied to a PDF page in the given position
  `DigitalSignatureElement(RectangleFloat bounds, String pfxFile, String pfxPassword, int certificateIndex)`
  * Constructs a digital signature element that can be applied to a PDF page in the given position
  `DigitalSignatureElement(String pfxFile, String pfxPassword, int certificateIndex)`
  Constructs a digital signature element that can be applied to a PDF document in the position where the last PDF element was rendered

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RectangleFloat`
  `bounds()`
  Gets the bounds of the rectangle where the certificate will be applied in PDF page
  `int`
  `certificateIndex()`
  Gets the certificate index in collection of certificates stored in PFX file
  `String`
  `contactInfo()`
  Gets the information provided by the signer to enable a recipient to contact the signer to verify the signature; for example, a phone number
  `String`
  `location()`
  Gets the CPU host name or physical location of the signing
  `byte[]`
  `pfxData()`
  Gets the binary data of a PFX file containing the certificate used for signing.
  `String`
  `pfxPassword()`
  Gets the password to access the PFX file
  `String`
  `reason()`
  Gets the reason for the signing
  `void`
  `setBounds(RectangleFloat bounds)`
  Sets the bounds of the rectangle where the certificate will be applied in PDF page.
  `void`
  `setCertificateIndex(int certificateIndex)`
  Sets the certificate index in collection of certificates stored in PFX file
  `void`
  `setContactInfo(String contactInfo)`
  Sets the information provided by the signer to enable a recipient to contact the signer to verify the signature; for example, a phone number
  `void`
  `setLocation(String location)`
  Sets the CPU host name or physical location of the signing
  `void`
  `setPfxData(byte[] pfxData)`
  Sets the binary data of a PFX file containing the certificate used for signing.
  `void`
  `setPfxPassword(String pfxPassword)`
  Sets the password to access the PFX file.
  `void`
  `setReason(String reason)`
  Sets the reason for the signing

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

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

- ## Constructor Details

  - ### DigitalSignatureElement

    public DigitalSignatureElement(String pfxFile, String pfxPassword, int certificateIndex) throws Exception
    Constructs a digital signature element that can be applied to a PDF document in the position where the last PDF element was rendered
    Parameters:
      `pfxFile` - the PFX file containing the certificate used for signing. The PFX file is expected to contain both the private and public key
      `pfxPassword` - the password to access the PFX file. It can be null or empty if no password is required
      `certificateIndex` - the certificate index in collection of certificates stored in PFX file. By default the first certificate in collection is used
    Throws:
      `Exception` - an exception is thrown if the PFX data cannot be read from file

  - ### DigitalSignatureElement

    public DigitalSignatureElement(RectangleFloat bounds, String pfxFile, String pfxPassword, int certificateIndex) throws Exception
    * Constructs a digital signature element that can be applied to a PDF page in the given position
    Parameters:
      `bounds` - the bounds of the rectangle where the certificate will be applied in PDF page
      `pfxFile` - the PFX file containing the certificate used for signing. The PFX file is expected to contain both the private and public key
      `pfxPassword` - the password to access the PFX file. It can be null or empty if no password is required
      `certificateIndex` - the certificate index in collection of certificates stored in PFX file. By default the first certificate in collection is used
    Throws:
      `Exception` - an exception is thrown if the PFX data cannot be read from file

  - ### DigitalSignatureElement

    public DigitalSignatureElement(byte[] pfxData, String pfxPassword, int certificateIndex)
    Constructs a digital signature element that can be applied to a PDF document in the position where the last PDF element was rendered
    Parameters:
      `pfxData` - the binary data of a PFX file containing the certificate used for signing. The PFX file is expected to contain both the private and public key
      `pfxPassword` - the password to access the PFX file. It can be null or empty if no password is required
      `certificateIndex` - the certificate index in collection of certificates stored in PFX file. By default the first certificate in collection is used

  - ### DigitalSignatureElement

    public DigitalSignatureElement(RectangleFloat bounds, byte[] pfxData, String pfxPassword, int certificateIndex)
    Constructs a digital signature element that can be applied to a PDF page in the given position
    Parameters:
      `bounds` - the bounds of the rectangle where the certificate will be applied in PDF page
      `pfxData` - the binary data of a PFX file containing the certificate used for signing. The PFX file is expected to contain both the private and public key
      `pfxPassword` - the password to access the PFX file. It can be null or empty if no password is required
      `certificateIndex` - the certificate index in collection of certificates stored in PFX file. By default the first certificate in collection is used

- ## Method Details

  - ### pfxData

    public byte[] pfxData()
    Gets the binary data of a PFX file containing the certificate used for signing.
    Returns:
      the binary data of a PFX file containing the certificate used for signing

  - ### setPfxData

    public void setPfxData(byte[] pfxData)
    Sets the binary data of a PFX file containing the certificate used for signing. The PFX file is expected to contain both the private and public key
    Parameters:
      `pfxData` - the binary data of a PFX file containing the certificate used for signing

  - ### bounds

    public RectangleFloat bounds()
    Gets the bounds of the rectangle where the certificate will be applied in PDF page
    Returns:
      the bounds of the rectangle where the certificate will be applied in PDF page

  - ### setBounds

    public void setBounds(RectangleFloat bounds)
    Sets the bounds of the rectangle where the certificate will be applied in PDF page. If the bounds is null the certificate will be applied in PDF document where the last PDF element was rendered
    Parameters:
      `bounds` - the bounds of the rectangle where the certificate will be applied in PDF page

  - ### pfxPassword

    public String pfxPassword()
    Gets the password to access the PFX file
    Returns:
      the password to access the PFX file

  - ### setPfxPassword

    public void setPfxPassword(String pfxPassword)
    Sets the password to access the PFX file. It can be null or empty if no password is required
    Parameters:
      `pfxPassword` - the password to access the PFX file

  - ### certificateIndex

    public int certificateIndex()
    Gets the certificate index in collection of certificates stored in PFX file
    Returns:
      the certificate index in collection of certificates stored in PFX file

  - ### setCertificateIndex

    public void setCertificateIndex(int certificateIndex)
    Sets the certificate index in collection of certificates stored in PFX file
    Parameters:
      `certificateIndex` - the certificate index in collection of certificates stored in PFX file

  - ### reason

    public String reason()
    Gets the reason for the signing
    Returns:
      the reason for the signing

  - ### setReason

    public void setReason(String reason)
    Sets the reason for the signing
    Parameters:
      `reason` - the reason for the signing

  - ### location

    public String location()
    Gets the CPU host name or physical location of the signing
    Returns:
      the CPU host name or physical location of the signing

  - ### setLocation

    public void setLocation(String location)
    Sets the CPU host name or physical location of the signing
    Parameters:
      `location` - the CPU host name or physical location of the signing

  - ### contactInfo

    public String contactInfo()
    Gets the information provided by the signer to enable a recipient to contact the signer to verify the signature; for example, a phone number
    Returns:
      the information provided by the signer

  - ### setContactInfo

    public void setContactInfo(String contactInfo)
    Sets the information provided by the signer to enable a recipient to contact the signer to verify the signature; for example, a phone number
    Parameters:
      `contactInfo` - the information provided by the signer