public static class

Convert.HTMLOutputOptions

extends Object
java.lang.Object
   ↳ com.pdftron.pdf.Convert.HTMLOutputOptions

Class Overview

A class containing options common to ToHtml and ToEpub functions

Summary

Constants
int e_fixed_position Content uses fixed positioning (default).
int e_ocr_always Perform new OCR on all pages.
int e_ocr_image Convert images only, ignoring pre-existing text from previous OCR, and do not perform any new OCR.
int e_ocr_image_text Convert both images and pre-existing hidden text from previous OCR.
int e_ocr_off Convert images only, ignoring pre-existing text from previous OCR, and do not perform any new OCR.
int e_ocr_text Convert pre-existing text from previous OCR only (e_reflow_paragraphs mode).
int e_reflow_full Text flows freely edge-to-edge in a single column.
int e_reflow_paragraphs Deprecated.
Public Constructors
HTMLOutputOptions()
Creates an HTMLOutputCommonOptions object with default settings
Public Methods
Convert.StructuredOutputOptions.SectionConversionSetting getFootnotesSetting()
Get the setting for footnotes from this options object.
Convert.StructuredOutputOptions.SectionConversionSetting getHeadersAndFootersSetting()
Get the setting for headers and footers from this options object.
void setConnectHyphens(boolean connect)
Specifies whether hyphens in the PDF should be connected.
void setContentReflowSetting(int reflow)
Switch between fixed (pre-paginated) and reflowable HTML generation.
void setDPI(int dpi)
The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted.
void setDisableVerticalSplit(boolean disable)
Specifies whether to disable the detection of section columns.
void setEmbedImages(boolean embed)
Specifies whether images are embedded in the HTML without having to link to external files.
void setExternalLinks(boolean enable)
Enable the conversion of external URL navigation.
void setFileConversionTimeoutSeconds(int seconds)
Specifies the amount of time in seconds after which the conversion fails.
void setFootnotesSetting(Convert.StructuredOutputOptions.SectionConversionSetting option)
Specifies how footnotes should be converted.
void setHeadersAndFootersSetting(Convert.StructuredOutputOptions.SectionConversionSetting option)
Specifies how header and footers should be converted.
void setImageDPI(int dpi)
Specifies the output image resolution, from 8 to 600, in Pixels Per Inch (PPI).
void setInternalLinks(boolean enable)
Enable the conversion of internal document navigation.
void setJPGQuality(int quality)
Specifies the compression quality to use when generating JPEG images.
void setLanguage(Convert.OutputOptionsOCR.LanguageChoice language)
Specifies the OCR language.
void setMaximumImagePixels(int max_pixels)
Specifies the maximum image slice size in pixels.
void setNoPageWidth(boolean enable)
Determines whether to flow contents across the entire browser window.
void setPDFPassword(String password)
Specifies the password if the PDF requires one.
void setPages(int page_from, int page_to)
Specifies a range of pages to be converted.
void setPreferJPG(boolean prefer_jpg)
Use JPG files rather than PNG.
void setPreferredOCREngine(Convert.OutputOptionsOCR.PreferredOCREngine engine)
Specifies the preferred OCR engine.
void setScale(double scale)
Set an overall scaling of the generated HTML pages.
void setSearchableImageSetting(int setting)
Specifies how scanned image pages should be converted.
void setSimpleLists(boolean enable)
Determines whether to use <LI> tags for list items.
void setSimplifyText(boolean enable)
Controls whether converter optimizes DOM or preserves text placement accuracy.
void setTitle(String title)
Specifies the title for the output HTML.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int e_fixed_position

Content uses fixed positioning (default).

Constant Value: 0 (0x00000000)

public static final int e_ocr_always

Perform new OCR on all pages. (e_reflow_full mode).

Constant Value: 4 (0x00000004)

public static final int e_ocr_image

Convert images only, ignoring pre-existing text from previous OCR, and do not perform any new OCR.

Constant Value: 1 (0x00000001)

public static final int e_ocr_image_text

Convert both images and pre-existing hidden text from previous OCR. Only applies to e_reflow_paragraphs.

Constant Value: 0 (0x00000000)

public static final int e_ocr_off

Convert images only, ignoring pre-existing text from previous OCR, and do not perform any new OCR.

Constant Value: 3 (0x00000003)

public static final int e_ocr_text

Convert pre-existing text from previous OCR only (e_reflow_paragraphs mode). Perform new OCR on scanned pages (e_reflow_full mode).

Constant Value: 2 (0x00000002)

public static final int e_reflow_full

Text flows freely edge-to-edge in a single column.

Constant Value: 2 (0x00000002)

public static final int e_reflow_paragraphs

Deprecated. Text flows within paragraphs.

Constant Value: 1 (0x00000001)

Public Constructors

public HTMLOutputOptions ()

Creates an HTMLOutputCommonOptions object with default settings

Public Methods

public Convert.StructuredOutputOptions.SectionConversionSetting getFootnotesSetting ()

Get the setting for footnotes from this options object. Note: This option is only available for e_reflow_full mode.

Returns
  • The current footnotes setting.

public Convert.StructuredOutputOptions.SectionConversionSetting getHeadersAndFootersSetting ()

Get the setting for headers and footers from this options object. Note: This option is only available for e_reflow_full mode.

Returns
  • The current header and footer setting.

public void setConnectHyphens (boolean connect)

Specifies whether hyphens in the PDF should be connected. Default is false. Note: This option is only available for e_reflow_paragraphs and e_reflow_full modes.

Parameters
connect if true, hyphens in the PDF will be connected.

public void setContentReflowSetting (int reflow)

Switch between fixed (pre-paginated) and reflowable HTML generation. Default is e_fixed_position. In e_reflow_paragraphs mode (now deprecated), conversions require that the optional PDFTron HTML reflow paragraphs add-on module is available. In e_reflow_full mode, conversions require that the optional PDFTron StructuredOutput add-on module is available.

Parameters
reflow the generated HTML will be either fixed or reflowable.
Throws
PDFNetException
PDFNetException

public void setDPI (int dpi)

The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to render elements which cannot be directly converted. Default is 140. Note: This option is only available for e_fixed_position mode.

Parameters
dpi the resolution in Dots Per Inch

public void setDisableVerticalSplit (boolean disable)

Specifies whether to disable the detection of section columns. Default is false. Enable this if your tables are coming out as section columns. Note: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, columns are detected automatically.

Parameters
disable if true, the detection of section columns are disabled.

public void setEmbedImages (boolean embed)

Specifies whether images are embedded in the HTML without having to link to external files. Default is true. Note: This option is only available for e_reflow_paragraphs and e_reflow_full modes.

Parameters
embed if true, images are embedd in the HTML, otherwise, images are saved as external files.

public void setExternalLinks (boolean enable)

Enable the conversion of external URL navigation. Default is false. Note: This option is only available for e_fixed_position mode.

Parameters
enable if true, links that specify external URL's are converted into HTML.

public void setFileConversionTimeoutSeconds (int seconds)

Specifies the amount of time in seconds after which the conversion fails. Default is 300. Very long files need more time to convert. Note: This option is only available for e_reflow_paragraphs mode. The timeout feature is not necessary in other modes.

Parameters
seconds the timeout in seconds.

public void setFootnotesSetting (Convert.StructuredOutputOptions.SectionConversionSetting option)

Specifies how footnotes should be converted. Default is e_Recover, which will include them as footnotes. Note: This option is only available for e_reflow_full mode.

Parameters
option The footnotes setting.

public void setHeadersAndFootersSetting (Convert.StructuredOutputOptions.SectionConversionSetting option)

Specifies how header and footers should be converted. Default is e_Recover, which will include them as headers and footers. Note: This option is only available for e_reflow_full mode.

Parameters
option The header and footer setting.

public void setImageDPI (int dpi)

Specifies the output image resolution, from 8 to 600, in Pixels Per Inch (PPI). The higher the PPI, the larger the image. Default is 192. Note: This option is only available for e_reflow_paragraphs mode. In other modes, image resolution is determined automatically for an optimal result.

Parameters
dpi the resolution in Pixels Per Inch.

public void setInternalLinks (boolean enable)

Enable the conversion of internal document navigation. Default is false. Note: This option is only available for e_fixed_position mode.

Parameters
enable if true, links that specify page jumps are converted into HTML.

public void setJPGQuality (int quality)

Specifies the compression quality to use when generating JPEG images. Note: This option is only available for e_fixed_position and e_reflow_paragraphs modes. In e_reflow_full mode, the optimal JPEG quality is chosen automatically for best balance between size and quality.

Parameters
quality the JPEG compression quality, from 0(highest compression) to 100(best quality).

public void setLanguage (Convert.OutputOptionsOCR.LanguageChoice language)

Specifies the OCR language. Default is automatic language detection. Note: This option is only available for e_reflow_full mode.

Parameters
language the OCR language.

public void setMaximumImagePixels (int max_pixels)

Specifies the maximum image slice size in pixels. Default is 2000000.

Note: This setting now will no longer reduce the total number of image pixels. Instead a lower value will just produce more slices and vice versa.

Note: Since image compression works better with more pixels a larger max pixels should generally create smaller files. Note: This option is only available for e_fixed_position mode.

Parameters
max_pixels the maximum number of pixels an image can have

public void setNoPageWidth (boolean enable)

Determines whether to flow contents across the entire browser window. Default is false. Note: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, content always flows across the entire browser window.

Parameters
enable if true, content will flow across entire page.

public void setPDFPassword (String password)

Specifies the password if the PDF requires one. Note: This option is only available for e_reflow_paragraphs and e_reflow_full modes.

Parameters
password the PDF password, if required; an empty string otherwise.

public void setPages (int page_from, int page_to)

Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. Note: This option is only available for e_reflow_paragraphs and e_reflow_full modes.

Parameters
page_from the first page to be converted.
page_to the last page to be converted (inclusive). Use a negative value to specify the last page in the PDF.

public void setPreferJPG (boolean prefer_jpg)

Use JPG files rather than PNG. This will apply to all generated images. Default is true. Note: This option is only available for e_fixed_position and e_reflow_paragraphs modes.

Parameters
prefer_jpg if true JPG images will be used whenever possible.

public void setPreferredOCREngine (Convert.OutputOptionsOCR.PreferredOCREngine engine)

Specifies the preferred OCR engine. Note: This option is only available for e_reflow_full mode.

Parameters
engine The PreferredOCREngine to use.

public void setScale (double scale)

Set an overall scaling of the generated HTML pages. Default is 1.0. Note: This option is only available for e_fixed_position mode.

Parameters
scale A number greater than 0 which is used as a scale factor. For example, calling SetScale(0.5) will reduce the HTML body of the page to half its original size, whereas SetScale(2) will double the HTML body dimensions of the page and will rescale all page content appropriately.

public void setSearchableImageSetting (int setting)

Specifies how scanned image pages should be converted. Default is e_ocr_image_text. Note: This option is only available for e_reflow_paragraphs and e_reflow_full modes.

Parameters
setting the searchable image setting.

public void setSimpleLists (boolean enable)

Determines whether to use <LI> tags for list items. Default is false. Note: This option is only available for e_reflow_paragraphs mode. In e_reflow_full mode, list items always use <LI> tags.

Parameters
enable if true, <LI> tags are used for list items.

public void setSimplifyText (boolean enable)

Controls whether converter optimizes DOM or preserves text placement accuracy. Default is false. Note: This option is only available for e_fixed_position mode.

Parameters
enable if true, converter will try to reduce DOM complexity at the expense of text placement accuracy.

public void setTitle (String title)

Specifies the title for the output HTML. Note: This option is only available for e_reflow_paragraphs mode. HTML titles are not supported in other modes at the moment.

Parameters
title the title of the output HTML.