Package com.winnovative_software
Class HtmlToPdfConverter
java.lang.Object
com.winnovative_software.HtmlToPdfConverter
This class is the main class of the HTML to PDF Converter which offers the
necessary methods to create a PDF document from a web page at given URL or
from a HTML string. The generated PDF document can be saved into a memory
buffer or into a file
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a HTML to PDF converter which will connect to localhost on the default portHtmlToPdfConverter
(boolean useWebService, String webServiceUrl) Constructs a HTML to PDF converter which will connect to a web service URLHtmlToPdfConverter
(int port) Constructs a HTML to PDF converter which will connect to localhost on the specified portHtmlToPdfConverter
(String server) Constructs a HTML to PDF converter which will connect to the server specified by IP or by name on the default portHtmlToPdfConverter
(String server, int port) Constructs a HTML to PDF converter which will connect to the server specified by IP or by name on the specified port -
Method Summary
Modifier and TypeMethodDescriptionThis property can be set with an username and a password in order to authenticate to the web server before accessing the URL to be converted in HTML to PDF Converter.Gets the java.net.Proxy object to be used when accessing the HTML to PDF Web Service through a proxy server.boolean
Gets a flag indicating if the HTML content is clipped by HTML viewer window width.int
Gets the additional time in seconds to wait for asynchronous items to be completely loaded or for a web page redirect to finish before starting the rendering in HTML to PDF converter.Offers summary information about the conversion process.byte[]
convertHtml
(String html, String baseUrl) Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document into a memory buffervoid
convertHtmlToFile
(String htmlString, String baseUrl, String outFile) convertHtmlToPdfDocumentObject
(String html, String baseUrl) Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document as an object of theDocument
class that can be further used in other operations requiring this type of objectsbyte[]
convertUrl
(String url) Converts the HTML page from the given URL to a PDF document and returns the PDF document in a memory buffervoid
convertUrlToFile
(String url, String outFile) Converts the HTML page from the given URL to a PDF document and writes the rendered PDF document into a fileConverts an URL to PDF and returns the rendered PDF document as an object of theDocument
class that can be further used in other operations requiring this type of objectsGets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML documentboolean
Gets the flag indicating if the HTML to PDF converter should try to download all the resources.boolean
Gets the flag indicating if the accelerated CSS 3D transformations are enabled in the HTML to PDF converter.boolean
Gets the flag indicating if the accelerated 2D canvas is enabled in the HTML to PDF converterboolean
Gets the flag indicating if the HTTP2 protocol is enabled in in HTML to PDF converter.boolean
Gets the flag indicating if the persistent local storage is enabled in converterboolean
Gets the flag indicating if the WebGL is enabled in the HTML to PDF converterboolean
Gets the flag indicating if the HTML viewer extensions are executed during HTML to PDF conversionString[]
Gets the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversionGets an object populated after conversion with the title, keywords, and description of the converted HTML documentGets a reference to the object that can be used to obtain the position in PDF of the HTML elements rendered by the HTML to PDF converter.int
Gets the HTML viewer height in pixels in the HTML to PDF Converter.int
Gets the preferred HTML viewer width in pixels in HTML to PDF converter.int
Gets the HTML viewer zoom percentage in HTML to PDF Converter similar to zoom level in a browserReturns the collection of HTTP POST fields to be used when accessing a web page in HTML to PDF converter.Gets a collection of custom HTTP cookies to be sent by the HTML to PDF converter to the web server when the web page to convert and the resources (image, css, etc) referenced by the web page are requested.Gets a collection of custom HTTP headers to be sent by the HTML to PDF converter to the web server when the web page is requested from a URL.int
Gets the maximum height in pixels of an image part in HTML to PDF converterThe impersonation options applied during navigation in HTML to PDF converterint
Gets the initial height in pixels of the HTML viewer in HTML to PDF converterboolean
Gets the flag indicating if the slow JavaScript script should be interrupted in HTML to PDF converterboolean
Gets the flag indicating if JavaScript execution is enabled in HTML to PDF converterGets the license key stringboolean
Gets the a flag indicating if the access to local files is enabled in the HTML to PDF Converterint
Gets the additional time in seconds to wait after manual triggering before starting the rendering.int
Gets the maximum height in pixels to be rendered from the HTML document by the HTML to PDF converterGets the media type of the HTML document used by the HTML to PDF converterint
Gets the minimum height in pixels to be rendered from the HTML document by the HTML to PDF converterint
Gets the navigation timeout in secondsGets the custom user agent to be used when accessing the HTML pageGets a reference to the object controlling the bookmarks creation for the rendered PDF document generated by the HTML to PDF converter.Gets a reference to the object to controlling the generated PDF document information like the document title, author, subject or creation dateGets a reference to the object controlling the conversion process and the generated PDF document properties.Gets a reference to an object to control the generated PDF document footer options.Gets a reference to the object controlling the automatic conversion of a HTML form to a PDF form in the generated PDF documentGets a reference to an object to control the generated PDF document header options.Gets a reference to the object to controlling the generated PDF document security settings like user and owner password, restrict printing or editing of the generated PDF documentGets a reference to the object controlling how the generated PDF is displayed by a PDF viewerboolean
Gets the flag indicating if the HTML to PDF converter will send the custom headers defined by thehttpRequestHeaders()
property each time an external resource (image, css, etc) referenced by the web page is requestedint
port()
Gets the HTML to PDF server port numberboolean
Gets the flag indicating if the fonts with PostScript outlines are enabled in HTML during the HTML to PDF conversionboolean
Gets the flag indicating if the HTML to PDF converter should perform a pre-renderingGets a reference to an object encapsulating the proxy options used by HTML to PDF converter to access the HTML document to convertGets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converterserver()
Gets the HTML to PDF server IP or nameGets the HTML to PDF converter service passwordvoid
setClientProxy
(Proxy clientProxy) Sets the java.net.Proxy object to be used when accessing the HTML to PDF Web Service through a proxy server.void
setClipHtmlView
(boolean clipView) Sets a flag indicating if the HTML content is clipped by HTML viewer window width.void
setConversionDelay
(int delay) Sets an additional time in seconds to wait for asynchronous items to be completely loaded or for a web page redirect to finish before starting the rendering in HTML to PDF converter.void
setDefaultHtmlEncoding
(String encoding) Sets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML documentvoid
setDownloadAllResources
(boolean download) Sets the flag indicating if the HTML to PDF converter should try to download all the resources even if this could cause a slower conversion.void
setEnable3DTransformations
(boolean enabled) Gets or sets a flag indicating if the accelerated CSS 3D transformations are enabled in the HTML to PDF converter.void
setEnableAccelerated2DCanvas
(boolean enabled) Sets the flag indicating if the accelerated 2D canvas is enabled in the HTML to PDF converter.void
setEnableHttp2
(boolean enabled) Sets the flag indicating if the the HTTP2 protocol is enabled in in HTML to PDF converter.void
setEnablePersistentStorage
(boolean enabled) Sets the flag indicating if the persistent local storage is enabled in converter.void
setEnableWebGL
(boolean enabled) Sets a flag indicating if the WebGL is enabled in the HTML to PDF converter.void
setExtensionsEnabled
(boolean enabled) Sets a flag indicating if the HTML viewer extensions are executed during HTML to PDF conversion.void
setHiddenHtmlElementsSelectors
(String[] hiddenHtmlElementsSelectors) Sets the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversionvoid
setHtmlViewerHeight
(int viewerHeight) Sets the HTML viewer height in pixels in the HTML to PDF Converter .void
setHtmlViewerWidth
(int viewerWidth) Gets or sets the preferred HTML viewer width in pixels in HTML to PDF converter.void
setHtmlViewerZoom
(int viewerZoom) Sets HTML viewer zoom percentage in HTML to PDF Converter similar to zoom level in a browser.void
setImagePartSize
(int height) Sets the maximum height in pixels of an image part in HTML to PDF convertervoid
setInitialHtmlViewerHeight
(int initialHeight) Sets the initial height in pixels of the HTML viewer in HTML to PDF converter.void
setInterruptSlowJavaScript
(boolean interrupt) Sets a flag indicating if the slow JavaScript script should be interrupted in HTML to PDF converter.void
setJavaScriptEnabled
(boolean enabled) Sets a flag indicating if JavaScript execution is enabled in HTML to PDF converter.void
setLicenseKey
(String key) Sets the license key string received from the vendor in HTML to PDF converter.void
setLocalFilesAccessEnabled
(boolean enabled) Sets the flag indicating if the access to local files is enabled in the HTML to PDF Converter.void
setManualTriggeringConversionDelay
(int delay) Sets an additional time in seconds to wait after manual triggering before starting the rendering.void
setMaxHtmlViewerHeight
(int maxHeight) Sets the maximum height in pixels to be rendered from the HTML document by the HTML to PDF converter.void
setMediaType
(String media) Sets the media type of the HTML document used by the HTML to PDF converter.void
setMinHtmlViewerHeight
(int minHeight) Sets the minimum height in pixels to be rendered from the HTML document by the HTML to PDF converter.void
setNavigationTimeout
(int timeout) Sets the HTML to PDF converter navigation timeout in seconds.void
setNavigatorUserAgent
(String navigatorUserAgent) Sets the custom user agent to be used when accessing the HTML page.void
setPersistentHttpRequestHeaders
(boolean persistentHttpRequestHeaders) Sets the flag indicating if the HTML to PDF converter will send the custom headers defined by thehttpRequestHeaders()
property each time an external resource (image, css, etc) referenced by the web page is requested.void
setPort
(int port) Sets the HTML to PDF server port numbervoid
setPostScriptFontsEnabled
(boolean enabled) Sets a flag indicating if the fonts with PostScript outlines are enabled in HTML during the HTML to PDF conversion.void
setPrerenderEnabled
(boolean enabled) Sets a flag indicating if the HTML to PDF converter should perform a pre-rendering.void
setRenderedHtmlElementSelector
(String selector) Gets or sets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converter.void
Sets the HTML to PDF server IP or namevoid
setServicePassword
(String password) Sets the HTML to PDF converter service password.void
setSvgFontsEnabled
(boolean enabled) Sets a flag indicating if the SVG fonts are enabled in HTML during the HTML to PDF conversion.void
Sets the conversion triggering mode used by the HTML to PDF converter.void
setUseWebService
(boolean useWebService) Sets the flag indicating if the client library will call the Web service or the TCP service to perform the HTML to PDF conversionvoid
setWebFontsEnabled
(boolean enabled) Sets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversionvoid
setWebServiceUrl
(String webServiceUrl) Sets the HTML to PDF web service URLvoid
setXPSupplementalLanguages
(boolean enabled) Sets the flag in HTML to PDF converter indicating if the supplemental languages (complex script, right-to-left, East Asian) support was enabled in Windows XP Regional and Language Options.boolean
Gets the flag indicating if the SVG fonts are enabled in HTML during the HTML to PDF conversionGets a reference to the object controlling the automatic creation of a table of contents in the generated PDF documentGets the conversion triggering mode used by the HTML to PDF converterboolean
Gets the flag indicating if the client library will call the Web service or the TCP service to perform the HTML to PDF conversionboolean
Gets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversionGets the HTML to PDF web service URLboolean
Gets the flag in HTML to PDF converter indicating if the supplemental languages (complex script, right-to-left, East Asian) support was enabled in Windows XP Regional and Language Options
-
Constructor Details
-
HtmlToPdfConverter
public HtmlToPdfConverter()Constructs a HTML to PDF converter which will connect to localhost on the default port -
HtmlToPdfConverter
Constructs a HTML to PDF converter which will connect to the server specified by IP or by name on the default port- Parameters:
server
- the IP address or host name of the HTML to PDF server
-
HtmlToPdfConverter
public HtmlToPdfConverter(int port) Constructs a HTML to PDF converter which will connect to localhost on the specified port- Parameters:
port
- the HTML to PDF server port number on localhost
-
HtmlToPdfConverter
Constructs a HTML to PDF converter which will connect to the server specified by IP or by name on the specified port- Parameters:
server
- the IP address or host name of the HTML to PDF serverport
- the HTML to PDF server port number on localhost
-
HtmlToPdfConverter
Constructs a HTML to PDF converter which will connect to a web service 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 false
-
-
Method Details
-
server
Gets the HTML to PDF server IP or name- Returns:
- the server IP or name
-
setServer
Sets the HTML to PDF server IP or name- Parameters:
server
- the server IP or name
-
port
public int port()Gets the HTML to PDF server port number- Returns:
- the server port number
-
setPort
public void setPort(int port) Sets the HTML to PDF server port number- Parameters:
port
- the server port number
-
webServiceUrl
Gets the HTML to PDF web service URL- Returns:
- the web service URL
-
setWebServiceUrl
Sets the HTML to PDF 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 perform the HTML to PDF conversion- 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 perform the HTML to PDF conversion- Parameters:
useWebService
- the use web service option
-
clientProxy
Gets the java.net.Proxy object to be used when accessing the HTML to PDF 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 HTML to PDF 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
-
htmlViewerWidth
public int htmlViewerWidth()Gets the preferred HTML viewer width in pixels in HTML to PDF converter.- Returns:
- the preferred HTML viewer width in pixels
-
setHtmlViewerWidth
public void setHtmlViewerWidth(int viewerWidth) Gets or sets the preferred HTML viewer width in pixels in HTML to PDF converter. If the HTML content is not entirely visible in the HTML viewer at the specified width, theclipHtmlView()
property will control whether the HTML content is clipped or the HTML viewer width is automatically extended to make visible the whole HTML content. By default theclipHtmlView()
property is false and the HTML viewer is automatically extended in width to make visible the whole HTML content. The HTML viewer width can also be specified in the HtmlToPdfConverter class constructor. The default value is 1024 pixels- Parameters:
viewerWidth
- the HTML viewer width to set
-
htmlViewerHeight
public int htmlViewerHeight()Gets the HTML viewer height in pixels in the HTML to PDF Converter.- Returns:
- the HTML viewer height
-
setHtmlViewerHeight
public void setHtmlViewerHeight(int viewerHeight) Sets the HTML viewer height in pixels in the HTML to PDF Converter . If the specified HTML viewer height is 0 the HTML viewer height will be automatically determined based on the HTML content and the HTML viewer width in order to make visible the whole HTML content. The HTML viewer width is given by thehtmlViewerWidth()
property of theHtmlToPdfConverter
class. If the HTML content is not entirely visible in the HTML viewer at the specified width, theclipHtmlView()
property will control whether the HTML content is clipped or the HTML viewer width is automatically extended to make visible the whole HTML content. The HTML viewer height can also be specified in theHtmlToPdfConverter
class constructor. The default value is 0 to automatically determine the HTML viewer height based on the HTML content and the HTML viewer width- Parameters:
viewerHeight
- the HTML viewer height to set
-
htmlViewerZoom
public int htmlViewerZoom()Gets the HTML viewer zoom percentage in HTML to PDF Converter similar to zoom level in a browser- Returns:
- the HTML viewer zoom
-
setHtmlViewerZoom
public void setHtmlViewerZoom(int viewerZoom) Sets HTML viewer zoom percentage in HTML to PDF Converter similar to zoom level in a browser. The default value of this property is 100- Parameters:
viewerZoom
- the HTML viewer zoom to set
-
clipHtmlView
public boolean clipHtmlView()Gets a flag indicating if the HTML content is clipped by HTML viewer window width.- Returns:
- the HTML content clipping option
-
setClipHtmlView
public void setClipHtmlView(boolean clipView) Sets a flag indicating if the HTML content is clipped by HTML viewer window width. If the HTML content is not entirely visible in the HTML viewer of the HTML to PDF converter at the specified width, this property will control whether the HTML content is clipped or the HTML viewer width is automatically extended to make visible the whole HTML content. The HTML viewer width is given by thehtmlViewerWidth()
property. The default value of this property is false- Parameters:
clipView
- the HTML clipping option value
-
licenseKey
Gets the license key string- Returns:
- the license key string
-
setLicenseKey
Sets the license key string received from the vendor in HTML to PDF converter. If this property is null the converter will automatically enter in evaluation mode and a demo watermark will be displayed on the generated PDF document- Parameters:
key
- the license key string to set
-
servicePassword
Gets the HTML to PDF converter service password- Returns:
- the 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:
password
- the service password to set
-
pdfDocumentOptions
Gets a reference to the object controlling the conversion process and the generated PDF document properties. This property can be used to control the PDF document margins, PDF compression level, JPEG compression level, the PDF page size and orientation, the PDF document headers and footers, conversion of the URLs to links in PDF, conversion of the HTML links with anchors to internal PDF links, true type fonts embedding, fit width and stretch to fit, conversion to a single PDF page, append or prepend external PDF documents- Returns:
- the
PdfDocumentOptions
object controlling the resulted PDF document properties
-
authenticationOptions
This property can be set with an username and a password in order to authenticate to the web server before accessing the URL to be converted in HTML to PDF Converter. They can be used for example to resolve the IIS Integrated Windows Authentication or other types of IIS authentication- Returns:
- the object encapsulating the authentication options
-
impersonationOptions
The impersonation options applied during navigation in HTML to PDF converter- Returns:
- the object encapsulating the impersonation options
-
pdfDocumentInfo
Gets a reference to the object to controlling the generated PDF document information like the document title, author, subject or creation date- Returns:
- the object to controlling the generated PDF document information
-
pdfSecurityOptions
Gets a reference to the object to controlling the generated PDF document security settings like user and owner password, restrict printing or editing of the generated PDF document- Returns:
- the object encapsulating the PDF document security options
-
pdfHeaderOptions
Gets a reference to an object to control the generated PDF document header options. The header is displayed in the generated PDF document only if thePdfDocumentOptions.showHeader()
property is true- Returns:
- the
PdfHeaderOptions
object controlling the PDF document header properties
-
pdfBookmarkOptions
Gets a reference to the object controlling the bookmarks creation for the rendered PDF document generated by the HTML to PDF converter. In order to enable creation of bookmarks you have to set thePdfBookmarkOptions.htmlElementSelectors()
property ofPdfBookmarkOptions
class with the CSS selectors of the HTML elements you want to bookmark- Returns:
- a reference to the object controlling the bookmarks creation
-
htmlElementsMappingOptions
Gets a reference to the object that can be used to obtain the position in PDF of the HTML elements rendered by the HTML to PDF converter. In order to retrieve the position in PDF for a list of HTML elements, theHtmlElementsMappingOptions.htmlElementSelectors()
property ofHtmlElementsMappingOptions
class must be set with an array of strings containing the CSS selectors of the HTML elements you want to map. The positions of the HTML elements in the generated PDF document will be returned in theHtmlElementsMappingOptions.htmlElementsMappingResult()
object after the element was added to the page- Returns:
- a reference to the object that can be used to obtain the position in PDF of the HTML elements rendered by the HTML to PDF converter
-
tableOfContentsOptions
Gets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document- Returns:
- a reference to the object controlling the automatic creation of a table of contents in the generated PDF document
-
pdfFormOptions
Gets a reference to the object controlling the automatic conversion of a HTML form to a PDF form in the generated PDF document- Returns:
- a reference to the object controlling the automatic conversion of a HTML form to a PDF form in the generated PDF document
-
proxyOptions
Gets a reference to an object encapsulating the proxy options used by HTML to PDF converter to access the HTML document to convert- Returns:
- a reference to an object encapsulating the proxy options used by HTML to PDF converter to access the HTML document to convert
-
pdfViewerPreferences
Gets a reference to the object controlling how the generated PDF is displayed by a PDF viewer- Returns:
- a reference to the object controlling how the generated PDF is displayed by a PDF viewer
-
conversionSummary
Offers summary information about the conversion process. After a successful conversion this property is initialized with an instance of theConversionSummary
class. If the conversion failed this property returns a null value- Returns:
- conversion process summary
-
htmlDocumentInfo
Gets an object populated after conversion with the title, keywords, and description of the converted HTML document- Returns:
- an object populated after conversion with the title, keywords, and description of the converted HTML document
-
javaScriptEnabled
public boolean javaScriptEnabled()Gets the flag indicating if JavaScript execution is enabled in HTML to PDF converter- Returns:
- the flag indicating if JavaScript execution is enabled in HTML to PDF converter
-
setJavaScriptEnabled
public void setJavaScriptEnabled(boolean enabled) Sets a flag indicating if JavaScript execution is enabled in HTML to PDF converter. The default is true- Parameters:
enabled
- the flag value to set
-
enable3DTransformations
public boolean enable3DTransformations()Gets the flag indicating if the accelerated CSS 3D transformations are enabled in the HTML to PDF converter. The default value is false- Returns:
- the flag indicating if the accelerated CSS 3D transformations are enabled in the HTML to PDF converter
-
setEnable3DTransformations
public void setEnable3DTransformations(boolean enabled) Gets or sets a flag indicating if the accelerated CSS 3D transformations are enabled in the HTML to PDF converter. The default value is false- Parameters:
enabled
- the flag value to set
-
enableWebGL
public boolean enableWebGL()Gets the flag indicating if the WebGL is enabled in the HTML to PDF converter- Returns:
- the flag indicating if the WebGL is enabled in the HTML to PDF converter
-
setEnableWebGL
public void setEnableWebGL(boolean enabled) Sets a flag indicating if the WebGL is enabled in the HTML to PDF converter. The default value is false- Parameters:
enabled
- the flag value to set
-
enableAccelerated2DCanvas
public boolean enableAccelerated2DCanvas()Gets the flag indicating if the accelerated 2D canvas is enabled in the HTML to PDF converter- Returns:
- the flag indicating if the accelerated 2D canvas is enabled in the HTML to PDF converter
-
setEnableAccelerated2DCanvas
public void setEnableAccelerated2DCanvas(boolean enabled) Sets the flag indicating if the accelerated 2D canvas is enabled in the HTML to PDF converter. The default value is false- Parameters:
enabled
- the flag value to set
-
enablePersistentStorage
public boolean enablePersistentStorage()Gets the flag indicating if the persistent local storage is enabled in converter- Returns:
- the flag indicating if the persistent local storage is enabled in converter
-
setEnablePersistentStorage
public void setEnablePersistentStorage(boolean enabled) Sets the flag indicating if the persistent local storage is enabled in converter. The default value is false- Parameters:
enabled
- the flag value to set
-
localFilesAccessEnabled
public boolean localFilesAccessEnabled()Gets the a flag indicating if the access to local files is enabled in the HTML to PDF Converter- Returns:
- flag indicating if the access to local files is enabled in the HTML to PDF Converter
-
setLocalFilesAccessEnabled
public void setLocalFilesAccessEnabled(boolean enabled) Sets the flag indicating if the access to local files is enabled in the HTML to PDF Converter. The default value is true- Parameters:
enabled
- the flag value to set
-
httpPostFields
Returns the collection of HTTP POST fields to be used when accessing a web page in HTML to PDF converter. If there are elements in collection then the converter will make a POST request to the web page URL with the fields from this collection, otherwise it will make a GET request- Returns:
- the collection of HTTP POST fields to be used when accessing a web page in HTML to PDF converter
-
mediaType
Gets the media type of the HTML document used by the HTML to PDF converter- Returns:
- the media type used by converter
-
setMediaType
Sets the media type of the HTML document used by the HTML to PDF converter. The default media type is 'screen'. If you set this property with 'print' then the CSS properties defined in '@media print' rule will be used to render the document- Parameters:
media
- the media type to be used by converter
-
svgFontsEnabled
public boolean svgFontsEnabled()Gets the flag indicating if the SVG fonts are enabled in HTML during the HTML to PDF conversion- Returns:
- the flag indicating if the SVG fonts are enabled
-
setSvgFontsEnabled
public void setSvgFontsEnabled(boolean enabled) Sets a flag indicating if the SVG fonts are enabled in HTML during the HTML to PDF conversion. The default value is false- Parameters:
enabled
- the flag value to set
-
webFontsEnabled
public boolean webFontsEnabled()Gets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversion- Returns:
- the flag indicating if the Web Fonts are enabled
-
setWebFontsEnabled
public void setWebFontsEnabled(boolean enabled) Sets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversion- Parameters:
enabled
- the flag value to set
-
enableHttp2
public boolean enableHttp2()Gets the flag indicating if the HTTP2 protocol is enabled in in HTML to PDF converter. The property has effect only with NE version of the server- Returns:
- the flag indicating if the HTTP2 protocol is enabled
-
setEnableHttp2
public void setEnableHttp2(boolean enabled) Sets the flag indicating if the the HTTP2 protocol is enabled in in HTML to PDF converter. The property has effect only with NE version of the server. The default value is false- Parameters:
enabled
- the flag value to set
-
postScriptFontsEnabled
public boolean postScriptFontsEnabled()Gets the flag indicating if the fonts with PostScript outlines are enabled in HTML during the HTML to PDF conversion- Returns:
- the flag indicating if the fonts with PostScript outlines are enabled
-
setPostScriptFontsEnabled
public void setPostScriptFontsEnabled(boolean enabled) Sets a flag indicating if the fonts with PostScript outlines are enabled in HTML during the HTML to PDF conversion. The default value is true- Parameters:
enabled
- the fag value to set
-
extensionsEnabled
public boolean extensionsEnabled()Gets the flag indicating if the HTML viewer extensions are executed during HTML to PDF conversion- Returns:
- the flag indicating if the HTML viewer extensions are executed
-
setExtensionsEnabled
public void setExtensionsEnabled(boolean enabled) Sets a flag indicating if the HTML viewer extensions are executed during HTML to PDF conversion. The default value is false and no extension is executed. The Flash player for Mozilla Firefox must be installed in order to execute the flash content from HTML- Parameters:
enabled
- the flag value to set
-
downloadAllResources
public boolean downloadAllResources()Gets the flag indicating if the HTML to PDF converter should try to download all the resources.- Returns:
- the flag indicating if the HTML to PDF converter should try to download all the resources
-
setDownloadAllResources
public void setDownloadAllResources(boolean download) Sets the flag indicating if the HTML to PDF converter should try to download all the resources even if this could cause a slower conversion. The default value is false- Parameters:
download
- the flag value to set
-
prerenderEnabled
public boolean prerenderEnabled()Gets the flag indicating if the HTML to PDF converter should perform a pre-rendering- Returns:
- the flag indicating if the HTML to PDF converter should perform a pre-rendering
-
setPrerenderEnabled
public void setPrerenderEnabled(boolean enabled) Sets a flag indicating if the HTML to PDF converter should perform a pre-rendering. The default value is false- Parameters:
enabled
- the flag value to set
-
interruptSlowJavaScript
public boolean interruptSlowJavaScript()Gets the flag indicating if the slow JavaScript script should be interrupted in HTML to PDF converter- Returns:
- the flag indicating if the slow JavaScript script should be interrupted
-
setInterruptSlowJavaScript
public void setInterruptSlowJavaScript(boolean interrupt) Sets a flag indicating if the slow JavaScript script should be interrupted in HTML to PDF converter. The default value is false and the scripts are not interrupted- Parameters:
interrupt
- the flag value to set
-
setHiddenHtmlElementsSelectors
Sets the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversion- Parameters:
hiddenHtmlElementsSelectors
- the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversion
-
renderedHtmlElementSelector
Gets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converter- Returns:
- the selector of the HTML element to be rendered
-
setRenderedHtmlElementSelector
Gets or sets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converter. If the selector selects multiple HTML elements, only the the first one will be converted. The CSS selector is case sensitive. If this property is not set then the entire HTML document is rendered- Parameters:
selector
- the CSS selector of the HTML element to be rendered to PDF
-
maxHtmlViewerHeight
public int maxHtmlViewerHeight()Gets the maximum height in pixels to be rendered from the HTML document by the HTML to PDF converter- Returns:
- the maximum height in pixels to be rendered from the HTML document
-
setMaxHtmlViewerHeight
public void setMaxHtmlViewerHeight(int maxHeight) Sets the maximum height in pixels to be rendered from the HTML document by the HTML to PDF converter. The default value is 0 and the entire HTML document is rendered- Parameters:
maxHeight
- the maximum height in pixels to be rendered from the HTML document
-
minHtmlViewerHeight
public int minHtmlViewerHeight()Gets the minimum height in pixels to be rendered from the HTML document by the HTML to PDF converter- Returns:
- the minimum height in pixels to be rendered from the HTML document
-
setMinHtmlViewerHeight
public void setMinHtmlViewerHeight(int minHeight) Sets the minimum height in pixels to be rendered from the HTML document by the HTML to PDF converter. The default value is 0 and the entire HTML document is rendered- Parameters:
minHeight
- the minimum height in pixels to be rendered from the HTML document
-
initialHtmlViewerHeight
public int initialHtmlViewerHeight()Gets the initial height in pixels of the HTML viewer in HTML to PDF converter- Returns:
- the initial height in pixels of the HTML viewer
-
setInitialHtmlViewerHeight
public void setInitialHtmlViewerHeight(int initialHeight) Sets the initial height in pixels of the HTML viewer in HTML to PDF converter. This value of this property is ignored if the HtmlViewerHeight property is set- Parameters:
initialHeight
- the initial height in pixels of the HTML viewer
-
defaultHtmlEncoding
Gets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML document- Returns:
- the default HTML document text encoding
-
setDefaultHtmlEncoding
Sets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML document- Parameters:
encoding
- the default HTML document text encoding
-
imagePartSize
public int imagePartSize()Gets the maximum height in pixels of an image part in HTML to PDF converter- Returns:
- the maximum height in pixels of an image part
-
setImagePartSize
public void setImagePartSize(int height) Sets the maximum height in pixels of an image part in HTML to PDF converter- Parameters:
height
- the maximum height in pixels of an image part
-
triggeringMode
Gets the conversion triggering mode used by the HTML to PDF converter- Returns:
- the conversion triggering mode
-
setTriggeringMode
Sets the conversion triggering mode used by the HTML to PDF converter.- Parameters:
mode
- the conversion triggering mode
-
conversionDelay
public int conversionDelay()Gets the additional time in seconds to wait for asynchronous items to be completely loaded or for a web page redirect to finish before starting the rendering in HTML to PDF converter. Default value is 2- Returns:
- the additional time in seconds to wait for asynchronous items to be completely loaded
-
setConversionDelay
public void setConversionDelay(int delay) Sets an additional time in seconds to wait for asynchronous items to be completely loaded or for a web page redirect to finish before starting the rendering in HTML to PDF converter. Default value is 2- Parameters:
delay
- the additional time in seconds to wait for asynchronous items to be completely loaded
-
manualTriggeringConversionDelay
public int manualTriggeringConversionDelay()Gets the additional time in seconds to wait after manual triggering before starting the rendering. Default value is 2- Returns:
- the additional time in seconds to wait
-
setManualTriggeringConversionDelay
public void setManualTriggeringConversionDelay(int delay) Sets an additional time in seconds to wait after manual triggering before starting the rendering. Default value is 2- Parameters:
delay
- the additional time in seconds to wait
-
httpRequestHeaders
Gets a collection of custom HTTP headers to be sent by the HTML to PDF converter to the web server when the web page is requested from a URL. A custom HTTP header is defined by a name and a value pair that can be added tohttpRequestHeaders()
collection. ThepersistentHttpRequestHeaders()
property can be set on true to instruct the converter to send the custom headers each time an external resource (image, css, etc) referenced by the web page is requested. By default thepersistentHttpRequestHeaders()
property is false and the custom headers are not automatically sent to the web server when the web page resources are requested. The custom HTTP headers can be used to define cookies, authentication options, URL referrer or any other HTTP header to be sent to the web browser. The preferred method to send cookies is to use thehttpRequestCookies()
property- Returns:
- the collection of custom HTTP headers to be sent by the HTML to PDF converter to the web server
-
persistentHttpRequestHeaders
public boolean persistentHttpRequestHeaders()Gets the flag indicating if the HTML to PDF converter will send the custom headers defined by thehttpRequestHeaders()
property each time an external resource (image, css, etc) referenced by the web page is requested- Returns:
- the flag value
-
setPersistentHttpRequestHeaders
public void setPersistentHttpRequestHeaders(boolean persistentHttpRequestHeaders) Sets the flag indicating if the HTML to PDF converter will send the custom headers defined by thehttpRequestHeaders()
property each time an external resource (image, css, etc) referenced by the web page is requested. The default value of this property is true and the custom headers are automatically sent to the web server when the web page resources are requested- Parameters:
persistentHttpRequestHeaders
- the flag value to set
-
httpRequestCookies
Gets a collection of custom HTTP cookies to be sent by the HTML to PDF converter to the web server when the web page to convert and the resources (image, css, etc) referenced by the web page are requested. A cookie is defined by a name and a value pair that can be added tohttpRequestCookies()
collection- Returns:
- the collection of custom HTTP cookies to be sent by the HTML to PDF converter to the web server when the web page to convert and the resources (image, css, etc) referenced by the web page are requested
-
xpSupplementalLanguages
public boolean xpSupplementalLanguages()Gets the flag in HTML to PDF converter indicating if the supplemental languages (complex script, right-to-left, East Asian) support was enabled in Windows XP Regional and Language Options- Returns:
- the flag in HTML to PDF converter indicating if the supplemental languages support was enabled in Windows XP
-
setXPSupplementalLanguages
public void setXPSupplementalLanguages(boolean enabled) Sets the flag in HTML to PDF converter indicating if the supplemental languages (complex script, right-to-left, East Asian) support was enabled in Windows XP Regional and Language Options. The default value is false- Parameters:
enabled
- the flag value to set
-
convertUrl
Converts the HTML page from the given URL to a PDF document and returns the PDF document in a memory buffer- Parameters:
url
- the URL of the HTML document to convert to PDF or the full path of a HTML file in the local file system- Returns:
- a memory buffer containing the the generated PDF document
- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertUrlToPdfDocumentObject
Converts an URL to PDF and returns the rendered PDF document as an object of theDocument
class that can be further used in other operations requiring this type of objects -
convertUrlToFile
Converts the HTML page from the given URL to a PDF document and writes the rendered PDF document into a file- Parameters:
url
- the URL of the HTML document to convert to PDF or the full path of a HTML file in the local file systemoutFile
- the full path of the file where to write the rendered PDF document- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtml
Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document into a memory buffer- Parameters:
html
- the HTML string to convert to PDFbaseUrl
- the base URL used to determine the full URL of the external resources like images, CSS, JavaScript and Web Font files referenced by relative URLs in HTML- Returns:
- a memory buffer containing the the generated PDF document
- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtmlToPdfDocumentObject
Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document as an object of theDocument
class that can be further used in other operations requiring this type of objects- Parameters:
html
- the HTML string to convert to PDFbaseUrl
- the base URL used to determine the full URL of the external resources like images, CSS, JavaScript and Web Font files referenced by relative URLs in HTML- Returns:
- The created
Document
object - Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtmlToFile
- Throws:
Exception
-