Package com.evopdf

Class HtmlToSvgConverter

java.lang.Object
com.evopdf.HtmlToSvgConverter

public class HtmlToSvgConverter extends Object
This class offers the necessary methods to create a SVG document from a web page at given URL or from a HTML String. The generated SVG document can be saved into a memory buffer or into a file
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a HTML to SVG converter which will connect to localhost on the default port
    HtmlToSvgConverter(boolean useWebService, String webServiceUrl)
    Constructs a HTML to SVG converter which will connect to a web service URL
    Constructs a HTML to SVG converter which will connect to localhost on the specified port
    Constructs a HTML to SVG converter which will connect to the server specified by IP or by name on the default port
    HtmlToSvgConverter(String server, int port)
    Constructs a HTML to SVG 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 They can be used for example to resolve the IIS Integrated Windows Authentication or other types of IIS authentication
    Gets the java.net.Proxy object to be used when accessing the HTML to SVG 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 converter.
    byte[]
    convertHtml(String html, String baseUrl)
    Converts a HTML String into a SVG document using a base URL to resolve the external resources and returns the rendered SVG document into a memory buffer
    void
    convertHtmlToFile(String html, String baseUrl, String outFile)
    Converts the specified HTML String into a SVG document using a base URL to resolve the external resources and saves the rendered SVG document to the specified file
    byte[]
    Converts an URL to a SVG document and returns the rendered SVG document into a memory buffer
    void
    Converts the specified URL into a SVG document and saves the rendered SVG document to the specified file
    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 converter should try to download all the resources
    boolean
    Gets the flag indicating if the accelerated CSS 3D transformations are enabled in converter.
    boolean
    Gets the flag indicating if the accelerated 2D canvas is enabled in converter
    boolean
    Gets the flag indicating if the HTTP2 protocol is enabled in in HTML to SVG 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 converter
    boolean
    Gets the flag indicating if the HTML viewer extensions are executed during conversion.
    int
    Gets the HTML viewer height in pixels in the HTML to SVG converter
    int
    Gets the preferred HTML viewer width in pixels in HTML to SVG converter
    int
    Gets the HTML viewer zoom percentage in HTML to SVG Converter similar to zoom level in a browser
    Returns the collection of HTTP POST fields to be used when accessing a web page in converter.
    Gets a collection of custom HTTP cookies to be sent by 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 converter to the web server when the web page is requested from a URL.
    The impersonation options applied during navigation
    int
    Gets the initial height in pixels of the HTML viewer in converter
    boolean
    Gets the flag indicating if the slow JavaScript script should be interrupted in converter.
    boolean
    Gets the flag indicating if JavaScript execution is enabled in converter
    Gets the license key string
    boolean
    Gets the a flag indicating if the access to local files is enabled in the HTML to SVG 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 converter
    Gets the media type of the HTML document used by converter.
    int
    Gets the minimum height in pixels to be rendered from the HTML document by converter
    int
    Gets the navigation timeout in seconds
    Gets the custom user agent to be used when accessing the HTML page
    int
    Gets the resolution of the SVG document
    boolean
    Gets flag indicating if the calculated size of the SVG document should be set in the generated document
    boolean
    Gets the flag indicating if the 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 SVG server port number
    boolean
    Gets the flag indicating if the converter should perform a pre-rendering
    Gets a reference to an object encapsulating the proxy options used by converter to access the HTML document to convert
    Gets the CSS selector of the HTML element to be rendered to PDF by converter
    Gets the HTML to SVG server IP or name
    Gets the HTML to SVG converter service password
    void
    setClientProxy(Proxy clientProxy)
    Sets the java.net.Proxy object to be used when accessing the HTML to SVG 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 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 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 converter.
    void
    Sets the flag indicating if the accelerated 2D canvas is enabled in converter.
    void
    setEnableHttp2(boolean enabled)
    Sets the flag indicating if the the HTTP2 protocol is enabled in in HTML to SVG 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 converter.
    void
    setExtensionsEnabled(boolean enabled)
    Sets a flag indicating if the HTML viewer extensions are executed during conversion.
    void
    setHtmlViewerHeight(int viewerHeight)
    Sets the HTML viewer height in pixels in the HTML to SVG converter.
    void
    setHtmlViewerWidth(int viewerWidth)
    Gets or sets the preferred HTML viewer width in pixels in HTML to SVG converter.
    void
    setHtmlViewerZoom(int viewerZoom)
    Sets HTML viewer zoom percentage in HTML to SVG Converter similar to zoom level in a browser.
    void
    setInitialHtmlViewerHeight(int initialHeight)
    Sets the initial height in pixels of the HTML viewer in converter.
    void
    setInterruptSlowJavaScript(boolean interrupt)
    Sets a flag indicating if the slow JavaScript script should be interrupted in converter.
    void
    setJavaScriptEnabled(boolean enabled)
    Sets a flag indicating if JavaScript execution is enabled in converter.
    void
    Sets the license key string received from the vendor in HTML to SVG converter.
    void
    setLocalFilesAccessEnabled(boolean enabled)
    Sets the flag indicating if the access to local files is enabled in the HTML to SVG 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 converter.
    void
    Sets the media type of the HTML document used by converter.
    void
    setMinHtmlViewerHeight(int minHeight)
    Sets the minimum height in pixels to be rendered from the HTML document by converter.
    void
    setNavigationTimeout(int timeout)
    Sets the converter navigation timeout in seconds.
    void
    setNavigatorUserAgent(String navigatorUserAgent)
    Sets the custom user agent to be used when accessing the HTML page.
    void
    Sets resolution of the SVG document
    void
    setOutputSize(boolean setSize)
    Sets flag indicating if the calculated size of the SVG document should be set in the generated document
    void
    setPersistentHttpRequestHeaders(boolean persistentHttpRequestHeaders)
    Sets the flag indicating if the 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 SVG server port number
    void
    setPrerenderEnabled(boolean enabled)
    Sets a flag indicating if the converter should perform a pre-rendering.
    void
    Gets or sets the CSS selector of the HTML element to be rendered to PDF by converter.
    void
    setServer(String server)
    Sets the HTML to SVG server IP or name
    void
    Sets the HTML to SVG converter service password.
    void
    setSvgFontsEnabled(boolean enabled)
    Sets a flag indicating if the SVG fonts are enabled in HTML during conversion.
    void
    Sets the conversion triggering mode used by 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 SVG conversion
    void
    setWebFontsEnabled(boolean enabled)
    Sets the flag indicating if the Web Fonts are enabled in HTML during conversion.
    void
    setWebServiceUrl(String webServiceUrl)
    Sets the HTML to SVG web service URL
    boolean
    Gets the flag indicating if the SVG fonts are enabled in HTML during conversion.
    Gets the conversion triggering mode used by converter
    boolean
    Gets the flag indicating if the client library will call the Web service or the TCP service to perform the HTML to SVG conversion
    boolean
    Gets the flag indicating if the Web Fonts are enabled in HTML during conversion.
    Gets the HTML to SVG web service URL

    Methods inherited from class java.lang.Object

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

    • HtmlToSvgConverter

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

      public HtmlToSvgConverter(String server)
      Constructs a HTML to SVG 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
    • HtmlToSvgConverter

      public HtmlToSvgConverter(int port)
      Constructs a HTML to SVG converter which will connect to localhost on the specified port
      Parameters:
      port - The HTML to PDF server port number on localhost
    • HtmlToSvgConverter

      public HtmlToSvgConverter(String server, int port)
      Constructs a HTML to SVG 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 host
    • HtmlToSvgConverter

      public HtmlToSvgConverter(boolean useWebService, String webServiceUrl)
      Constructs a HTML to SVG 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 SVG server IP or name
      Returns:
      the server IP or name
    • setServer

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

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

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

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

      public void setWebServiceUrl(String webServiceUrl)
      Sets the HTML to SVG 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 SVG 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 SVG 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 SVG 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 SVG 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
    • outputResolution

      public int outputResolution()
      Gets the resolution of the SVG document
      Returns:
      resolution of the SVG document
    • setOutputResolution

      public void setOutputResolution(int dpi)
      Sets resolution of the SVG document
      Parameters:
      dpi - resolution of the SVG document
    • outputSize

      public boolean outputSize()
      Gets flag indicating if the calculated size of the SVG document should be set in the generated document
      Returns:
      the flag value
    • setOutputSize

      public void setOutputSize(boolean setSize)
      Sets flag indicating if the calculated size of the SVG document should be set in the generated document
      Parameters:
      setSize - the flag value to set
    • htmlViewerWidth

      public int htmlViewerWidth()
      Gets the preferred HTML viewer width in pixels in HTML to SVG 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 SVG 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 HtmlToSvgConverter 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 SVG converter
      Returns:
      the HTML viewer height
    • setHtmlViewerHeight

      public void setHtmlViewerHeight(int viewerHeight)
      Sets the HTML viewer height in pixels in the HTML to SVG 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 HtmlToSvgConverter 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 HtmlToSvgConverter 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 SVG 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 SVG 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 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 SVG 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 SVG converter service password
      Returns:
      the service password
    • setServicePassword

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

      public boolean javaScriptEnabled()
      Gets the flag indicating if JavaScript execution is enabled in converter
      Returns:
      the flag indicating if JavaScript execution is enabled in converter
    • setJavaScriptEnabled

      public void setJavaScriptEnabled(boolean enabled)
      Sets a flag indicating if JavaScript execution is enabled in 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 converter. The default value is false
      Returns:
      the flag indicating if the accelerated CSS 3D transformations are enabled in converter
    • setEnable3DTransformations

      public void setEnable3DTransformations(boolean enabled)
      Gets or sets a flag indicating if the accelerated CSS 3D transformations are enabled in 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 converter
      Returns:
      the flag indicating if the WebGL is enabled in converter
    • setEnableWebGL

      public void setEnableWebGL(boolean enabled)
      Sets a flag indicating if the WebGL is enabled in 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 converter
      Returns:
      the flag indicating if the accelerated 2D canvas is enabled in converter
    • setEnableAccelerated2DCanvas

      public void setEnableAccelerated2DCanvas(boolean enabled)
      Sets the flag indicating if the accelerated 2D canvas is enabled in 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 SVG converter
      Returns:
      flag indicating if the access to local files is enabled in the HTML to SVG converter
    • setLocalFilesAccessEnabled

      public void setLocalFilesAccessEnabled(boolean enabled)
      Sets the flag indicating if the access to local files is enabled in the HTML to SVG converter. The default value is true
      Parameters:
      enabled - the flag value to set
    • 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 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
      Returns:
      the object encapsulating the impersonation options
    • proxyOptions

      public ProxyOptions proxyOptions()
      Gets a reference to an object encapsulating the proxy options used by converter to access the HTML document to convert
      Returns:
      a reference to an object encapsulating the proxy options used by converter to access the HTML document to convert
    • httpPostFields

      public NameValuePairsCollection httpPostFields()
      Returns the collection of HTTP POST fields to be used when accessing a web page in 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 converter
    • mediaType

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

      public void setMediaType(String media)
      Sets the media type of the HTML document used by 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 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 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 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 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 SVG 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 SVG converter. The property has effect only with NE version of the server. The default value is false
      Parameters:
      enabled - the flag value to set
    • extensionsEnabled

      public boolean extensionsEnabled()
      Gets the flag indicating if the HTML viewer extensions are executed during 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 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 converter should try to download all the resources
      Returns:
      the flag indicating if the converter should try to download all the resources
    • setDownloadAllResources

      public void setDownloadAllResources(boolean download)
      Sets the flag indicating if the 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 converter should perform a pre-rendering
      Returns:
      the flag indicating if the converter should perform a pre-rendering
    • setPrerenderEnabled

      public void setPrerenderEnabled(boolean enabled)
      Sets a flag indicating if the 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 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 converter. The default value is false and the scripts are not interrupted
      Parameters:
      interrupt - the flag value to set
    • renderedHtmlElementSelector

      public String renderedHtmlElementSelector()
      Gets the CSS selector of the HTML element to be rendered to PDF by 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 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 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 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 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 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 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 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
    • triggeringMode

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

      public void setTriggeringMode(TriggeringMode mode)
      Sets the conversion triggering mode used by 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 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 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 converter navigation timeout in seconds. Default value is 60
      Parameters:
      timeout - the converter navigation timeout in seconds
    • httpRequestHeaders

      public NameValuePairsCollection httpRequestHeaders()
      Gets a collection of custom HTTP headers to be sent by 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 converter to the web server
    • persistentHttpRequestHeaders

      public boolean persistentHttpRequestHeaders()
      Gets the flag indicating if the 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 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 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 converter to the web server when the web page to convert and the resources (image, css, etc) referenced by the web page are requested
    • convertUrl

      public byte[] convertUrl(String url) throws Exception
      Converts an URL to a SVG document and returns the rendered SVG document into a memory buffer
      Parameters:
      url - the URL of the web page to be converted to PDF. The URL can be also the full path
      Returns:
      a memory buffer containing the SVG 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 into a SVG document using a base URL to resolve the external resources and returns the rendered SVG document into a memory buffer
      Parameters:
      html - The HTML String to convert to SVG
      baseUrl - This parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the HTML String. If there are not relative URLs in the HTML code this parameter can be empty or null
      Returns:
      a memory buffer containing the SVG document
      Throws:
      Exception - an exception is thrown if the conversion fails
    • convertUrlToFile

      public void convertUrlToFile(String url, String outFile) throws Exception
      Converts the specified URL into a SVG document and saves the rendered SVG document to the specified file
      Parameters:
      url - The URL of the web page to be converted to PDF. The URL can be also the full path of a HTML file from the local file system
      outFile - The output file where to save the generated SVG document
      Throws:
      Exception - an exception is thrown if the conversion fails
    • convertHtmlToFile

      public void convertHtmlToFile(String html, String baseUrl, String outFile) throws Exception
      Converts the specified HTML String into a SVG document using a base URL to resolve the external resources and saves the rendered SVG document to the specified file
      Parameters:
      html - the HTML String to convert
      baseUrl - this parameter allows the converter to determine the full URLs from relative URLs for images and CSS files appearing in the HTML String. If there are not relative URLs in the HTML code this parameter can be empty or null
      outFile - The output file where to save the generated SVG document
      Throws:
      Exception - an exception is thrown if the conversion fails