public static class

HTML2PDF.WebPageSettings

extends Object
implements AutoCloseable
java.lang.Object
   ↳ com.pdftron.pdf.HTML2PDF.WebPageSettings

Class Overview

Settings that control how a web page is opened and converted to PDF.

Summary

Constants
int e_abort The Constant e_abort.
int e_ignore The Constant e_abort.
int e_skip The Constant e_abort.
Public Constructors
WebPageSettings()
Default constructor
Public Methods
void close()
Frees the native memory of the object.
void destroy()
Frees the native memory of the object.
void setAllowJavaScript(boolean enable)
Allow javascript from this web page to be run.
void setAllowPlugins(boolean enable)
Allow Netscape and flash plugins from this web page to be run.
void setBlockLocalFileAccess(boolean block)
Allow local and piped files access to other local files.
void setConvertDelay(int msec)
Amount of time to wait before starting to convert html to pdf.
void setDebugJavaScriptOutput(boolean forward)
Forward javascript warnings and errors to the HTML2PDF warning callback.
void setDefaultEncoding(String encoding)
Default encoding to be used when not specified by the web page.
void setExternalLinks(boolean convert)
Convert external links in HTML document to external PDF links.
void setIncludeInOutline(boolean include)
Add sections from this web page to the outline and table of contents.
void setInternalLinks(boolean convert)
Convert internal links in HTML document into PDF references.
void setJavaScriptDelay(int msec)
Amount of time to wait for a web page to start printing after it's completed loading.
void setLoadErrorHandling(int type)
How to handle objects that failed to load.
void setLoadImages(boolean load)
Print the images of this web page.
void setMinimumFontSize(int size)
Set the smallest font size allowed, e.g 9.
void setPassword(String password)
HTTP authentication password to use when logging into the website.
void setPrintBackground(boolean background)
Print the background of this web page.
void setPrintMediaType(boolean print)
Controls how content will be printed from this web page.
void setProduceForms(boolean forms)
Turn HTML forms into PDF forms.
void setProxy(HTML2PDF.Proxy proxy)
Use this proxy to load content from this web page.
void setSmartShrinking(boolean enable)
Allow intelligent shrinking to fit more content per page.
void setStopSlowScripts(boolean stop)
Stop slow running javascript's.
void setTimeout(int msec)
Amount of time to wait in milliseconds for the entire converting and printing process.
void setUserStyleSheet(String url)
Url or path to user specified style sheet.
void setUsername(String username)
HTTP authentication username to use when logging into the website.
void setZoom(double zoom)
Zoom factor to use when loading object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.AutoCloseable

Constants

public static final int e_abort

The Constant e_abort.

Constant Value: 0 (0x00000000)

public static final int e_ignore

The Constant e_abort.

Constant Value: 2 (0x00000002)

public static final int e_skip

The Constant e_abort.

Constant Value: 1 (0x00000001)

Public Constructors

public WebPageSettings ()

Default constructor

Public Methods

public void close ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public void destroy ()

Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.

public void setAllowJavaScript (boolean enable)

Allow javascript from this web page to be run.

Parameters
enable - If true javascript's are allowed.

public void setAllowPlugins (boolean enable)

Allow Netscape and flash plugins from this web page to be run. Enabling will have limited success.

Parameters
enable - If true Netscape & flash plugins will be run.

public void setBlockLocalFileAccess (boolean block)

Allow local and piped files access to other local files. By default local file access is blocked due to security concerns.

Parameters
block - If true local files will be inaccessible. If false they will be be accessible which should only be used if the html is trusted.

public void setConvertDelay (int msec)

Amount of time to wait before starting to convert html to pdf. Converter will wait msec milliseconds before calling convert.

Parameters
msec - Time to wait in milliseconds, e.g. 1200.

public void setDebugJavaScriptOutput (boolean forward)

Forward javascript warnings and errors to the HTML2PDF warning callback.

Parameters
forward - If true javascript errors and warnings will be forwarded to HTML2PDF error and warning callbacks. Use HTML2PDF::SetWarningProc and SetErrorProc to get these messages when forward is true.

public void setDefaultEncoding (String encoding)

Default encoding to be used when not specified by the web page.

Note: available encodings are Apple Roman, Big5, Big5-HKSCS, CP949, EUC-JP, EUC-KR, GB18030-0, IBM 850, IBM 866, IBM 874, ISO 2022-JP, ISO 8859-1 to 10, ISO 8859-13 to 16, Iscii-Bng, Dev, Gjr, Knd, Mlm, Ori, Pnj, Tlg, Tml, JIS X 0201, JIS X 0208, KOI8-R, KOI8-U, MuleLao-1, ROMAN8, Shift-JIS, TIS-620, TSCII, UTF-8, UTF-16, UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, Windows-1250 to 1258, WINSAMI2.

Parameters
encoding - Default encoding, e.g. utf-8 or iso-8859-1.

public void setExternalLinks (boolean convert)

Convert external links in HTML document to external PDF links.

Parameters
convert - If true PDF pages produced from this web page can have external links.

public void setIncludeInOutline (boolean include)

Add sections from this web page to the outline and table of contents.

Parameters
include - If true PDF pages created from this web page will show up in the outline, and table of contents, otherwise, produced PDF pages will be excluded.

public void setInternalLinks (boolean convert)

Convert internal links in HTML document into PDF references.

Parameters
convert - If true PDF pages produced from this web page will have links to other PDF pages.

public void setJavaScriptDelay (int msec)

Amount of time to wait for a web page to start printing after it's completed loading. Converter will wait a maximum of msec milliseconds for javascript to call window.print().

Parameters
msec - Maximum wait time in milliseconds, e.g. 1200.

public void setLoadErrorHandling (int type)

How to handle objects that failed to load.

Parameters
type - If e_abort then conversion process is aborted, if e_skip then the converter will not add this web page to the PDF output, and if e_skip then the converter will try to add this web page to the PDF output.

public void setLoadImages (boolean load)

Print the images of this web page.

Parameters
load - If true images are printed.

public void setMinimumFontSize (int size)

Set the smallest font size allowed, e.g 9.

Parameters
size - No fonts will appear smaller than this.

public void setPassword (String password)

HTTP authentication password to use when logging into the website.

Parameters
password - The login password to use with the server, e.g. "elbarto".

public void setPrintBackground (boolean background)

Print the background of this web page.

Parameters
background - If true background is printed.

public void setPrintMediaType (boolean print)

Controls how content will be printed from this web page.

Parameters
print - If true the print media type will be used, otherwise the screen media type will be used to print content.

public void setProduceForms (boolean forms)

Turn HTML forms into PDF forms.

Parameters
forms - If true PDF pages produced from this web page will have PDF forms for any HTML forms the web page has.

public void setProxy (HTML2PDF.Proxy proxy)

Use this proxy to load content from this web page.

Parameters
proxy - Contains settings for proxy

public void setSmartShrinking (boolean enable)

Allow intelligent shrinking to fit more content per page.

Parameters
enable - If true intelligent shrinking is enabled and the pixel/dpi ratio is non constant.

public void setStopSlowScripts (boolean stop)

Stop slow running javascript's.

Parameters
stop - If true, slow running javascript's will be stopped.

public void setTimeout (int msec)

Amount of time to wait in milliseconds for the entire converting and printing process. If conversion doesn't finish before the timeout, it will be cancelled and no output is expected. Default 120,000 ms.

Parameters
msec -- Maximum timeout in milliseconds.

public void setUserStyleSheet (String url)

Url or path to user specified style sheet.

Parameters
url - URL or file path to user style sheet to be used with this web page.

public void setUsername (String username)

HTTP authentication username to use when logging into the website.

Parameters
username - The login name to use with the server, e.g. "bart".

public void setZoom (double zoom)

Zoom factor to use when loading object.

Parameters
zoom - How much to magnify the web content by, e.g. 2.2.