Class Document

java.lang.Object
com.winnovative_software.Document

public class Document extends Object
This class encapsulates a PDF document and can be used to create a new PDF document or to load an existing PDF document
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an empty PDF document object.
    Document(boolean useWebService, String webServiceUrl)
    Creates an empty PDF document object using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, byte[] pdfData)
    Creates a PDF document object from the specified PDF document data using a web service from a given URL
    Document(boolean useWebService, String webServiceUrl, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, ColorProfile colorProfile)
    Creates a PDF document with a color profile
    Document(boolean useWebService, String webServiceUrl, ColorSpace colorSpace)
    Creates a PDF document with the specified color space.
    Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset)
    Creates a PDF document based on the specified PDF standard using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
    Creates a PDF document based on the specified PDF standard and using the specified color space using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
    Creates a PDF document based on the specified PDF standard and using the specified color space and color profile using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, String pdfFilePath)
    Creates a PDF document from and existing PDF file using a web service from a given URL
    Document(boolean useWebService, String webServiceUrl, String servicePassword, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, String servicePassword, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
    Creates a PDF document based on the specified PDF standard and using the specified color space and color profile using a web service from a given URL.
    Document(boolean useWebService, String webServiceUrl, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file using a web service from a given URL
    Document(boolean useWebService, String webServiceUrl, String servicePassword, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file using a web service from a given URL
    Document(byte[] pdfData)
    Creates a PDF document object from the specified PDF document data
    Document(byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document.
    Document(int port)
    Creates an empty PDF document object.
    Document(int port, byte[] pdfData)
    Creates a PDF document object from the specified PDF document data
    Document(int port, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document.
    Document(int port, ColorProfile colorProfile)
    Creates a PDF document with a color profile
    Document(int port, ColorSpace colorSpace)
    Creates a PDF document with the specified color space.
    Document(int port, PdfStandardSubset pdfSubset)
    Creates a PDF document based on the specified PDF standard.
    Document(int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
    Creates a PDF document based on the specified PDF standard and using the specified color space.
    Document(int port, String pdfFilePath)
    Creates a PDF document from and existing PDF file
    Document(int port, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file
    Document(ColorProfile colorProfile)
    Creates a PDF document with a color profile
    Document(ColorSpace colorSpace)
    Creates a PDF document with the specified color space.
    Creates a PDF document based on the specified PDF standard.
    Document(PdfStandardSubset pdfSubset, ColorSpace colorSpace)
    Creates a PDF document based on the specified PDF standard and using the specified color space.
    Document(String pdfFilePath)
    Creates a PDF document from and existing PDF file
    Document(String server, byte[] pdfData)
    Creates a PDF document object from the specified PDF document data
    Document(String server, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document.
    Document(String server, int port)
    Creates an empty PDF document object.
    Document(String server, int port, byte[] pdfData)
    Creates a PDF document object from the specified PDF document data
    Document(String server, int port, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document.
    Document(String server, int port, ColorProfile colorProfile)
    Creates a PDF document with a color profile
    Document(String server, int port, ColorSpace colorSpace)
    Creates a PDF document with the specified color space.
    Document(String server, int port, PdfStandardSubset pdfSubset)
    Creates a PDF document based on the specified PDF standard.
    Document(String server, int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
    Creates a PDF document based on the specified PDF standard and using the specified color space.
    Document(String server, int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
    Creates a PDF document based on the specified PDF standard and using the specified color space and color profile.
    Document(String server, int port, String pdfFilePath)
    Creates a PDF document from and existing PDF file
    Document(String server, int port, String servicePassword, byte[] pdfData, String password)
    Creates a PDF document from binary data containing a password protected PDF document.
    Document(String server, int port, String servicePassword, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
    Creates a PDF document based on the specified PDF standard and using the specified color space and color profile.
    Document(String server, int port, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file
    Document(String server, int port, String servicePassword, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file
    Document(String server, ColorProfile colorProfile)
    Creates a PDF document with a color profile
    Document(String server, ColorSpace colorSpace)
    Creates a PDF document with the specified color space.
    Document(String server, PdfStandardSubset pdfSubset)
    Creates a PDF document based on the specified PDF standard.
    Document(String server, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
    Creates a PDF document based on the specified PDF standard and using the specified color space.
    Document(String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file
    Document(String server, String pdfFilePath, String password)
    Creates a PDF document object from an existing password protected PDF file
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a top level bookmark to PDF document
    void
    addBookmark(Bookmark bookmark, Bookmark parentBookmark)
    Adds a child bookmark to PDF document having a previously added bookmark as parent
    void
    addElement(PageElement pageElement)
    Adds a PDF page element to this document right after the last PDF element added to document or to a page
    void
    addElement(PageElement pageElement, float offsetY)
    Adds a PDF page element to this document at the given Y offset after the last PDF element added to document or to a page
    void
    addElement(PageElement pageElement, float xLocation, boolean relativeXLocation, boolean offsetXFromStart, float yLocation, boolean relativeYLocation, boolean offsetYFromEnd)
    Adds a PDF page element to this document at the given X and Y location in the PDF page where the last element rendering ended.
    void
    addElement(PageElement pageElement, float xLocation, boolean relativeXLocation, float yLocation, boolean relativeYLocation)
    Adds a PDF page element to this document at the given X and Y location in the PDF page where the last element rendering ended.
    void
    addElement(PageElement pageElement, float offsetX, float offsetY)
    Adds a PDF page element to this document at the given X offset and the given Y offset after the last PDF element added to document or to a page
    void
    addFileAttachment(byte[] fileData, String attachmentName)
    Adds an attachment with the given name from binary data to this PDF document
    void
    addFileAttachment(byte[] fileData, String attachmentName, String descr)
    Adds an attachment with the given name and a given description from binary data to this PDF document
    void
    Adds an attachment a given file to this PDF document
    void
    addFileAttachment(String filePath, String descr)
    Adds an attachment a given file and given description to this PDF document
    addFooterTemplate(float height)
    Adds a footer with the given height to document
    void
    Adds a form field to this document right after the last PDF element added to document or to a page
    void
    addFormField(PdfFormField formField, float offsetY)
    Adds a form field to this document at the given Y offset after the last PDF element added to document or to a page
    void
    addFormField(PdfFormField formField, float xLocation, boolean relativeXLocation, boolean offsetXFromStart, float yLocation, boolean relativeYLocation, boolean offsetYFromEnd)
    Adds a form field to this document at the given X and Y location in the PDF page where the last element rendering ended.
    void
    addFormField(PdfFormField formField, float xLocation, boolean relativeXLocation, float yLocation, boolean relativeYLocation)
    Adds a form field to this document at the given X and Y location in the PDF page where the last element rendering ended.
    void
    addFormField(PdfFormField formField, float offsetX, float offsetY)
    Adds a form field to this document at the given X offset and the given Y offset after the last PDF element added to document or to a page
    addHeaderTemplate(float height)
    Adds a header with the given height to document
    Creates a new PDF page and adds it to the collection.
    addPage(PdfMargins pageMargins)
    Creates a new PDF page and adds it to the collection.
    addPage(PdfPageSize pageSize, PdfMargins pageMargins)
    Creates a new PDF page and adds it to the collection.
    addPage(PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation)
    Creates a new PDF page with the specified size, margins and orientation and adds it to the collection
    addPage(PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation, RotationAngle pageRotation)
    Creates a new PDF page with the specified size, margins and orientation and adds it to the collection
    addTemplate(float width, float height)
    Adds a new template with the specified width and height to the document templates collection.
    addTemplate(float x, float y, float width, float height)
    Adds a new template with the specified bounds to the document templates collection
    void
    appendDocument(byte[] pdfData)
    Appends the PDF document given as parameter to the current document
    void
    appendDocument(byte[] pdfData, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Appends the PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    appendDocument(byte[] pdfData, String password)
    Appends the password protected PDF document given as parameter to the current document
    void
    appendDocument(byte[] pdfData, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Appends the password protected PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    appendDocument(String pdfFilePath)
    Appends the PDF file given as parameter to this document
    void
    appendDocument(String pdfFilePath, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Appends the PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    appendDocument(String pdfFilePath, String password)
    Appends the password protected PDF file given as parameter to this document
    void
    appendDocument(String pdfFilePath, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Appends the password protected PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    Gets the java.net.Proxy object to be used when accessing the PDF Document Web Service through a proxy server.
    boolean
    Gets the flag indicating if the PDF cross-reference table and PDF trailer are compressed to reduce the PDF file size
    Gets the PDF document compression level
    Offers access to the document information object where the document's title, subject, keywords, etc can be set
    Represents the default PDF document footer template.
    Gets a reference to the PDF form of this PDF document
    getPage(int index)
    Gets the PDF page from the given index or null if the index is out of bounds
    Represents the default PDF document header template.
    int
    Gets the index of a PDF page in pages collection
    void
    insertDocument(int insertIndex, byte[] pdfData)
    Inserts the PDF document given as parameter in the current document at the given page index
    void
    insertDocument(int insertIndex, byte[] pdfData, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Inserts the PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    insertDocument(int insertIndex, byte[] pdfData, String password)
    Inserts the password protected PDF document given as parameter in the current document at the given page index
    void
    insertDocument(int insertIndex, byte[] pdfData, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Inserts the password protected PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    insertDocument(int insertIndex, String pdfFilePath)
    Inserts the PDF file given as parameter in the current document at the given page index
    void
    insertDocument(int insertIndex, String pdfFilePath, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Inserts the PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    void
    insertDocument(int insertIndex, String pdfFilePath, String password)
    Inserts the password protected PDF file given as parameter in the current document at the given page index
    void
    insertDocument(int insertIndex, String pdfFilePath, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage)
    Inserts the password protected PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
    insertPage(int index, PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation)
    Creates a new PDF page with the specified size, margins and orientation and inserts it into the collection at the specified index
    insertPage(int index, PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation, RotationAngle pageRotation)
    Creates a new PDF page with the specified size, margins and orientation and inserts it into the collection at the specified index
    boolean
    Gets a flag indicating if the JPEG compression is enabled or not for the images in the generated PDF
    int
    Gets the compression level of images in the generated PDF as an integer value between 0 and 100
    Gets the current license key
    Gets the default document margins.
    Gets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is opened
    int
    Gets the HTML to PDF server port number
    byte[]
    Saves the PDF document as byte array that can be further saved into a file or sent over HTTP to a browser
    void
    save(String pdfFilePath)
    Saves this PDF document into the file given by the method parameter
    Offers access to security options of the PDF document like encryption
    Gets the HTML to PDF server IP or name
    Gets the current HTML to PDF converter service password
    void
    setClientProxy(Proxy clientProxy)
    Sets the java.net.Proxy object to be used when accessing the PDF Document Web Service through a proxy server.
    void
    setCompressCrossReference(boolean compressCrossReference)
    Set this property on true to store the PDF cross-reference table and PDF trailer in compressed cross-reference streams and to reduce the PDF file size.
    void
    Sets the PDF document compression level.
    void
    setJpegCompressionEnabled(boolean jpegCompressionEnabled)
    Sets a flag indicating if the JPEG compression is enabled or not for the images in the generated PDF.
    void
    setJpegCompressionLevel(int jpegCompressionLevel)
    Sets the compression level of images in the generated PDF as an integer value between 0 and 100.
    void
    setLicenseKey(String licenseKey)
    Sets the license key string received from the vendor.
    void
    Sets the default document margins.
    void
    Sets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is opened
    void
    setPort(int port)
    Sets the HTML to PDF server port number
    void
    setServer(String server)
    Sets the HTML to PDF server IP or name
    void
    setServicePassword(String servicePassword)
    Sets the HTML to PDF converter service password.
    void
    setTransparencyEnabled(boolean transparencyEnabled)
    Sets a flag indicating if the transparency is enabled in the PDF document.
    void
    setUseWebService(boolean useWebService)
    Sets the flag indicating if the client library will call the Web service or the TCP service to create the PDF document
    void
    setWebServiceUrl(String webServiceUrl)
    Sets the web service URL
    Gets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document based on HtmlToPdfElement and HtmlToImageElement objects added to PDF document
    boolean
    Gets a flag indicating if the transparency is enabled in the PDF document
    boolean
    Gets the flag indicating if the client library will call the Web service or the TCP service to create the PDF document
    Offers access to the viewer preferences settings for the document.
    Gets the web service URL

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Document

      public Document()
      Creates an empty PDF document object. New pages can be added to the document and new PDF elements can be added to document pages
    • Document

      public Document(int port)
      Creates an empty PDF document object. New pages can be added to the document and new PDF elements can be added to document pages
      Parameters:
      port - he HTML to PDF server port number on host
    • Document

      public Document(String server, int port)
      Creates an empty PDF document object. New pages can be added to the document and new PDF elements can be added to document pages
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
    • Document

      public Document(boolean useWebService, String webServiceUrl)
      Creates an empty PDF document object using a web service from a given URL. New pages can be added to the document and new PDF elements can be added to document pages
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
    • Document

      public Document(PdfStandardSubset pdfSubset)
      Creates a PDF document based on the specified PDF standard. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents.
      Parameters:
      pdfSubset - the PDF standard used to create the PDF document
    • Document

      public Document(String server, PdfStandardSubset pdfSubset)
      Creates a PDF document based on the specified PDF standard. By default the Full PDF standard is used. his property can be used to create PDF/A or PDF/X compliant documents.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      pdfSubset - the PDF standard used to create the PDF document
    • Document

      public Document(int port, PdfStandardSubset pdfSubset)
      Creates a PDF document based on the specified PDF standard. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents
      Parameters:
      port - the HTML to PDF server port number on host
      pdfSubset - the PDF standard used to create the PDF document
    • Document

      public Document(String server, int port, PdfStandardSubset pdfSubset)
      Creates a PDF document based on the specified PDF standard. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents
      Parameters:
      server - The IP address or host name of the HTML to PDF server
      port - The HTML to PDF server port number on host
      pdfSubset - The PDF standard used to create the PDF document
    • Document

      public Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset)
      Creates a PDF document based on the specified PDF standard using a web service from a given URL. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfSubset - The PDF standard used to create the PDF document
    • Document

      public Document(ColorSpace colorSpace)
      Creates a PDF document with the specified color space. This property can be used to create PDF documents in RGB, Grayscale or CMYK color spaces. By default the document uses the RGB color space
      Parameters:
      colorSpace - the color space of the document
    • Document

      public Document(String server, ColorSpace colorSpace)
      Creates a PDF document with the specified color space. This property can be used to create PDF documents in RGB, Grayscale or CMYK color spaces. By default the document uses the RGB color space
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      colorSpace - the color space of the document
    • Document

      public Document(int port, ColorSpace colorSpace)
      Creates a PDF document with the specified color space. This property can be used to create PDF documents in RGB, Grayscale or CMYK color spaces. By default the document uses the RGB color space
      Parameters:
      port - the HTML to PDF server port number on host
      colorSpace - the color space of the document
    • Document

      public Document(String server, int port, ColorSpace colorSpace)
      Creates a PDF document with the specified color space. This property can be used to create PDF documents in RGB, Grayscale or CMYK color spaces. By default the document uses the RGB color space
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      colorSpace - the color space of the document
    • Document

      public Document(boolean useWebService, String webServiceUrl, ColorSpace colorSpace)
      Creates a PDF document with the specified color space. This property can be used to create PDF documents in RGB, Grayscale or CMYK color spaces using a web service from a given URL. By default the document uses the RGB color space
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      colorSpace - the color space of the document
    • Document

      public Document(ColorProfile colorProfile)
      Creates a PDF document with a color profile
      Parameters:
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(String server, ColorProfile colorProfile)
      Creates a PDF document with a color profile
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(int port, ColorProfile colorProfile)
      Creates a PDF document with a color profile
      Parameters:
      port - the HTML to PDF server port number on host
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(String server, int port, ColorProfile colorProfile)
      Creates a PDF document with a color profile
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(boolean useWebService, String webServiceUrl, ColorProfile colorProfile)
      Creates a PDF document with a color profile
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(PdfStandardSubset pdfSubset, ColorSpace colorSpace)
      Creates a PDF document based on the specified PDF standard and using the specified color space. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space
      Parameters:
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
    • Document

      public Document(String server, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
      Creates a PDF document based on the specified PDF standard and using the specified color space. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
    • Document

      public Document(int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
      Creates a PDF document based on the specified PDF standard and using the specified color space. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space
      Parameters:
      port - the HTML to PDF server port number on host
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
    • Document

      public Document(String server, int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
      Creates a PDF document based on the specified PDF standard and using the specified color space. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
    • Document

      public Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset, ColorSpace colorSpace)
      Creates a PDF document based on the specified PDF standard and using the specified color space using a web service from a given URL. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
    • Document

      public Document(String server, int port, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
      Creates a PDF document based on the specified PDF standard and using the specified color space and color profile. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(boolean useWebService, String webServiceUrl, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
      Creates a PDF document based on the specified PDF standard and using the specified color space and color profile using a web service from a given URL. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(String server, int port, String servicePassword, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
      Creates a PDF document based on the specified PDF standard and using the specified color space and color profile. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      servicePassword - the service password
      port - the HTML to PDF server port number on host
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(boolean useWebService, String webServiceUrl, String servicePassword, PdfStandardSubset pdfSubset, ColorSpace colorSpace, ColorProfile colorProfile)
      Creates a PDF document based on the specified PDF standard and using the specified color space and color profile using a web service from a given URL. By default the Full PDF standard is used. This property can be used to create PDF/A or PDF/X compliant documents using the specified color space.
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      servicePassword - the service password
      pdfSubset - the PDF standard used to create the PDF document
      colorSpace - the color space of the document
      colorProfile - the color profile to be used when creating the PDF document
    • Document

      public Document(byte[] pdfData) throws Exception
      Creates a PDF document object from the specified PDF document data
      Parameters:
      pdfData - the PDF document data
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, byte[] pdfData) throws Exception
      Creates a PDF document object from the specified PDF document data
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      pdfData - the PDF document data
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(int port, byte[] pdfData) throws Exception
      Creates a PDF document object from the specified PDF document data
      Parameters:
      port - The HTML to PDF server port number on host
      pdfData - The PDF document data
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, byte[] pdfData) throws Exception
      Creates a PDF document object from the specified PDF document data
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      pdfData - the PDF document data
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, byte[] pdfData) throws Exception
      Creates a PDF document object from the specified PDF document data using a web service from a given URL
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfData - the PDF document data
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String pdfFilePath) throws Exception
      Creates a PDF document from and existing PDF file
      Parameters:
      pdfFilePath - the full path of an existing PDF document file
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(int port, String pdfFilePath) throws Exception
      Creates a PDF document from and existing PDF file
      Parameters:
      port - the HTML to PDF server port number on host
      pdfFilePath - the full path of an existing PDF document file
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, String pdfFilePath) throws Exception
      Creates a PDF document from and existing PDF file
      Parameters:
      server - The IP address or host name of the HTML to PDF server
      port - The HTML to PDF server port number on host
      pdfFilePath - The full path of an existing PDF document file
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, String pdfFilePath) throws Exception
      Creates a PDF document from and existing PDF file using a web service from a given URL
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfFilePath - The full path of an existing PDF document file
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document.
      Parameters:
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document. The specified password can be a user or owner password.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(int port, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document. The specified password can be a user or owner password.
      Parameters:
      port - the HTML to PDF server port number on host
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document. The specified password can be a user or owner password.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document using a web service from a given URL. The specified password can be a user or owner password.
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, String servicePassword, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document. The specified password can be a user or owner password.
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on host
      servicePassword - the service password
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, String servicePassword, byte[] pdfData, String password) throws Exception
      Creates a PDF document from binary data containing a password protected PDF document using a web service from a given URL. The specified password can be a user or owner password.
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      servicePassword - the service password
      pdfData - the PDF document data
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file
      Parameters:
      pdfFilePath - the full path to the PDF file
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      pdfFilePath - the full path to the PDF file
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(int port, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file
      Parameters:
      port - the HTML to PDF server port number on host
      pdfFilePath - the full path to the PDF file
      password - the password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file
      Parameters:
      server - The IP address or host name of the HTML to PDF server
      port - The HTML to PDF server port number on host
      pdfFilePath - The full path to the PDF file
      password - The password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file using a web service from a given URL
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      pdfFilePath - The full path to the PDF file
      password - The password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(String server, int port, String servicePassword, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file
      Parameters:
      server - The IP address or host name of the HTML to PDF server
      port - The HTML to PDF server port number on host
      servicePassword - The service password
      pdfFilePath - The full path to the PDF file
      password - The password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
    • Document

      public Document(boolean useWebService, String webServiceUrl, String servicePassword, String pdfFilePath, String password) throws Exception
      Creates a PDF document object from an existing password protected PDF file using a web service from a given URL
      Parameters:
      useWebService - a flag indicating if the converter will use the web service URL or the TCP server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
      servicePassword - The service password
      pdfFilePath - The full path to the PDF file
      password - The password to open the specified PDF document
      Throws:
      Exception - throws an exception if the document cannot be created
  • Method Details

    • server

      public String server()
      Gets the HTML to PDF server IP or name
      Returns:
      the HTML to PDF server IP or name
    • setServer

      public void setServer(String server)
      Sets the HTML to PDF server IP or name
      Parameters:
      server - the HTML to PDF server IP or name to set
    • port

      public int port()
      Gets the HTML to PDF server port number
      Returns:
      the HTML to PDF server port number
    • setPort

      public void setPort(int port)
      Sets the HTML to PDF server port number
      Parameters:
      port - the HTML to PDF server port number to set
    • webServiceUrl

      public String webServiceUrl()
      Gets the web service URL
      Returns:
      the web service URL
    • setWebServiceUrl

      public void setWebServiceUrl(String webServiceUrl)
      Sets the web service URL
      Parameters:
      webServiceUrl - the web service URL
    • useWebService

      public boolean useWebService()
      Gets the flag indicating if the client library will call the Web service or the TCP service to create the PDF document
      Returns:
      the use web service option
    • setUseWebService

      public void setUseWebService(boolean useWebService)
      Sets the flag indicating if the client library will call the Web service or the TCP service to create the PDF document
      Parameters:
      useWebService - the use web service option
    • clientProxy

      public Proxy clientProxy()
      Gets the java.net.Proxy object to be used when accessing the PDF Document Web Service through a proxy server.
      Returns:
      java.net.Proxy object to be used to establish connection with the server
    • setClientProxy

      public void setClientProxy(Proxy clientProxy)
      Sets the java.net.Proxy object to be used when accessing the PDF Document Web Service through a proxy server. This property does not have any effect when using a TCP Service
      Parameters:
      clientProxy - the java.net.Proxy object to be used to establish connection with the server
    • licenseKey

      public String licenseKey()
      Gets the current license key
      Returns:
      the current license key
    • setLicenseKey

      public void setLicenseKey(String licenseKey)
      Sets the license key string received from the vendor. If this property is null the library will automatically enter in evaluation mode and a demo watermark will be displayed on the generated PDF document.
      Parameters:
      licenseKey - the current license key
    • servicePassword

      public String servicePassword()
      Gets the current HTML to PDF converter service password
      Returns:
      the current HTML to PDF converter service password
    • setServicePassword

      public void setServicePassword(String servicePassword)
      Sets the HTML to PDF converter service password. You have to set this property if the HTML to PDF service is password protected
      Parameters:
      servicePassword - the current service password
    • save

      public void save(String pdfFilePath) throws Exception
      Saves this PDF document into the file given by the method parameter
      Parameters:
      pdfFilePath - The name of the file where to save the document. It can be a full path or a relative path
      Throws:
      Exception - an exception is thrown if the generated PDF cannot be saved in a file
    • save

      public byte[] save() throws Exception
      Saves the PDF document as byte array that can be further saved into a file or sent over HTTP to a browser
      Returns:
      the PDF document data
      Throws:
      Exception - throws an exception if the PDF cannot be created
    • margins

      public PdfMargins margins()
      Gets the default document margins. The new pages will use the default margins if no margins are specified
      Returns:
      the default document margins
    • setMargins

      public void setMargins(PdfMargins margins)
      Sets the default document margins. The new pages will use the default margins if no margins are specified
      Parameters:
      margins - the default document margins to set
    • header

      public Template header()
      Represents the default PDF document header template. This header is automatically considered when calculating the available space for drawing in a PDF page. This template is automatically docked to the top of the PDF page. You can add a document footer with addHeaderTemplate(float) method
      Returns:
      the document header template
    • footer

      public Template footer()
      Represents the default PDF document footer template. This footer is automatically considered when calculating the available space for drawing in a PDF page. This template is automatically docked to the bottom of the PDF page. You can add a document footer with addFooterTemplate(float) method
      Returns:
      the document footer template
    • addHeaderTemplate

      public Template addHeaderTemplate(float height)
      Adds a header with the given height to document
      Parameters:
      height - the header height
      Returns:
      the newly added header template
    • addFooterTemplate

      public Template addFooterTemplate(float height)
      Adds a footer with the given height to document
      Parameters:
      height - the footer height
      Returns:
      the newly added footer template
    • addTemplate

      public Template addTemplate(float width, float height)
      Adds a new template with the specified width and height to the document templates collection. The template location is top left corner of the page
      Parameters:
      width - the template width
      height - the template height
      Returns:
      the newly added template
    • addTemplate

      public Template addTemplate(float x, float y, float width, float height)
      Adds a new template with the specified bounds to the document templates collection
      Parameters:
      x - The top left corner X coordinate of the template in PDF pages
      y - The top left corner Y- coordinate of the template in PDF pages
      width - the template width
      height - the template height
      Returns:
      the newly added template
    • addFileAttachment

      public void addFileAttachment(String filePath) throws Exception
      Adds an attachment a given file to this PDF document
      Parameters:
      filePath - The path to file to be attached
      Throws:
      Exception - an exception is thrown if the attachment cannot be added
    • addFileAttachment

      public void addFileAttachment(String filePath, String descr) throws Exception
      Adds an attachment a given file and given description to this PDF document
      Parameters:
      filePath - the path to file to be attached
      descr - the attachment description
      Throws:
      Exception - an exception is thrown if the attachment cannot be created
    • addFileAttachment

      public void addFileAttachment(byte[] fileData, String attachmentName)
      Adds an attachment with the given name from binary data to this PDF document
      Parameters:
      fileData - the file data
      attachmentName - a name for attachment
    • addFileAttachment

      public void addFileAttachment(byte[] fileData, String attachmentName, String descr)
      Adds an attachment with the given name and a given description from binary data to this PDF document
      Parameters:
      fileData - the file data
      attachmentName - a name for attachment
      descr - the attachment description
    • addPage

      public PdfPage addPage()
      Creates a new PDF page and adds it to the collection. If there is a previous page in the collection, the orientation and size are inherited from the that page otherwise a first page with the default A4 size and Portrait orientation is created. The page margins are inherited from the default document margins
      Returns:
      the newly created PDF page
    • addPage

      public PdfPage addPage(PdfMargins pageMargins)
      Creates a new PDF page and adds it to the collection. If there is a previous page in the collection, the orientation and size are inherited from the that page otherwise a first page with the default A4 size and Portrait orientation is created
      Parameters:
      pageMargins - the PDF page margins
      Returns:
      the newly created PDF page
    • addPage

      public PdfPage addPage(PdfPageSize pageSize, PdfMargins pageMargins)
      Creates a new PDF page and adds it to the collection. If there is a previous page in the collection, the page orientation is inherited from the that page otherwise a first page with the specified size and Portrait orientation is created
      Parameters:
      pageSize - the page size in points
      pageMargins - the page margins in points
      Returns:
      the newly created PDF page
    • addPage

      public PdfPage addPage(PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation)
      Creates a new PDF page with the specified size, margins and orientation and adds it to the collection
      Parameters:
      pageSize - the PDF page size in points
      pageMargins - the PDF page margins in points
      pageOrientation - the PDF page orientation
      Returns:
      the newly created PDF page
    • addPage

      public PdfPage addPage(PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation, RotationAngle pageRotation)
      Creates a new PDF page with the specified size, margins and orientation and adds it to the collection
      Parameters:
      pageSize - the PDF page size in points
      pageMargins - the PDF page margins in points
      pageOrientation - the PDF page orientation
      pageRotation - the PDF page rotation
      Returns:
      the newly created PDF page
    • insertPage

      public PdfPage insertPage(int index, PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation)
      Creates a new PDF page with the specified size, margins and orientation and inserts it into the collection at the specified index
      Parameters:
      index - the index where to insert the new page
      pageSize - the PDF page size in points
      pageMargins - the PDF page margins in points
      pageOrientation - the PDF page orientation
      Returns:
      the newly created PDF page
    • insertPage

      public PdfPage insertPage(int index, PdfPageSize pageSize, PdfMargins pageMargins, PdfPageOrientation pageOrientation, RotationAngle pageRotation)
      Creates a new PDF page with the specified size, margins and orientation and inserts it into the collection at the specified index
      Parameters:
      index - The index where to insert the new page
      pageSize - The PDF page size in points
      pageMargins - The PDF page margins in points
      pageOrientation - The PDF page orientation
      pageRotation - The PDF page rotation
      Returns:
      The newly created PDF page
    • getPage

      public PdfPage getPage(int index)
      Gets the PDF page from the given index or null if the index is out of bounds
      Parameters:
      index - The index of the PDF page to retrieve
      Returns:
      The PDF page from the given index or null if the index is out of bounds
    • indexOfPage

      public int indexOfPage(PdfPage pdfPage)
      Gets the index of a PDF page in pages collection
      Parameters:
      pdfPage - The PDF page to search
      Returns:
      The page index or a negative value if the page does not exist in collection
    • addElement

      public void addElement(PageElement pageElement)
      Adds a PDF page element to this document right after the last PDF element added to document or to a page
      Parameters:
      pageElement - the page element to be added
    • addElement

      public void addElement(PageElement pageElement, float offsetY)
      Adds a PDF page element to this document at the given Y offset after the last PDF element added to document or to a page
      Parameters:
      pageElement - the page element to be added
      offsetY - the Y offset after the last PDF element added to document
    • addElement

      public void addElement(PageElement pageElement, float offsetX, float offsetY)
      Adds a PDF page element to this document at the given X offset and the given Y offset after the last PDF element added to document or to a page
      Parameters:
      pageElement - the page element to be added
      offsetX - the X offset from the last PDF element added to document
      offsetY - the Y offset from the last PDF element added to document
    • addElement

      public void addElement(PageElement pageElement, float xLocation, boolean relativeXLocation, float yLocation, boolean relativeYLocation)
      Adds a PDF page element to this document at the given X and Y location in the PDF page where the last element rendering ended. The location can be absolute in PDF page or relative as an offset from the position where the last element rendering ended
      Parameters:
      pageElement - The page element to be added
      xLocation - The X location of the element in the PDF page where the last element rendering ended
      relativeXLocation - The X location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      yLocation - The Y location of the element in the PDF page where the last element rendering ended
      relativeYLocation - The Y location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
    • addElement

      public void addElement(PageElement pageElement, float xLocation, boolean relativeXLocation, boolean offsetXFromStart, float yLocation, boolean relativeYLocation, boolean offsetYFromEnd)
      Adds a PDF page element to this document at the given X and Y location in the PDF page where the last element rendering ended. The location can be absolute in PDF page or relative as an offset from the position where the last element rendering ended
      Parameters:
      pageElement - the page element to be added
      xLocation - the X location of the element in the PDF page where the last element rendering ended
      relativeXLocation - the X location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      offsetXFromStart - specifies if the the relative X location is calculated from the start X coordinate of last rendered element or from the end X coordinate
      yLocation - the Y location of the element in the PDF page where the last element rendering ended
      relativeYLocation - the Y location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      offsetYFromEnd - specifies if the the relative Y location is calculated from the end Y coordinate of last rendered element or from the start Y coordinate
    • addFormField

      public void addFormField(PdfFormField formField)
      Adds a form field to this document right after the last PDF element added to document or to a page
      Parameters:
      formField - the form field to add
    • addFormField

      public void addFormField(PdfFormField formField, float offsetY)
      Adds a form field to this document at the given Y offset after the last PDF element added to document or to a page
      Parameters:
      formField - the form field to add
      offsetY - the Y offset from the last PDF element added to document
    • addFormField

      public void addFormField(PdfFormField formField, float offsetX, float offsetY)
      Adds a form field to this document at the given X offset and the given Y offset after the last PDF element added to document or to a page
      Parameters:
      formField - the form field to add
      offsetX - the X offset from the last PDF element added to document
      offsetY - the Y offset from the last PDF element added to document
    • addFormField

      public void addFormField(PdfFormField formField, float xLocation, boolean relativeXLocation, float yLocation, boolean relativeYLocation)
      Adds a form field to this document at the given X and Y location in the PDF page where the last element rendering ended. The location can be absolute in PDF page or relative as an offset from the position where the last element rendering ended
      Parameters:
      formField - the form field to be added
      xLocation - the X location of the element in the PDF page where the last element rendering ended
      relativeXLocation - the X location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      yLocation - the Y location of the element in the PDF page where the last element rendering ended
      relativeYLocation - the Y location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
    • addFormField

      public void addFormField(PdfFormField formField, float xLocation, boolean relativeXLocation, boolean offsetXFromStart, float yLocation, boolean relativeYLocation, boolean offsetYFromEnd)
      Adds a form field to this document at the given X and Y location in the PDF page where the last element rendering ended. The location can be absolute in PDF page or relative as an offset from the position where the last element rendering ended
      Parameters:
      formField - the form field to be added
      xLocation - the X location of the element in the PDF page where the last element rendering ended
      relativeXLocation - the X location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      offsetXFromStart - specifies if the the relative X location is calculated from the start X coordinate of last rendered element or from the end X coordinate
      yLocation - the Y location of the element in the PDF page where the last element rendering ended
      relativeYLocation - the Y location can be relative to the position where the last element rendering ended or absolute in PDF page where the last element rendering ended
      offsetYFromEnd - specifies if the the relative Y location is calculated from the end Y coordinate of last rendered element or from the start Y coordinate
    • appendDocument

      public void appendDocument(String pdfFilePath) throws Exception
      Appends the PDF file given as parameter to this document
      Parameters:
      pdfFilePath - the PDF document to append full path
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(String pdfFilePath, String password) throws Exception
      Appends the password protected PDF file given as parameter to this document
      Parameters:
      pdfFilePath - the PDF document to append full path
      password - the password to open the appended PDF document
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(String pdfFilePath, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Appends the PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      pdfFilePath - appended document pages
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the appended document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the appended document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the appended document
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(String pdfFilePath, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Appends the password protected PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      pdfFilePath - The PDF document full path
      password - The password to open the appended PDF document
      enableHeaderAndFooter - A flag indicating if the header and footer of the current document are also applied to the appended document pages
      drawHeaderOnFirstPage - A flag indicating if the header is drawn on first page of the appended document
      drawFooterOnFirstPage - A flag indicating if the footer is drawn on first page of the appended document
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • insertDocument

      public void insertDocument(int insertIndex, String pdfFilePath) throws Exception
      Inserts the PDF file given as parameter in the current document at the given page index
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfFilePath - the PDF document full path
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, String pdfFilePath, String password) throws Exception
      Inserts the password protected PDF file given as parameter in the current document at the given page index
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfFilePath - the PDF document full path
      password - the password to open the inserted PDF document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, String pdfFilePath, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Inserts the PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      insertIndex - The page index where to start insertion in this document
      pdfFilePath - The PDF document full path
      enableHeaderAndFooter - A flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - A flag indicating if the header is drawn on first page of the inserted document
      drawFooterOnFirstPage - A flag indicating if the footer is drawn on first page of the inserted document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, String pdfFilePath, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Inserts the password protected PDF file given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfFilePath - the PDF document full path
      password - the password to open the inserted PDF document
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the inserted document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the inserted document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • appendDocument

      public void appendDocument(byte[] pdfData) throws Exception
      Appends the PDF document given as parameter to the current document
      Parameters:
      pdfData - the PDF document data
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(byte[] pdfData, String password) throws Exception
      Appends the password protected PDF document given as parameter to the current document
      Parameters:
      pdfData - the PDF document data
      password - the password to open the appended PDF document
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(byte[] pdfData, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Appends the PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      pdfData - the PDF document data
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the appended document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the appended document
      Throws:
      Exception - an exception is thrown if the document cannot be appended
    • appendDocument

      public void appendDocument(byte[] pdfData, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Appends the password protected PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      pdfData - The PDF document data
      password - The password to open the appended PDF document
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the appended document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the appended document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, byte[] pdfData) throws Exception
      Inserts the PDF document given as parameter in the current document at the given page index
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfData - the PDF document data
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, byte[] pdfData, String password) throws Exception
      Inserts the password protected PDF document given as parameter in the current document at the given page index
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfData - the PDF document data
      password - the password to open the inserted PDF document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, byte[] pdfData, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Inserts the PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfData - the PDF document data
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the inserted document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the inserted document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • insertDocument

      public void insertDocument(int insertIndex, byte[] pdfData, String password, boolean enableHeaderAndFooter, boolean drawHeaderOnFirstPage, boolean drawFooterOnFirstPage) throws Exception
      Inserts the password protected PDF document given as parameter to the current document and optionally applies the current document header and footer to the appended document pages
      Parameters:
      insertIndex - the page index where to start insertion in this document
      pdfData - the PDF document data
      password - the password to open the inserted PDF document
      enableHeaderAndFooter - a flag indicating if the header and footer of the current document are also applied to the inserted document pages
      drawHeaderOnFirstPage - a flag indicating if the header is drawn on first page of the inserted document
      drawFooterOnFirstPage - a flag indicating if the footer is drawn on first page of the inserted document
      Throws:
      Exception - an exception is thrown if the document cannot be inserted
    • security

      public PdfSecurityOptions security()
      Offers access to security options of the PDF document like encryption
      Returns:
      the security options object
    • form

      public PdfForm form()
      Gets a reference to the PDF form of this PDF document
      Returns:
      the PDF form object
    • documentInformation

      public PdfDocumentInfo documentInformation()
      Offers access to the document information object where the document's title, subject, keywords, etc can be set
      Returns:
      the PDF document info object
    • viewerPreferences

      public ViewerPreferences viewerPreferences()
      Offers access to the viewer preferences settings for the document.
      Returns:
      the viewer preferences object
    • openAction

      public PdfAction openAction()
      Gets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is opened
      Returns:
      the open action
    • setOpenAction

      public void setOpenAction(PdfAction openAction) throws Exception
      Sets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is opened
      Parameters:
      openAction - the open action to set
      Throws:
      Exception - an exception is thrown if the action cannot be set
    • addBookmark

      public void addBookmark(Bookmark bookmark) throws Exception
      Adds a top level bookmark to PDF document
      Parameters:
      bookmark - the bookmark to add
      Throws:
      Exception - an exception is thrown if the bookmark cannot be added
    • addBookmark

      public void addBookmark(Bookmark bookmark, Bookmark parentBookmark) throws Exception
      Adds a child bookmark to PDF document having a previously added bookmark as parent
      Parameters:
      bookmark - the new bookmark to add
      parentBookmark - the parent bookmark which was previously added to document
      Throws:
      Exception - an exception is thrown if the bookmark cannot be added
    • compressCrossReference

      public boolean compressCrossReference()
      Gets the flag indicating if the PDF cross-reference table and PDF trailer are compressed to reduce the PDF file size
      Returns:
      the flag value
    • setCompressCrossReference

      public void setCompressCrossReference(boolean compressCrossReference)
      Set this property on true to store the PDF cross-reference table and PDF trailer in compressed cross-reference streams and to reduce the PDF file size. The default value is false for the new documents
      Parameters:
      compressCrossReference - the flag value to set
    • transparencyEnabled

      public boolean transparencyEnabled()
      Gets a flag indicating if the transparency is enabled in the PDF document
      Returns:
      the flag value
    • setTransparencyEnabled

      public void setTransparencyEnabled(boolean transparencyEnabled)
      Sets a flag indicating if the transparency is enabled in the PDF document. Default value is true. This property can be set to false to eliminate the additional flattening time when the document is sent to the printer from Adobe Reader viewer
      Parameters:
      transparencyEnabled - the flag value to set
    • compressionLevel

      public PdfCompressionLevel compressionLevel()
      Gets the PDF document compression level
      Returns:
      the PDF document compression level
    • setCompressionLevel

      public void setCompressionLevel(PdfCompressionLevel compressionLevel)
      Sets the PDF document compression level. By default the compression level is PdfCompressionLevel.Normal
      Parameters:
      compressionLevel - the PDF document compression level to set
    • jpegCompressionEnabled

      public boolean jpegCompressionEnabled()
      Gets a flag indicating if the JPEG compression is enabled or not for the images in the generated PDF
      Returns:
      the flag value
    • setJpegCompressionEnabled

      public void setJpegCompressionEnabled(boolean jpegCompressionEnabled)
      Sets a flag indicating if the JPEG compression is enabled or not for the images in the generated PDF. By default the JPEG compression is enabled to reduce the size of the generated PDF. When the JPEG compression is enabled the quality of the images in the generated PDF is lower than the quality of the original images in the HTML document, function of the m_jpegCompressionEnabled parameter. When the m_jpegCompressionEnabled is increased, the quality of the images in PDF decreases
      Parameters:
      jpegCompressionEnabled - the flag value to set
    • jpegCompressionLevel

      public int jpegCompressionLevel()
      Gets the compression level of images in the generated PDF as an integer value between 0 and 100
      Returns:
      the compression level of images in the generated PDF
    • setJpegCompressionLevel

      public void setJpegCompressionLevel(int jpegCompressionLevel)
      Sets the compression level of images in the generated PDF as an integer value between 0 and 100. This property has effect only when the JpegCompressionEnabled is true. When the jpegCompressionLevel() is 0, the compression rate is the lowest and the quality of the images is the best. When the jpegCompressionLevel() is 100, the compression rate is the highest and quality of the images in PDF is the worst. The default JPEG compression level is 10, which should offer a good balance between the compression rate and the quality of the images in PDF.
      Parameters:
      jpegCompressionLevel - the compression level of images in the generated PDF
    • tableOfContents

      public PdfDocumentTableOfContents tableOfContents()
      Gets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document based on HtmlToPdfElement and HtmlToImageElement objects added to PDF document
      Returns:
      a reference to the object controlling the automatic creation of a table of contents in the generated PDF document