Class Index

Classes


Class PDFNet.HTML2PDF

PDFNet.HTML2PDF

Class Summary
Constructor Attributes Constructor Name and Description
 
'pdftron.PDF.HTML2PDF' is an optional PDFNet Add-On utility class that can be used to convert HTML web pages into PDF documents by using an external module (html2pdf).
Method Summary
Method Attributes Method Name and Description
 
convert(doc)
Convert HTML documents and append the results to doc.
<static>  
PDFNet.HTML2PDF.create()
Default constructor.
 
Frees the native memory of the object.
 
dumpOutline(xml_file)
Save outline to a xml file?
 
Return the largest HTTP error code encountered during conversion
 
Get results of conversion, including errors and warnings, in human readable form.
 
Convert HTML encoded in string.
 
insertFromHtmlString2(html, settings)
Convert HTML encoded in string.
 
Add a web page to be converted.
 
insertFromUrl2(url, settings)
Add a web page to be converted.
 
Add a table of contents to the produced PDF.
 
insertTOC2(settings)
Add a table of contents to the produced PDF.
 
Path of file used for loading and storing cookies.
 
setDPI(dpi)
Change the DPI explicitly for the output PDF.
 
Maximum DPI to use for images in the generated PDF.
 
setImageQuality(quality)
JpEG compression factor to use when generating PDF.
 
setLandscape(enable)
Set page orientation for output PDF.
 
setMargins(top, bottom, left, right)
Set margins of generated PDF.
<static>  
PDFNet.HTML2PDF.setModulePath(path)
Set the only location that PDFNet will look for the html2pdf module.
 
setOutline(enable, depth)
Add bookmarks to the PDF?
 
setPaperSize2(width, height)
Manually set the paper dimensions of the produced PDF.
 
Use loss less compression to create PDF?
 
setQuiet(quiet)
Display HTML to PDF conversion progress, warnings, and errors, to stdout?
Class Detail
PDFNet.HTML2PDF(id)
'pdftron.PDF.HTML2PDF' is an optional PDFNet Add-On utility class that can be used to convert HTML web pages into PDF documents by using an external module (html2pdf). The html2pdf modules can be downloaded from http: www.pdftron.com/pdfnet/downloads.html. Users can convert HTML pages to PDF using the following operations: - Simple one line static method to convert a single web page to PDF. - Convert HTML pages from URL or string, plus optional table of contents, in user defined order. - Optionally configure settings for proxy, images, java script, and more for each HTML page. - Optionally configure the PDF output, including page size, margins, orientation, and more. - Optionally add table of contents, including setting the depth and appearance. The following code converts a single webpage to pdf
Parameters:
id
Method Detail
{boolean} convert(doc)
Convert HTML documents and append the results to doc.
Parameters:
{PDFDoc} doc
Target PDF to which converted HTML pages will be appended to.
Returns:
{boolean} A promise that resolves to true if successful, otherwise false. Use

<static> {HTML2PDF} PDFNet.HTML2PDF.create()
Default constructor.
Returns:
{HTML2PDF} A promise that resolves to an object of type: "HTML2PDF" (generated documentation)

destroy()
Frees the native memory of the object.

dumpOutline(xml_file)
Save outline to a xml file?
Parameters:
{string} xml_file
Path of where xml data representing outline of produced PDF should be saved to.

{number} getHttpErrorCode()
Return the largest HTTP error code encountered during conversion
Returns:
{number} A promise that resolves to the largest HTTP code greater then or equal to 300 encountered during loading of any of the supplied objects, if no such error code is found 0 is returned.

{string} getLog()
Get results of conversion, including errors and warnings, in human readable form.
Returns:
{string} A promise that resolves to string containing results of conversion.

insertFromHtmlString(html)
Convert HTML encoded in string.
Parameters:
{string} html
String containing HTML code.

insertFromHtmlString2(html, settings)
Convert HTML encoded in string.
Parameters:
{string} html
String containing HTML code.
{HTML2PDF_WebPageSettings} settings
How the HTML content described in html is loaded.

insertFromUrl(url)
Add a web page to be converted. A single URL typically results in many PDF pages.
Parameters:
{string} url
HTML page, or relative path to local HTML page

insertFromUrl2(url, settings)
Add a web page to be converted. A single URL typically results in many PDF pages.
Parameters:
{string} url
HTML page, or relative path to local HTML page
{HTML2PDF_WebPageSettings} settings
How the web page should be loaded and converted

insertTOC()
Add a table of contents to the produced PDF.

insertTOC2(settings)
Add a table of contents to the produced PDF.
Parameters:
{HTML2PDF_TOCSettings} settings
Settings for the table of contents.

setCookieJar(path)
Path of file used for loading and storing cookies.
Parameters:
{string} path
Path to file used for loading and storing cookies.

setDPI(dpi)
Change the DPI explicitly for the output PDF.
Parameters:
{number} dpi
Dots per inch, e.g. 80.

setImageDPI(dpi)
Maximum DPI to use for images in the generated PDF.
Parameters:
{number} dpi
Maximum dpi of images in produced PDF, e.g. 80.

setImageQuality(quality)
JpEG compression factor to use when generating PDF.
Parameters:
{number} quality
Compression factor, e.g. 92.

setLandscape(enable)
Set page orientation for output PDF.
Parameters:
{boolean} enable
If true generated PDF pages will be orientated to landscape, otherwise orientation will be portrait.

setMargins(top, bottom, left, right)
Set margins of generated PDF. param@ top Size of the top margin, e.g. "2cm". param@ bottom Size of the bottom margin, e.g. "2cm". param@ left Size of the left margin, e.g. "2cm". param@ right Size of the right margin, e.g. "2cm".
Parameters:
{string} top
(generated documentation)
{string} bottom
(generated documentation)
{string} left
(generated documentation)
{string} right
(generated documentation)

<static> PDFNet.HTML2PDF.setModulePath(path)
Set the only location that PDFNet will look for the html2pdf module.
Parameters:
{string} path
A folder or file path. If non-empty, PDFNet will only look in path for the html2pdf module, otherwise it will search in the default locations for the module.

setOutline(enable, depth)
Add bookmarks to the PDF?
Parameters:
{boolean} enable
If true bookmarks will be generated for the produced PDF.
{number} depth
Maximum depth of the outline (e.g. 4).

setPaperSize2(width, height)
Manually set the paper dimensions of the produced PDF.
Parameters:
{string} width
Width of the page, e.g. "4cm".
{string} height
Height of the page, eg. "12in".

setPDFCompression(enable)
Use loss less compression to create PDF?
Parameters:
{boolean} enable
If true loss less compression will be used to create PDF.

setQuiet(quiet)
Display HTML to PDF conversion progress, warnings, and errors, to stdout?
Parameters:
{boolean} quiet
If false, progress information is sent to stdout during conversion.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 09 2016 14:32:40 GMT-0700 (PDT)