Package com.evopdf
Class HtmlToImageConverter
java.lang.Object
com.evopdf.HtmlToImageConverter
This class offers the necessary methods to create a raster image from a web
page at given URL or from a HTML string. The generated image can be saved
into a memory buffer or into a file
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a HTML to Image converter which will connect to localhost on the default portHtmlToImageConverter
(boolean useWebService, String webServiceUrl) Constructs a HTML to Image converter which will connect to a web service URLHtmlToImageConverter
(int port) Constructs a HTML to Image converter which will connect to localhost on the specified portHtmlToImageConverter
(String server) Constructs a HTML to Image converter which will connect to the server specified by IP or by name on the default portHtmlToImageConverter
(String server, int port) Constructs a HTML to Image 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 They can be used for example to resolve the IIS Integrated Windows Authentication or other types of IIS authenticationGets the java.net.Proxy object to be used when accessing the HTML to Image Web Service through a proxy server.boolean
Gets a flag indicating if the HTML content is clipped by HTML viewer window widthint
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 htmlString, String baseUrl, ImageType format) Converts a HTML string to an image having the given format using a base URL to resolve external resources and returns the rendered image into a memory buffervoid
convertHtmlToFile
(String htmlString, String baseUrl, ImageType format, String outFile) Converts a HTML string to an image having the given format using a base URL to resolve external resources and writes the rendered image into a filebyte[][]
convertHtmlToImageTiles
(String htmlString, String baseUrl, ImageType format) Converts a HTML string to a set of images using a base URL to resolve external resources.byte[]
convertUrl
(String url, ImageType format) Converts an URL to an image having the given image format and returns the rendered image into a memory buffervoid
convertUrlToFile
(String url, ImageType format, String outFile) Converts an URL to an image having the given format and writes the rendered image into a filebyte[][]
convertUrlToImageTiles
(String url, ImageType format) Converts an URL to a set of images.Gets 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 converter should try to download all the resourcesboolean
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 converterboolean
Gets the flag indicating if the HTTP2 protocol is enabled in in HTML to Image 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 converterboolean
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 image converterint
Gets the preferred HTML viewer width in pixels in HTML to Image converterint
Gets the HTML viewer zoom percentage in HTML to Image Converter similar to zoom level in a browserReturns 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.int
Gets the maximum height in pixels of an image part in converterThe impersonation options applied during navigationint
Gets the initial height in pixels of the HTML viewer in converterboolean
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 converterGets the license key stringboolean
Gets the a flag indicating if the access to local files is enabled in the HTML to Image 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 converterGets 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 converterint
Gets the navigation timeout in secondsGets the custom user agent to be used when accessing the HTML pageboolean
Gets the flag indicating if the 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 Image server port numberboolean
Gets the flag indicating if the converter should perform a pre-renderingGets a reference to an object encapsulating the proxy options used by converter to access the HTML document to convertGets the CSS selector of the HTML element to be rendered to PDF by converterserver()
Gets the HTML to Image server IP or nameGets the HTML to image converter service passwordvoid
setClientProxy
(Proxy clientProxy) Sets the java.net.Proxy object to be used when accessing the HTML to Image 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
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 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
setEnableAccelerated2DCanvas
(boolean enabled) 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 Image 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 image converter.void
setHtmlViewerWidth
(int viewerWidth) Gets or sets the preferred HTML viewer width in pixels in HTML to image converter.void
setHtmlViewerZoom
(int viewerZoom) Sets HTML viewer zoom percentage in HTML to Image Converter similar to zoom level in a browser.void
setImagePartSize
(int height) Sets the maximum height in pixels of an image part in convertervoid
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
setLicenseKey
(String key) Sets the license key string received from the vendor in HTML to image converter.void
setLocalFilesAccessEnabled
(boolean enabled) Sets the flag indicating if the access to local files is enabled in the HTML to Image 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 converter.void
setMediaType
(String media) 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
setPersistentHttpRequestHeaders
(boolean persistentHttpRequestHeaders) Sets the flag indicating if the 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 Image server port numbervoid
setPrerenderEnabled
(boolean enabled) Sets a flag indicating if the 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 converter.void
Sets the HTML to Image server IP or namevoid
setServicePassword
(String password) Sets the HTML to image converter service password.void
setSvgFontsEnabled
(boolean enabled) Sets a flag indicating if the SVG fonts are enabled in HTML during conversion.void
setTiledImageEnabled
(boolean tiledImageEnabled) Sets the flag indicating if the image captured by converter is tiledvoid
setTransparentBackground
(boolean transparentBackground) Sets the flag indicating if the resulted image will have a transparent background when converting a HTML document without a defined background color or image.void
Sets the conversion triggering mode used by convertervoid
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 Image conversionvoid
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 Image web service URLboolean
Gets the flag indicating if the SVG fonts are enabled in HTML during conversion.boolean
Gets the flag indicating if the image captured by converter is tiledboolean
Gets the flag indicating if the resulted image will have a transparent background when converting a HTML document without a defined background color or imageGets the conversion triggering mode used by converterboolean
Gets the flag indicating if the client library will call the Web service or the TCP service to perform the HTML to Image conversionboolean
Gets the flag indicating if the Web Fonts are enabled in HTML during conversion.Gets the HTML to Image web service URL
-
Constructor Details
-
HtmlToImageConverter
public HtmlToImageConverter()Constructs a HTML to Image converter which will connect to localhost on the default port -
HtmlToImageConverter
Constructs a HTML to Image 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
-
HtmlToImageConverter
public HtmlToImageConverter(int port) Constructs a HTML to Image converter which will connect to localhost on the specified port- Parameters:
port
- The HTML to PDF server port number on localhost
-
HtmlToImageConverter
Constructs a HTML to Image 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 host
-
HtmlToImageConverter
Constructs a HTML to Image 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 Image server IP or name- Returns:
- the server IP or name
-
setServer
Sets the HTML to Image server IP or name- Parameters:
server
- the server IP or name
-
port
public int port()Gets the HTML to Image server port number- Returns:
- the server port number
-
setPort
public void setPort(int port) Sets the HTML to Image server port number- Parameters:
port
- the server port number
-
webServiceUrl
Gets the HTML to Image web service URL- Returns:
- the web service URL
-
setWebServiceUrl
Sets the HTML to Image 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 Image 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 Image conversion- Parameters:
useWebService
- the use web service option
-
clientProxy
Gets the java.net.Proxy object to be used when accessing the HTML to Image 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 Image 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 Image 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 image 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 HtmlToImageConverter 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 image converter- Returns:
- the HTML viewer height
-
setHtmlViewerHeight
public void setHtmlViewerHeight(int viewerHeight) Sets the HTML viewer height in pixels in the HTML to image 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 theHtmlToImageConverter
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 theHtmlToImageConverter
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 Image 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 Image 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 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 image 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 image converter service password- Returns:
- the service password
-
setServicePassword
Sets the HTML to image converter service password. You have to set this property if the HTML to image 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 Image converter- Returns:
- flag indicating if the access to local files is enabled in the HTML to Image converter
-
setLocalFilesAccessEnabled
public void setLocalFilesAccessEnabled(boolean enabled) Sets the flag indicating if the access to local files is enabled in the HTML to Image converter. The default value is true- Parameters:
enabled
- the flag value to set
-
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
The impersonation options applied during navigation- Returns:
- the object encapsulating the impersonation options
-
tiledImageEnabled
public boolean tiledImageEnabled()Gets the flag indicating if the image captured by converter is tiled- Returns:
- the flag value
-
setTiledImageEnabled
public void setTiledImageEnabled(boolean tiledImageEnabled) Sets the flag indicating if the image captured by converter is tiled- Parameters:
tiledImageEnabled
- the flag value to set
-
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
-
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
-
transparentBackground
public boolean transparentBackground()Gets the flag indicating if the resulted image will have a transparent background when converting a HTML document without a defined background color or image- Returns:
- the flag value
-
setTransparentBackground
public void setTransparentBackground(boolean transparentBackground) Sets the flag indicating if the resulted image will have a transparent background when converting a HTML document without a defined background color or image. This property is false by default- Parameters:
transparentBackground
- the flag value to set
-
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
Gets the media type of the HTML document used by converter.- Returns:
- the media type used by converter
-
setMediaType
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 Image 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 Image 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
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
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
-
imagePartSize
public int imagePartSize()Gets the maximum height in pixels of an image part in 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 converter- Parameters:
height
- the maximum height in pixels of an image part
-
triggeringMode
Gets the conversion triggering mode used by converter- Returns:
- the conversion triggering mode
-
setTriggeringMode
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
-
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 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 converter to the web server
-
persistentHttpRequestHeaders
public boolean persistentHttpRequestHeaders()Gets the flag indicating if the 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 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 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 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
Converts an URL to an image having the given image format and returns the rendered image into a memory buffer- Parameters:
url
- the URL of the HTML document to convert to image. The full path of a HTML file in the local file system is accepted as an URL if necessaryformat
- the image format- Returns:
- a memory buffer containing the the generated image
- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtml
Converts a HTML string to an image having the given format using a base URL to resolve external resources and returns the rendered image into a memory buffer- Parameters:
htmlString
- the HTML string to convert to imagebaseUrl
- 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 HTMLformat
- the image format- Returns:
- a memory buffer containing the the generated image
- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertUrlToFile
Converts an URL to an image having the given format and writes the rendered image into a file- Parameters:
url
- the URL of the HTML document to convert to image. The full path of a HTML file in the local file system is accepted as an URL if necessaryformat
- the image formatoutFile
- the full path of the file where to write the rendered image- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtmlToFile
public void convertHtmlToFile(String htmlString, String baseUrl, ImageType format, String outFile) throws Exception Converts a HTML string to an image having the given format using a base URL to resolve external resources and writes the rendered image into a file- Parameters:
htmlString
- the HTML string to be convert to imagebaseUrl
- 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 HTMLformat
- the image formatoutFile
- the full path of the file where to write the rendered image- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertUrlToImageTiles
Converts an URL to a set of images. The image is tiled to avoid working with very large images in memory- Parameters:
url
- the URL of the HTML document to convert to image. The full path of a HTML file in the local file system is accepted as an URL if necessaryformat
- the image format- Returns:
- the generated image tiles in memory buffers
- Throws:
Exception
- an exception is thrown if the conversion fails
-
convertHtmlToImageTiles
public byte[][] convertHtmlToImageTiles(String htmlString, String baseUrl, ImageType format) throws Exception Converts a HTML string to a set of images using a base URL to resolve external resources. The image is tiled to avoid working with very large images in memory- Parameters:
htmlString
- the HTML string to convert to imagebaseUrl
- he 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 HTMLformat
- the image format- Returns:
- the generated image tiles in memory buffers
- Throws:
Exception
- an exception is thrown if the conversion fails
-