Constructor
public HtmlToImageClient(String userName, String apiKey)
Constructor for the PDFCrowd API client.
- Parameters:
-
-
userName
- Your username at PDFCrowd. -
apiKey
- Your API key.
-
Conversion Format
public HtmlToImageClient setOutputFormat(String outputFormat)
The format of the output file.
- Parameter:
-
-
outputFormat
- Allowed Values:
-
-
png
-
jpg
-
gif
-
tiff
-
bmp
-
ico
-
ppm
-
pgm
-
pbm
-
pnm
-
psb
-
pct
-
ras
-
tga
-
sgi
-
sun
-
webp
-
- Default:
-
png
-
Conversion Input
public byte[] convertUrl(String url)
Convert a web page.
- Parameter:
-
-
url
- The address of the web page to convert.- Constraint:
-
- Supported protocols are http:// and https://.
-
- Returns:
- byte[] - Byte array containing the conversion output.
public void convertUrlToStream(String url, OutputStream outStream)
Convert a web page and write the result to an output stream.
- Parameters:
-
-
url
- The address of the web page to convert.- Constraint:
-
- Supported protocols are http:// and https://.
-
outStream
(OutputStream) - The output stream that will contain the conversion output.
-
public void convertUrlToFile(String url, String filePath) throws IOException
Convert a web page and write the result to a local file.
- Parameters:
-
-
url
- The address of the web page to convert.- Constraint:
-
- Supported protocols are http:// and https://.
-
filePath
- The output file path.
-
public byte[] convertFile(String file)
Convert a local file.
- Parameter:
-
-
file
- The path to a local file to convert.
The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip).
If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets.- Constraints:
-
- The file must exist and not be empty.
- The file name must have a valid extension.
-
- Returns:
- byte[] - Byte array containing the conversion output.
public void convertFileToStream(String file, OutputStream outStream)
Convert a local file and write the result to an output stream.
- Parameters:
-
-
file
- The path to a local file to convert.
The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip).
If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets.- Constraints:
-
- The file must exist and not be empty.
- The file name must have a valid extension.
-
outStream
(OutputStream) - The output stream that will contain the conversion output.
-
public void convertFileToFile(String file, String filePath) throws IOException
Convert a local file and write the result to a local file.
- Parameters:
-
-
file
- The path to a local file to convert.
The file can be either a single file or an archive (.tar.gz, .tar.bz2, or .zip).
If the HTML document refers to local external assets (images, style sheets, javascript), zip the document together with the assets.- Constraints:
-
- The file must exist and not be empty.
- The file name must have a valid extension.
-
filePath
- The output file path.
-
public byte[] convertString(String text)
Convert a string.
- Parameter:
-
-
text
- The string content to convert.
-
- Returns:
- byte[] - Byte array containing the conversion output.
public void convertStringToStream(String text, OutputStream outStream)
Convert a string and write the output to an output stream.
- Parameters:
-
-
text
- The string content to convert. -
outStream
(OutputStream) - The output stream that will contain the conversion output.
-
public void convertStringToFile(String text, String filePath) throws IOException
Convert a string and write the output to a file.
- Parameters:
-
-
text
- The string content to convert. -
filePath
- The output file path.
-
public byte[] convertStream(InputStream inStream) throws IOException
Convert the contents of an input stream.
- Parameter:
-
-
inStream
(InputStream) - The input stream with source data.
The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).
The archive can contain HTML code and its external assets (images, style sheets, javascript).
-
- Returns:
- byte[] - Byte array containing the conversion output.
public void convertStreamToStream(InputStream inStream, OutputStream outStream) throws IOException
Convert the contents of an input stream and write the result to an output stream.
- Parameters:
-
-
inStream
(InputStream) - The input stream with source data.
The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).
The archive can contain HTML code and its external assets (images, style sheets, javascript). -
outStream
(OutputStream) - The output stream that will contain the conversion output.
-
public void convertStreamToFile(InputStream inStream, String filePath) throws IOException
Convert the contents of an input stream and write the result to a local file.
- Parameters:
-
-
inStream
(InputStream) - The input stream with source data.
The stream can contain either HTML code or an archive (.zip, .tar.gz, .tar.bz2).
The archive can contain HTML code and its external assets (images, style sheets, javascript). -
filePath
- The output file path.
-
public HtmlToImageClient setZipMainFilename(String filename)
Set the file name of the main HTML document stored in the input archive. If not specified, the first HTML file in the archive is used for conversion. Use this method if the input archive contains multiple HTML documents.
- Parameter:
-
-
filename
- The file name.
-
Image Output
public HtmlToImageClient setScreenshotWidth(int width)
Set the output image width in pixels.
- Parameter:
-
-
width
(int)- Constraint:
-
- The accepted range is 96-65000.
- Default:
-
1024
-
- Example:
-
-
Full HD width:
setScreenshotWidth(1920)
-
Full HD width:
public HtmlToImageClient setScreenshotHeight(int height)
Set the output image height in pixels. If it is not specified, actual document height is used.
- Parameter:
-
-
height
(int)- Constraint:
-
- Must be a positive integer.
-
- Example:
-
-
Full HD height:
setScreenshotHeight(1080)
-
Full HD height:
public HtmlToImageClient setScaleFactor(int factor)
Set the scaling factor (zoom) for the output image.
- Parameter:
-
-
factor
(int) - The percentage value.- Constraint:
-
- Must be a positive integer.
- Default:
-
100
-
- Example:
-
-
Reduce image for thumbnails:
setScaleFactor(50)
-
Reduce image for thumbnails:
public HtmlToImageClient setBackgroundColor(String color)
The output image background color.
- Availability:
- API client >= 5.0.0, converter >= 20.10. See versioning.
- Parameter:
-
-
color
- Constraint:
-
- The value must be in RRGGBB or RRGGBBAA hexadecimal format.
-
- Examples:
-
-
red color:
setBackgroundColor("FF0000")
-
fully transparent background:
setBackgroundColor("00000000")
-
green color with 50% opacity:
setBackgroundColor("00ff0080")
-
green color:
setBackgroundColor("00ff00")
-
red color:
General Options
public HtmlToImageClient setUsePrintMedia(boolean value)
Use the print version of the page if available (@media print).
- Parameter:
-
-
value
(bool) - Set totrue
to use the print version of the page.- Default:
-
false
-
public HtmlToImageClient setNoBackground(boolean value)
Do not print the background graphics.
- Parameter:
-
-
value
(bool) - Set totrue
to disable the background graphics.- Default:
-
false
-
public HtmlToImageClient setDisableJavascript(boolean value)
Do not execute JavaScript.
- Parameter:
-
-
value
(bool) - Set totrue
to disable JavaScript in web pages.- Default:
-
false
-
public HtmlToImageClient setDisableImageLoading(boolean value)
Do not load images.
- Parameter:
-
-
value
(bool) - Set totrue
to disable loading of images.- Default:
-
false
-
public HtmlToImageClient setDisableRemoteFonts(boolean value)
Disable loading fonts from remote sources.
- Parameter:
-
-
value
(bool) - Set totrue
disable loading remote fonts.- Default:
-
false
-
public HtmlToImageClient setUseMobileUserAgent(boolean value)
Use a mobile user agent.
- Availability:
- API client >= 5.3.0, converter >= 20.10. See versioning.
- Parameter:
-
-
value
(bool) - Set totrue
to use a mobile user agent.- Default:
-
false
-
public HtmlToImageClient setLoadIframes(String iframes)
Specifies how iframes are handled.
- Availability:
- API client >= 5.0.0, converter >= 20.10. See versioning.
- Parameter:
-
-
iframes
- Allowed Values:
-
-
all
— All iframes are loaded. -
same-origin
— Only iframes with the same origin as the main page are loaded. -
none
— Iframe loading is disabled.
-
- Default:
-
all
-
public HtmlToImageClient setBlockAds(boolean value)
Try to block ads. Enabling this option can produce smaller output and speed up the conversion.
- Parameter:
-
-
value
(bool) - Set totrue
to block ads in web pages.- Default:
-
false
-
public HtmlToImageClient setDefaultEncoding(String encoding)
Set the default HTML content text encoding.
- Parameter:
-
-
encoding
- The text encoding of the HTML content.- Default:
-
auto detect
-
- Examples:
-
-
Set to use Latin-2 encoding:
setDefaultEncoding("iso8859-2")
-
Set to use UTF-8 encoding:
setDefaultEncoding("utf-8")
-
Set to use Latin-2 encoding:
public HtmlToImageClient setLocale(String locale)
Set the locale for the conversion. This may affect the output format of dates, times and numbers.
- Availability:
- API client >= 5.0.0, converter >= 20.10. See versioning.
- Parameter:
-
-
locale
- The locale code according to ISO 639.- Default:
-
en-US
-
- Example:
-
-
Set to use Japanese locale:
setLocale("ja-JP")
-
Set to use Japanese locale:
public HtmlToImageClient setHttpAuth(String userName, String password)
Set credentials to access HTTP base authentication protected websites.
- Parameters:
-
-
userName
- Set the HTTP authentication user name. -
password
- Set the HTTP authentication password.
-
public HtmlToImageClient setVerifySslCertificates(boolean value)
Do not allow insecure HTTPS connections.
- Parameter:
-
-
value
(bool) - Set totrue
to enable SSL certificate verification.- Default:
-
false
-
public HtmlToImageClient setFailOnMainUrlError(boolean failOnError)
Abort the conversion if the main URL HTTP status code is greater than or equal to 400.
- Parameter:
-
-
failOnError
(bool) - Set totrue
to abort the conversion.- Default:
-
false
-
public HtmlToImageClient setFailOnAnyUrlError(boolean failOnError)
Abort the conversion if any of the sub-request HTTP status code is greater than or equal to 400 or if some sub-requests are still pending. See details in a debug log.
- Parameter:
-
-
failOnError
(bool) - Set totrue
to abort the conversion.- Default:
-
false
-
public HtmlToImageClient setNoXpdfcrowdHeader(boolean value)
Do not send the X-Pdfcrowd HTTP header in PDFCrowd HTTP requests.
- Parameter:
-
-
value
(bool) - Set totrue
to disable sending X-Pdfcrowd HTTP header.- Default:
-
false
-
public HtmlToImageClient setCustomCss(String css)
Apply custom CSS to the input HTML document. It allows you to modify the visual appearance and layout of your HTML content dynamically. Tip: Using !important
in custom CSS provides a way to prioritize and override conflicting styles.
- Availability:
- API client >= 5.14.0, converter >= 20.10. See versioning.
- Parameter:
-
-
css
- A string containing valid CSS.
-
- Examples:
-
-
Set the page background color to gray:
setCustomCss("body { background-color: gray; }")
-
Do not show
nav
HTML elements and the element withad-block
ID in the output PDF:setCustomCss("nav, #ad-block { display: none !important; }")
-
Set the page background color to gray:
public HtmlToImageClient setCustomJavascript(String javascript)
Run a custom JavaScript after the document is loaded and ready to print. The script is intended for post-load DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.
- Parameter:
-
-
javascript
- A string containing a JavaScript code.
-
- Example:
-
-
Set the page background color to gray:
setCustomJavascript("document.body.style.setProperty('background-color', 'gray', 'important')")
-
Set the page background color to gray:
public HtmlToImageClient setOnLoadJavascript(String javascript)
Run a custom JavaScript right after the document is loaded. The script is intended for early DOM manipulation (add/remove elements, update CSS, ...). In addition to the standard browser APIs, the custom JavaScript code can use helper functions from our JavaScript library.
- Parameter:
-
-
javascript
- A string containing a JavaScript code.
-
- Example:
-
-
Set the page background color to gray:
setOnLoadJavascript("document.body.style.setProperty('background-color', 'gray', 'important')")
-
Set the page background color to gray:
public HtmlToImageClient setCustomHttpHeader(String header)
Set a custom HTTP header to be included in all requests made by the converter.
- Parameter:
-
-
header
- Constraint:
-
- A string containing the header name and value separated by a colon.
-
- Example:
-
-
API client tracking header:
setCustomHttpHeader("X-My-Client-ID:k2017-12345")
-
API client tracking header:
public HtmlToImageClient setJavascriptDelay(int delay)
Wait the specified number of milliseconds to finish all JavaScript after the document is loaded. Your license defines the maximum wait time by "Max Delay" parameter.
- Parameter:
-
-
delay
(int) - The number of milliseconds to wait.- Constraint:
-
- Must be a positive integer or 0.
- Default:
-
200
-
- Example:
-
-
Wait for 2 seconds:
setJavascriptDelay(2000)
-
Wait for 2 seconds:
public HtmlToImageClient setElementToConvert(String selectors)
Convert only the specified element from the main document and its children. The element is specified by one or more CSS selectors. If the element is not found, the conversion fails. If multiple elements are found, the first one is used.
- Parameter:
-
-
selectors
- One or more CSS selectors separated by commas.
-
- Examples:
-
-
The first element with the id
main-content
is converted:setElementToConvert("#main-content")
-
The first element with the class name
main-content
is converted:setElementToConvert(".main-content")
-
The first element with the tag name
table
is converted:setElementToConvert("table")
-
The first element with the tag name
table
or with the idmain-content
is converted:setElementToConvert("table, #main-content")
-
The first element
<p class="article">
within<div class="user-panel main">
is converted:setElementToConvert("div.user-panel.main p.article")
-
The first element with the id
public HtmlToImageClient setElementToConvertMode(String mode)
Specify the DOM handling when only a part of the document is converted. This can affect the CSS rules used.
- Parameter:
-
-
mode
- Allowed Values:
-
-
cut-out
— The element and its children are cut out of the document. -
remove-siblings
— All element's siblings are removed. -
hide-siblings
— All element's siblings are hidden.
-
- Default:
-
cut-out
-
public HtmlToImageClient setWaitForElement(String selectors)
Wait for the specified element in a source document. The element is specified by one or more CSS selectors. The element is searched for in the main document and all iframes. If the element is not found, the conversion fails. Your license defines the maximum wait time by "Max Delay" parameter.
- Parameter:
-
-
selectors
- One or more CSS selectors separated by commas.
-
- Examples:
-
-
Wait until an element with the id
main-content
is found:setWaitForElement("#main-content")
-
Wait until an element with the class name
main-content
is found:setWaitForElement(".main-content")
-
Wait until an element with the tag name
table
is found:setWaitForElement("table")
-
Wait until an element with the tag name
table
or with the idmain-content
is found:setWaitForElement("table, #main-content")
-
Wait until
<p class="article">
is found within<div class="user-panel main">
:setWaitForElement("div.user-panel.main p.article")
-
Wait until an element with the id
public HtmlToImageClient setAutoDetectElementToConvert(boolean value)
The main HTML element for conversion is detected automatically.
- Availability:
- API client >= 5.5.0, converter >= 20.10. See versioning.
- Parameter:
-
-
value
(bool) - Set totrue
to detect the main element.- Default:
-
false
-
public HtmlToImageClient setReadabilityEnhancements(String enhancements)
The input HTML is automatically enhanced to improve the readability.
- Availability:
- API client >= 5.5.0, converter >= 20.10. See versioning.
- Parameter:
-
-
enhancements
- Allowed Values:
-
-
none
— No enhancements are used. -
readability-v1
— Version 1 of the enhancements is used. -
readability-v2
— Version 2 of the enhancements is used. -
readability-v3
— Version 3 of the enhancements is used. -
readability-v4
— Version 4 of the enhancements is used.
-
- Default:
-
none
-
Data
Methods related to HTML template rendering.
public HtmlToImageClient setDataString(String dataString)
Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
- Parameter:
-
-
dataString
- The input data string.
-
- Example:
-
-
Template variables for mail merge:
setDataString("{"recipient": "Anna May", "sender": "John Doe"}")
-
Template variables for mail merge:
public HtmlToImageClient setDataFile(String dataFile)
Load the input data for template rendering from the specified file. The data format can be JSON, XML, YAML or CSV.
- Parameter:
-
-
dataFile
- The file path to a local file containing the input data.
-
- Example:
-
-
External data for template rendering:
setDataFile("/home/user/john/data.json")
-
External data for template rendering:
public HtmlToImageClient setDataFormat(String dataFormat)
Specify the input data format.
- Parameter:
-
-
dataFormat
- The data format.- Allowed Values:
-
-
auto
— the data format is auto detected -
json
-
xml
-
yaml
-
csv
-
- Default:
-
auto
-
public HtmlToImageClient setDataEncoding(String encoding)
Set the encoding of the data file set by setDataFile.
- Parameter:
-
-
encoding
- The data file encoding.- Default:
-
utf-8
-
- Example:
-
-
Set to use Latin-2 encoding:
setDataEncoding("iso8859-2")
-
Set to use Latin-2 encoding:
public HtmlToImageClient setDataIgnoreUndefined(boolean value)
Ignore undefined variables in the HTML template. The default mode is strict so any undefined variable causes the conversion to fail. You can use {% if variable is defined %} to check if the variable is defined.
- Parameter:
-
-
value
(bool) - Set totrue
to ignore undefined variables.- Default:
-
false
-
public HtmlToImageClient setDataAutoEscape(boolean value)
Auto escape HTML symbols in the input data before placing them into the output.
- Parameter:
-
-
value
(bool) - Set totrue
to turn auto escaping on.- Default:
-
false
-
public HtmlToImageClient setDataTrimBlocks(boolean value)
Auto trim whitespace around each template command block.
- Parameter:
-
-
value
(bool) - Set totrue
to turn auto trimming on.- Default:
-
false
-
public HtmlToImageClient setDataOptions(String options)
csv_delimiter
- The CSV data delimiter, the default is,
.xml_remove_root
- Remove the root XML element from the input data.data_root
- The name of the root element inserted into the input data without a root node (e.g. CSV), the default isdata
.
- Parameter:
-
-
options
- Comma separated list of options.
-
- Examples:
-
-
Use semicolon to separate CSV data:
setDataOptions("csv_delimiter=;")
-
Name the root of data
rows
and use the name in the template loop {% for row in rows %}...{% endfor %}:setDataOptions("data_root=rows")
-
Remove XML root so it the HTML template can be more simple:
setDataOptions("xml_remove_root=1")
-
Use semicolon to separate CSV data:
Miscellaneous
public HtmlToImageClient setDebugLog(boolean value)
Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method or available in conversion statistics.
- Parameter:
-
-
value
(bool) - Set totrue
to enable the debug logging.- Default:
-
false
-
public String getDebugLogUrl()
Get the URL of the debug log for the last conversion.
- Returns:
- String - The link to the debug log.
public int getRemainingCreditCount()
Get the number of conversion credits available in your account.
This method can only be called after a call to one of the convertXtoY methods.
The returned value can differ from the actual count if you run parallel conversions.
The special value 999999
is returned if the information is not available.
- Returns:
- int - The number of credits.
public int getConsumedCreditCount()
Get the number of credits consumed by the last conversion.
- Returns:
- int - The number of credits.
public String getJobId()
Get the job id.
- Returns:
- String - The unique job identifier.
public int getOutputSize()
Get the size of the output in bytes.
- Returns:
- int - The count of bytes.
public String getVersion()
Get the version details.
- Returns:
- String - API version, converter version, and client version.
public HtmlToImageClient setTag(String tag)
Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
- Parameter:
-
-
tag
- A string with the custom tag.
-
- Example:
-
-
Track job in analytics:
setTag("client-1234")
-
Track job in analytics:
public HtmlToImageClient setHttpProxy(String proxy)
A proxy server used by the conversion process for accessing the source URLs with HTTP scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
- Parameter:
-
-
proxy
- Constraint:
-
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
-
- Examples:
-
-
Corporate proxy server:
setHttpProxy("myproxy.com:8080")
-
Direct IP proxy connection:
setHttpProxy("113.25.84.10:33333")
-
Corporate proxy server:
public HtmlToImageClient setHttpsProxy(String proxy)
A proxy server used by the conversion process for accessing the source URLs with HTTPS scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
- Parameter:
-
-
proxy
- Constraint:
-
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
-
- Examples:
-
-
Secure proxy for HTTPS:
setHttpsProxy("myproxy.com:443")
-
Direct secure proxy IP:
setHttpsProxy("113.25.84.10:44333")
-
Secure proxy for HTTPS:
public HtmlToImageClient setClientCertificate(String certificate)
A client certificate to authenticate the converter on your web server. The certificate is used for two-way SSL/TLS authentication and adds extra security.
- Parameter:
-
-
certificate
- The file must be in PKCS12 format.- Constraint:
-
- The file must exist and not be empty.
-
- Example:
-
-
Custom CA certificate path:
setClientCertificate("/home/user/john/pdfcrowd.crt")
-
Custom CA certificate path:
public HtmlToImageClient setClientCertificatePassword(String password)
A password for PKCS12 file with a client certificate if it is needed.
- Parameter:
-
-
password
-
- Example:
-
-
PKCS12 certificate password:
setClientCertificatePassword("123456")
-
PKCS12 certificate password:
Tweaks
Expert options for fine-tuning output.
public HtmlToImageClient setMaxLoadingTime(int maxTime)
Set the maximum time to load the page and its resources. After this time, all requests will be considered successful. This can be useful to ensure that the conversion does not timeout. Use this method if there is no other way to fix page loading.
- Availability:
- API client >= 5.15.0, converter >= 20.10. See versioning.
- Parameter:
-
-
maxTime
(int) - The number of seconds to wait.- Constraint:
-
- The accepted range is 10-30.
-
public HtmlToImageClient setConverterUserAgent(String agent)
Specifies the User-Agent HTTP header that will be used by the converter when a request is made to the converted web page.
- Availability:
- API client >= 6.4.0 See versioning.
- Parameter:
-
-
agent
- The user agent.- Allowed Values:
-
-
chrome-desktop
— The user-agent for desktop chrome corresponding to the converter used. -
chrome-mobile
— The user-agent for mobile chrome corresponding to the converter used. -
latest-chrome-desktop
— The user-agent of the recently released Chrome browser on desktops. -
latest-chrome-mobile
— The user-agent of the recently released Chrome browser on mobile devices. -
custom string
— A custom string for the user agent.
-
- Default:
-
latest-chrome-desktop
-
- Examples:
-
-
Mimic the recent chrome on mobiles:
setConverterUserAgent("latest-chrome-mobile")
-
Mimic Safari 18.0 browser:
setConverterUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 14_7_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15")
-
Mimic the recent chrome on mobiles:
API Client Options
public HtmlToImageClient setConverterVersion(String version)
Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
- Availability:
- API client >= 5.0.0. See versioning.
- Parameter:
-
-
version
- The version identifier.- Allowed Values:
-
-
24.04
— Version 24.04. -
20.10
— Version 20.10. -
18.10
— Version 18.10. -
latest
— Version 20.10 is used.
-
- Default:
-
24.04
-
public HtmlToImageClient setUseHttp(boolean value)
Specify whether to use HTTP or HTTPS when connecting to the PDFCrowd API.
- Parameter:
-
-
value
(bool) - Set totrue
to use HTTP.- Default:
-
false
-
public HtmlToImageClient setClientUserAgent(String agent)
Specifies the User-Agent HTTP header that the client library will use when interacting with the API.
- Availability:
- API client >= 6.4.0 See versioning.
- Parameter:
-
-
agent
- The user agent string.
-
public HtmlToImageClient setUserAgent(String agent)
Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
- Parameter:
-
-
agent
- The user agent string.- Default:
-
pdfcrowd_java_client/6.5.2 (https://pdfcrowd.com)
-
public HtmlToImageClient setProxy(String host, int port, String userName, String password)
Specifies an HTTP proxy that the API client library will use to connect to the internet.
- Parameters:
-
-
host
- The proxy hostname. -
port
(int) - The proxy port. -
userName
- The username. -
password
- The password.
-
public HtmlToImageClient setRetryCount(int count)
Specifies the number of automatic retries when the 502 or 503 HTTP status code is received. The status code indicates a temporary network issue. This feature can be disabled by setting to 0.
- Parameter:
-
-
count
(int) - Number of retries.- Default:
-
1
-
- Example:
-
-
Retry failed requests three times:
setRetryCount(3)
-
Retry failed requests three times: