Package com.evopdf
Class Document
java.lang.Object
com.evopdf.Document
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
ConstructorsConstructorDescriptionDocument()
Creates an empty PDF document object.Creates an empty PDF document object using a web service from a given URL.Creates a PDF document object from the specified PDF document data using a web service from a given URLCreates 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 profileDocument
(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.Creates a PDF document from and existing PDF file using a web service from a given URLDocument
(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.Creates a PDF document object from an existing password protected PDF file using a web service from a given URLDocument
(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 URLDocument
(byte[] pdfData) Creates a PDF document object from the specified PDF document dataCreates 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 dataCreates a PDF document from binary data containing a password protected PDF document.Document
(int port, ColorProfile colorProfile) Creates a PDF document with a color profileDocument
(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.Creates a PDF document from and existing PDF fileCreates a PDF document object from an existing password protected PDF fileDocument
(ColorProfile colorProfile) Creates a PDF document with a color profileDocument
(ColorSpace colorSpace) Creates a PDF document with the specified color space.Document
(PdfStandardSubset pdfSubset) 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.Creates a PDF document from and existing PDF fileCreates a PDF document object from the specified PDF document dataCreates a PDF document from binary data containing a password protected PDF document.Creates an empty PDF document object.Creates a PDF document object from the specified PDF document dataCreates 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 profileDocument
(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.Creates a PDF document from and existing PDF fileCreates 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.Creates a PDF document object from an existing password protected PDF fileCreates a PDF document object from an existing password protected PDF fileDocument
(String server, ColorProfile colorProfile) Creates a PDF document with a color profileDocument
(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.Creates a PDF document object from an existing password protected PDF fileCreates a PDF document object from an existing password protected PDF file -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBookmark
(Bookmark bookmark) Adds a top level bookmark to PDF documentvoid
addBookmark
(Bookmark bookmark, Bookmark parentBookmark) Adds a child bookmark to PDF document having a previously added bookmark as parentvoid
addElement
(PageElement pageElement) Adds a PDF page element to this document right after the last PDF element added to document or to a pagevoid
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 pagevoid
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 pagevoid
addFileAttachment
(byte[] fileData, String attachmentName) Adds an attachment with the given name from binary data to this PDF documentvoid
addFileAttachment
(byte[] fileData, String attachmentName, String descr) Adds an attachment with the given name and a given description from binary data to this PDF documentvoid
addFileAttachment
(String filePath) Adds an attachment a given file to this PDF documentvoid
addFileAttachment
(String filePath, String descr) Adds an attachment a given file and given description to this PDF documentaddFooterTemplate
(float height) Adds a footer with the given height to documentvoid
addFormField
(PdfFormField formField) Adds a form field to this document right after the last PDF element added to document or to a pagevoid
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 pagevoid
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 pageaddHeaderTemplate
(float height) Adds a header with the given height to documentaddPage()
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 collectionaddPage
(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 collectionaddTemplate
(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 collectionvoid
appendDocument
(byte[] pdfData) Appends the PDF document given as parameter to the current documentvoid
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 pagesvoid
appendDocument
(byte[] pdfData, String password) Appends the password protected PDF document given as parameter to the current documentvoid
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 pagesvoid
appendDocument
(String pdfFilePath) Appends the PDF file given as parameter to this documentvoid
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 pagesvoid
appendDocument
(String pdfFilePath, String password) Appends the password protected PDF file given as parameter to this documentvoid
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 pagesGets 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 sizeGets the PDF document compression levelOffers access to the document information object where the document's title, subject, keywords, etc can be setfooter()
Represents the default PDF document footer template.form()
Gets a reference to the PDF form of this PDF documentgetPage
(int index) Gets the PDF page from the given index or null if the index is out of boundsheader()
Represents the default PDF document header template.int
indexOfPage
(PdfPage pdfPage) Gets the index of a PDF page in pages collectionvoid
insertDocument
(int insertIndex, byte[] pdfData) Inserts the PDF document given as parameter in the current document at the given page indexvoid
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 pagesvoid
insertDocument
(int insertIndex, byte[] pdfData, String password) Inserts the password protected PDF document given as parameter in the current document at the given page indexvoid
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 pagesvoid
insertDocument
(int insertIndex, String pdfFilePath) Inserts the PDF file given as parameter in the current document at the given page indexvoid
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 pagesvoid
insertDocument
(int insertIndex, String pdfFilePath, String password) Inserts the password protected PDF file given as parameter in the current document at the given page indexvoid
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 pagesinsertPage
(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 indexinsertPage
(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 indexboolean
Gets a flag indicating if the JPEG compression is enabled or not for the images in the generated PDFint
Gets the compression level of images in the generated PDF as an integer value between 0 and 100Gets the current license keymargins()
Gets the default document margins.Gets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is openedint
port()
Gets the HTML to PDF server port numberbyte[]
save()
Saves the PDF document as byte array that can be further saved into a file or sent over HTTP to a browservoid
Saves this PDF document into the file given by the method parametersecurity()
Offers access to security options of the PDF document like encryptionserver()
Gets the HTML to PDF server IP or nameGets the current HTML to PDF converter service passwordvoid
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
setCompressionLevel
(PdfCompressionLevel compressionLevel) 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
setMargins
(PdfMargins margins) Sets the default document margins.void
setOpenAction
(PdfAction openAction) Sets the Go To, JavaScript, Submit Form or Reset Form action to be performed when the PDF document is openedvoid
setPort
(int port) Sets the HTML to PDF server port numbervoid
Sets the HTML to PDF server IP or namevoid
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 documentvoid
setWebServiceUrl
(String webServiceUrl) Sets the web service URLGets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document based onHtmlToPdfElement
andHtmlToImageElement
objects added to PDF documentboolean
Gets a flag indicating if the transparency is enabled in the PDF documentboolean
Gets the flag indicating if the client library will call the Web service or the TCP service to create the PDF documentOffers access to the viewer preferences settings for the document.Gets the web service URL
-
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
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 serverport
- the HTML to PDF server port number on host
-
Document
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 serverwebServiceUrl
- 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
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
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 serverpdfSubset
- the PDF standard used to create the PDF document
-
Document
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 hostpdfSubset
- the PDF standard used to create the PDF document
-
Document
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 serverport
- The HTML to PDF server port number on hostpdfSubset
- The PDF standard used to create the PDF document
-
Document
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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfSubset
- The PDF standard used to create the PDF document
-
Document
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
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 servercolorSpace
- the color space of the document
-
Document
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 hostcolorSpace
- the color space of the document
-
Document
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 serverport
- the HTML to PDF server port number on hostcolorSpace
- the color space of the document
-
Document
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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsecolorSpace
- the color space of the document
-
Document
Creates a PDF document with a color profile- Parameters:
colorProfile
- the color profile to be used when creating the PDF document
-
Document
Creates a PDF document with a color profile- Parameters:
server
- the IP address or host name of the HTML to PDF servercolorProfile
- the color profile to be used when creating the PDF document
-
Document
Creates a PDF document with a color profile- Parameters:
port
- the HTML to PDF server port number on hostcolorProfile
- the color profile to be used when creating the PDF document
-
Document
Creates a PDF document with a color profile- Parameters:
server
- the IP address or host name of the HTML to PDF serverport
- the HTML to PDF server port number on hostcolorProfile
- the color profile to be used when creating the PDF document
-
Document
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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsecolorProfile
- the color profile to be used when creating the PDF document
-
Document
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 documentcolorSpace
- the color space of the document
-
Document
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 serverpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the document
-
Document
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 hostpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the document
-
Document
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 serverport
- the HTML to PDF server port number on hostpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- 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 serverport
- the HTML to PDF server port number on hostpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the documentcolorProfile
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the documentcolorProfile
- 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 serverservicePassword
- the service passwordport
- the HTML to PDF server port number on hostpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the documentcolorProfile
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falseservicePassword
- the service passwordpdfSubset
- the PDF standard used to create the PDF documentcolorSpace
- the color space of the documentcolorProfile
- the color profile to be used when creating the PDF document
-
Document
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
Creates a PDF document object from the specified PDF document data- Parameters:
server
- the IP address or host name of the HTML to PDF serverpdfData
- the PDF document data- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document object from the specified PDF document data- Parameters:
port
- The HTML to PDF server port number on hostpdfData
- The PDF document data- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document object from the specified PDF document data- Parameters:
server
- the IP address or host name of the HTML to PDF serverport
- the HTML to PDF server port number on hostpdfData
- the PDF document data- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfData
- the PDF document data- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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
Creates a PDF document from and existing PDF file- Parameters:
port
- the HTML to PDF server port number on hostpdfFilePath
- the full path of an existing PDF document file- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document from and existing PDF file- Parameters:
server
- The IP address or host name of the HTML to PDF serverport
- The HTML to PDF server port number on hostpdfFilePath
- The full path of an existing PDF document file- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfFilePath
- The full path of an existing PDF document file- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document from binary data containing a password protected PDF document.- Parameters:
pdfData
- the PDF document datapassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverpdfData
- the PDF document datapassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 hostpdfData
- the PDF document datapassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverport
- the HTML to PDF server port number on hostpdfData
- the PDF document datapassword
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfData
- the PDF document datapassword
- 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 serverport
- the HTML to PDF server port number on hostservicePassword
- the service passwordpdfData
- the PDF document datapassword
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falseservicePassword
- the service passwordpdfData
- the PDF document datapassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document object from an existing password protected PDF file- Parameters:
pdfFilePath
- the full path to the PDF filepassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverpdfFilePath
- the full path to the PDF filepassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
Creates a PDF document object from an existing password protected PDF file- Parameters:
port
- the HTML to PDF server port number on hostpdfFilePath
- the full path to the PDF filepassword
- the password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
Document
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 serverport
- The HTML to PDF server port number on hostpdfFilePath
- The full path to the PDF filepassword
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falsepdfFilePath
- The full path to the PDF filepassword
- 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 serverport
- The HTML to PDF server port number on hostservicePassword
- The service passwordpdfFilePath
- The full path to the PDF filepassword
- 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 serverwebServiceUrl
- The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is falseservicePassword
- The service passwordpdfFilePath
- The full path to the PDF filepassword
- The password to open the specified PDF document- Throws:
Exception
- throws an exception if the document cannot be created
-
-
Method Details
-
server
Gets the HTML to PDF server IP or name- Returns:
- the HTML to PDF server IP or name
-
setServer
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
Gets the web service URL- Returns:
- the web service URL
-
setWebServiceUrl
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
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
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
Gets the current license key- Returns:
- the current license key
-
setLicenseKey
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
Gets the current HTML to PDF converter service password- Returns:
- the current HTML to PDF converter service password
-
setServicePassword
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
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
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
Gets the default document margins. The new pages will use the default margins if no margins are specified- Returns:
- the default document margins
-
setMargins
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
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 withaddHeaderTemplate(float)
method- Returns:
- the document header template
-
addHeaderTemplate
Adds a header with the given height to document- Parameters:
height
- the header height- Returns:
- the newly added header template
-
addTemplate
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 widthheight
- the template height- Returns:
- the newly added template
-
addTemplate
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 pagesy
- The top left corner Y- coordinate of the template in PDF pageswidth
- the template widthheight
- the template height- Returns:
- the newly added template
-
addFileAttachment
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
Adds an attachment a given file and given description to this PDF document- Parameters:
filePath
- the path to file to be attacheddescr
- the attachment description- Throws:
Exception
- an exception is thrown if the attachment cannot be created
-
addFileAttachment
Adds an attachment with the given name from binary data to this PDF document- Parameters:
fileData
- the file dataattachmentName
- a name for attachment
-
addFileAttachment
Adds an attachment with the given name and a given description from binary data to this PDF document- Parameters:
fileData
- the file dataattachmentName
- a name for attachmentdescr
- the attachment description
-
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
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
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 pointspageMargins
- 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 pointspageMargins
- the PDF page margins in pointspageOrientation
- 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 pointspageMargins
- the PDF page margins in pointspageOrientation
- the PDF page orientationpageRotation
- 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 pagepageSize
- the PDF page size in pointspageMargins
- the PDF page margins in pointspageOrientation
- 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 pagepageSize
- The PDF page size in pointspageMargins
- The PDF page margins in pointspageOrientation
- The PDF page orientationpageRotation
- The PDF page rotation- Returns:
- The newly created PDF page
-
getPage
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
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
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
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 addedoffsetY
- the Y offset after the last PDF element added to document
-
addElement
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 addedoffsetX
- the X offset from the last PDF element added to documentoffsetY
- 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 addedxLocation
- The X location of the element in the PDF page where the last element rendering endedrelativeXLocation
- 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 endedyLocation
- The Y location of the element in the PDF page where the last element rendering endedrelativeYLocation
- 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 addedxLocation
- the X location of the element in the PDF page where the last element rendering endedrelativeXLocation
- 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 endedoffsetXFromStart
- specifies if the the relative X location is calculated from the start X coordinate of last rendered element or from the end X coordinateyLocation
- the Y location of the element in the PDF page where the last element rendering endedrelativeYLocation
- 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 endedoffsetYFromEnd
- 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
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
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 addoffsetY
- the Y offset from the last PDF element added to document
-
addFormField
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 addoffsetX
- the X offset from the last PDF element added to documentoffsetY
- 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 addedxLocation
- the X location of the element in the PDF page where the last element rendering endedrelativeXLocation
- 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 endedyLocation
- the Y location of the element in the PDF page where the last element rendering endedrelativeYLocation
- 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 addedxLocation
- the X location of the element in the PDF page where the last element rendering endedrelativeXLocation
- 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 endedoffsetXFromStart
- specifies if the the relative X location is calculated from the start X coordinate of last rendered element or from the end X coordinateyLocation
- the Y location of the element in the PDF page where the last element rendering endedrelativeYLocation
- 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 endedoffsetYFromEnd
- 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
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
Appends the password protected PDF file given as parameter to this document- Parameters:
pdfFilePath
- the PDF document to append full pathpassword
- 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 pagesenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the appended document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the appended documentdrawFooterOnFirstPage
- 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 pathpassword
- The password to open the appended PDF documentenableHeaderAndFooter
- A flag indicating if the header and footer of the current document are also applied to the appended document pagesdrawHeaderOnFirstPage
- A flag indicating if the header is drawn on first page of the appended documentdrawFooterOnFirstPage
- 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
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 documentpdfFilePath
- the PDF document full path- Throws:
Exception
- an exception is thrown if the document cannot be inserted
-
insertDocument
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 documentpdfFilePath
- the PDF document full pathpassword
- 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 documentpdfFilePath
- The PDF document full pathenableHeaderAndFooter
- A flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- A flag indicating if the header is drawn on first page of the inserted documentdrawFooterOnFirstPage
- 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 documentpdfFilePath
- the PDF document full pathpassword
- the password to open the inserted PDF documentenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the inserted documentdrawFooterOnFirstPage
- 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
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
Appends the password protected PDF document given as parameter to the current document- Parameters:
pdfData
- the PDF document datapassword
- 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 dataenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the appended documentdrawFooterOnFirstPage
- 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 datapassword
- The password to open the appended PDF documentenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the appended documentdrawFooterOnFirstPage
- 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
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 documentpdfData
- the PDF document data- Throws:
Exception
- an exception is thrown if the document cannot be inserted
-
insertDocument
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 documentpdfData
- the PDF document datapassword
- 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 documentpdfData
- the PDF document dataenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the inserted documentdrawFooterOnFirstPage
- 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 documentpdfData
- the PDF document datapassword
- the password to open the inserted PDF documentenableHeaderAndFooter
- a flag indicating if the header and footer of the current document are also applied to the inserted document pagesdrawHeaderOnFirstPage
- a flag indicating if the header is drawn on first page of the inserted documentdrawFooterOnFirstPage
- 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
Offers access to security options of the PDF document like encryption- Returns:
- the security options object
-
form
Gets a reference to the PDF form of this PDF document- Returns:
- the PDF form object
-
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
Offers access to the viewer preferences settings for the document.- Returns:
- the viewer preferences object
-
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
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
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
Adds a child bookmark to PDF document having a previously added bookmark as parent- Parameters:
bookmark
- the new bookmark to addparentBookmark
- 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
Gets the PDF document compression level- Returns:
- the PDF document compression level
-
setCompressionLevel
Sets the PDF document compression level. By default the compression level isPdfCompressionLevel.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 them_jpegCompressionEnabled
parameter. When them_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 thejpegCompressionLevel()
is 0, the compression rate is the lowest and the quality of the images is the best. When thejpegCompressionLevel()
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
Gets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document based onHtmlToPdfElement
andHtmlToImageElement
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
-