Package com.evopdf

Class HtmlToPdfConverter

java.lang.Object
com.evopdf.HtmlToPdfConverter

public class HtmlToPdfConverter extends Object
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

    Constructors
    Constructor
    Description
    Constructs a HTML to PDF converter which will connect to localhost on the default port
    HtmlToPdfConverter(boolean useWebService, String webServiceUrl)
    Constructs a HTML to PDF converter which will connect to a web service URL
    Constructs a HTML to PDF converter which will connect to localhost on the specified port
    Constructs a HTML to PDF converter which will connect to the server specified by IP or by name on the default port
    HtmlToPdfConverter(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 Type
    Method
    Description
    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.
    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 buffer
    void
    convertHtmlToFile(String htmlString, String baseUrl, String outFile)
     
    Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document as an object of the Document class that can be further used in other operations requiring this type of objects
    byte[]
    Converts the HTML page from the given URL to a PDF document and returns the PDF document in a memory buffer
    void
    Converts the HTML page from the given URL to a PDF document and writes the rendered PDF document into a file
    Converts an URL to PDF and returns the rendered PDF document as an object of the Document class that can be further used in other operations requiring this type of objects
    Gets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML document
    boolean
    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 converter
    boolean
    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 converter
    boolean
    Gets the flag indicating if the WebGL is enabled in the HTML to PDF converter
    boolean
    Gets the flag indicating if the HTML viewer extensions are executed during HTML to PDF conversion
    Gets the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversion
    Gets an object populated after conversion with the title, keywords, and description of the converted HTML document
    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.
    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 browser
    Returns 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 converter
    The impersonation options applied during navigation in HTML to PDF converter
    int
    Gets the initial height in pixels of the HTML viewer in HTML to PDF converter
    boolean
    Gets the flag indicating if the slow JavaScript script should be interrupted in HTML to PDF converter
    boolean
    Gets the flag indicating if JavaScript execution is enabled in HTML to PDF converter
    Gets the license key string
    boolean
    Gets the a flag indicating if the access to local files is enabled in the HTML to PDF Converter
    int
    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 converter
    Gets the media type of the HTML document used by the HTML to PDF converter
    int
    Gets the minimum height in pixels to be rendered from the HTML document by the HTML to PDF converter
    int
    Gets the navigation timeout in seconds
    Gets the custom user agent to be used when accessing the HTML page
    Gets 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 date
    Gets 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 document
    Gets 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 document
    Gets a reference to the object controlling how the generated PDF is displayed by a PDF viewer
    boolean
    Gets the flag indicating if the HTML to PDF converter will send the custom headers defined by the httpRequestHeaders() property each time an external resource (image, css, etc) referenced by the web page is requested
    int
    Gets the HTML to PDF server port number
    boolean
    Gets the flag indicating if the fonts with PostScript outlines are enabled in HTML during the HTML to PDF conversion
    boolean
    Gets the flag indicating if the HTML to PDF converter should perform a pre-rendering
    Gets a reference to an object encapsulating the proxy options used by HTML to PDF converter to access the HTML document to convert
    Gets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converter
    Gets the HTML to PDF server IP or name
    Gets the HTML to PDF converter service password
    void
    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
    Sets the default HTML document text encoding to be used if there is no charset meta tag defined in the HTML document
    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.
    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
    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 conversion
    void
    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 converter
    void
    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
    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
    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
    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 the httpRequestHeaders() 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 number
    void
    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
    Gets or sets the CSS selector of the HTML element to be rendered to PDF by the HTML to PDF converter.
    void
    setServer(String server)
    Sets the HTML to PDF server IP or name
    void
    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 conversion
    void
    setWebFontsEnabled(boolean enabled)
    Sets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversion
    void
    setWebServiceUrl(String webServiceUrl)
    Sets the HTML to PDF web service URL
    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.
    boolean
    Gets the flag indicating if the SVG fonts are enabled in HTML during the HTML to PDF conversion
    Gets a reference to the object controlling the automatic creation of a table of contents in the generated PDF document
    Gets the conversion triggering mode used by the HTML to PDF converter
    boolean
    Gets the flag indicating if the client library will call the Web service or the TCP service to perform the HTML to PDF conversion
    boolean
    Gets the flag indicating if the Web Fonts are enabled in HTML during the HTML to PDF conversion
    Gets the HTML to PDF web service URL
    boolean
    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

    Methods inherited from class java.lang.Object

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

    • HtmlToPdfConverter

      public HtmlToPdfConverter()
      Constructs a HTML to PDF converter which will connect to localhost on the default port
    • HtmlToPdfConverter

      public HtmlToPdfConverter(String server)
      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

      public HtmlToPdfConverter(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
      Parameters:
      server - the IP address or host name of the HTML to PDF server
      port - the HTML to PDF server port number on localhost
    • HtmlToPdfConverter

      public HtmlToPdfConverter(boolean useWebService, String webServiceUrl)
      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 server
      webServiceUrl - The web service URL when the useWebService parameter is true or the TCP server host name or IP address when the useWebService parameter is false
  • Method Details

    • server

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

      public void setServer(String server)
      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

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

      public void setWebServiceUrl(String webServiceUrl)
      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

      public Proxy 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

      public void setClientProxy(Proxy clientProxy)
      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, the clipHtmlView() 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 the clipHtmlView() 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 the htmlViewerWidth() property of the HtmlToPdfConverter class. If the HTML content is not entirely visible in the HTML viewer at the specified width, the clipHtmlView() 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 the HtmlToPdfConverter 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
    • setNavigatorUserAgent

      public void setNavigatorUserAgent(String navigatorUserAgent)
      Sets the custom user agent to be used when accessing the HTML page. When this property is null or empty the default user agent is used
      Parameters:
      navigatorUserAgent - the custom user agent 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 the htmlViewerWidth() property. The default value of this property is false
      Parameters:
      clipView - the HTML clipping option value
    • licenseKey

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

      public void setLicenseKey(String key)
      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

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

      public void setServicePassword(String password)
      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

      public PdfDocumentOptions 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

      public AuthenticationOptions 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

      public ImpersonationOptions impersonationOptions()
      The impersonation options applied during navigation in HTML to PDF converter
      Returns:
      the object encapsulating the impersonation options
    • pdfDocumentInfo

      public PdfDocumentInfo 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

      public PdfSecurityOptions 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

      public PdfHeaderOptions 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 the PdfDocumentOptions.showHeader() property is true
      Returns:
      the PdfHeaderOptions object controlling the PDF document header properties
    • pdfFooterOptions

      public PdfFooterOptions pdfFooterOptions()
      Gets a reference to an object to control the generated PDF document footer options. The footer is displayed in the generated PDF document only if the PdfDocumentOptions.showFooter() property is true
      Returns:
      the PdfFooterOptions object controlling the PDF document footer properties
    • pdfBookmarkOptions

      public PdfBookmarkOptions 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 the PdfBookmarkOptions.htmlElementSelectors() property of PdfBookmarkOptions class with the CSS selectors of the HTML elements you want to bookmark
      Returns:
      a reference to the object controlling the bookmarks creation
    • htmlElementsMappingOptions

      public HtmlElementsMappingOptions 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, the HtmlElementsMappingOptions.htmlElementSelectors() property of HtmlElementsMappingOptions 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 the HtmlElementsMappingOptions.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

      public TableOfContentsOptions 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

      public PdfFormOptions 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

      public ProxyOptions 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

      public ViewerPreferences 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

      public ConversionSummary conversionSummary()
      Offers summary information about the conversion process. After a successful conversion this property is initialized with an instance of the ConversionSummary class. If the conversion failed this property returns a null value
      Returns:
      conversion process summary
    • htmlDocumentInfo

      public HtmlDocumentInfo 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

      public NameValuePairsCollection 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

      public String mediaType()
      Gets the media type of the HTML document used by the HTML to PDF converter
      Returns:
      the media type used by converter
    • setMediaType

      public void setMediaType(String media)
      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
    • hiddenHtmlElementsSelectors

      public String[] hiddenHtmlElementsSelectors()
      Gets the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversion
      Returns:
      the CSS selectors of the HTML elements to be excluded from rendering during HTML to PDF conversion
    • setHiddenHtmlElementsSelectors

      public void setHiddenHtmlElementsSelectors(String[] hiddenHtmlElementsSelectors)
      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

      public String 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

      public 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. 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

      public String 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

      public 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 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

      public TriggeringMode triggeringMode()
      Gets the conversion triggering mode used by the HTML to PDF converter
      Returns:
      the conversion triggering mode
    • setTriggeringMode

      public void setTriggeringMode(TriggeringMode mode)
      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
    • setNavigationTimeout

      public void setNavigationTimeout(int timeout)
      Sets the HTML to PDF converter navigation timeout in seconds. Default value is 60
      Parameters:
      timeout - the HTML to PDF converter navigation timeout in seconds
    • httpRequestHeaders

      public NameValuePairsCollection 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 to httpRequestHeaders() collection. The persistentHttpRequestHeaders() 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 the persistentHttpRequestHeaders() 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 the httpRequestCookies() 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 the httpRequestHeaders() 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 the httpRequestHeaders() 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

      public NameValuePairsCollection 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 to httpRequestCookies() 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

      public byte[] convertUrl(String url) throws Exception
      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

      public Document convertUrlToPdfDocumentObject(String url) throws Exception
      Converts an URL to PDF and returns the rendered PDF document as an object of the Document class that can be further used in other operations requiring this type of objects
      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:
      the created Document object
      Throws:
      Exception - an exception is thrown if the conversion fails
    • convertUrlToFile

      public void convertUrlToFile(String url, String outFile) throws Exception
      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 system
      outFile - the full path of the file where to write the rendered PDF document
      Throws:
      Exception - an exception is thrown if the conversion fails
    • convertHtml

      public byte[] convertHtml(String html, String baseUrl) throws Exception
      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 PDF
      baseUrl - 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

      public Document convertHtmlToPdfDocumentObject(String html, String baseUrl) throws Exception
      Converts a HTML string to PDF using a base URL to resolve external resources and returns the rendered PDF document as an object of the Document class that can be further used in other operations requiring this type of objects
      Parameters:
      html - the HTML string to convert to PDF
      baseUrl - 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

      public void convertHtmlToFile(String htmlString, String baseUrl, String outFile) throws Exception
      Throws:
      Exception