PTHTMLOutputOptions

@interface PTHTMLOutputOptions : NSObject

A class containing options common to ToHtml and ToEpub functions

  • Creates an HTMLOutputCommonOptions object with default settings

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()
  • Use JPG files rather than PNG. This will apply to all generated images. Default is true.

    Declaration

    Objective-C

    - (void)SetPreferJPG:(BOOL)prefer_jpg;

    Swift

    func setPreferJPG(_ prefer_jpg: Bool)

    Parameters

    prefer_jpg

    if true JPG images will be used whenever possible.

  • Specifies the compression quality to use when generating JPEG images.

    Declaration

    Objective-C

    - (void)SetJPGQuality:(unsigned int)quality;

    Swift

    func setJPGQuality(_ quality: UInt32)

    Parameters

    quality

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

  • 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.

    Declaration

    Objective-C

    - (void)SetDPI:(unsigned int)dpi;

    Swift

    func setDPI(_ dpi: UInt32)

    Parameters

    dpi

    the resolution in Dots Per Inch

  • 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.

    Declaration

    Objective-C

    - (void)SetMaximumImagePixels:(unsigned int)max_pixels;

    Swift

    func setMaximumImagePixels(_ max_pixels: UInt32)

    Parameters

    max_pixels

    the maximum number of pixels an image can have

  • Switch between fixed (pre-paginated) and reflowable HTML generation. Default is e_fixed_position. In e_reflow_paragraphs mode, conversions require that the optional PDFTron pdf2html add-on module is available.

    See

    ContentReflowSetting

    See

    PDF2HtmlReflowParagraphsModule

    Declaration

    Objective-C

    - (void)SetContentReflowSetting:(PTHTMLContentReflowSetting)reflow;

    Swift

    func setContentReflowSetting(_ reflow: PTHTMLContentReflowSetting)

    Parameters

    reflow

    the generated HTML will be either fixed or reflowable.

  • Set an overall scaling of the generated HTML pages. Default is 1.0.

    Note

    This option is only available for e_fixed_position mode.

    Declaration

    Objective-C

    - (void)SetScale:(double)scale;

    Swift

    func setScale(_ scale: Double)

    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.

  • Enable the conversion of external URL navigation. Default is false.

    Note

    This option is only available for e_fixed_position mode.

    Declaration

    Objective-C

    - (void)SetExternalLinks:(BOOL)enable;

    Swift

    func setExternalLinks(_ enable: Bool)

    Parameters

    enable

    if true, links that specify external URL’s are converted into HTML.

  • Enable the conversion of internal document navigation. Default is false.

    Note

    This option is only available for e_fixed_position mode.

    Declaration

    Objective-C

    - (void)SetInternalLinks:(BOOL)enable;

    Swift

    func setInternalLinks(_ enable: Bool)

    Parameters

    enable

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

  • Controls whether converter optimizes DOM or preserves text placement accuracy. Default is false.

    Note

    This option is only available for e_fixed_position mode.

    Declaration

    Objective-C

    - (void)SetSimplifyText:(BOOL)enable;

    Swift

    func setSimplifyText(_ enable: Bool)

    Parameters

    enable

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

  • Generate a XML file that contains additional information about the conversion process. By default no report is generated.

    Note

    This option is only available for e_fixed_position mode.

    Declaration

    Objective-C

    - (void)SetReportFile:(NSString *)path;

    Swift

    func setReportFile(_ path: String!)

    Parameters

    path

    the file path to which the XML report is written to.

  • Specifies the title for the output HTML.

    Note

    This option is only available for e_reflow_paragraphs mode.

    Declaration

    Objective-C

    - (void)SetTitle:(NSString *)title;

    Swift

    func setTitle(_ title: String!)

    Parameters

    title

    the title of the output HTML.

  • 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.

    Declaration

    Objective-C

    - (void)SetImageDPI:(unsigned int)dpi;

    Swift

    func setImageDPI(_ dpi: UInt32)

    Parameters

    dpi

    the resolution in Pixels Per Inch.

  • 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 mode.

    Declaration

    Objective-C

    - (void)SetEmbedImages:(BOOL)embed;

    Swift

    func setEmbedImages(_ embed: Bool)

    Parameters

    embed

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

  • 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.

    Declaration

    Objective-C

    - (void)SetFileConversionTimeoutSeconds:(int)seconds;

    Swift

    func setFileConversionTimeoutSeconds(_ seconds: Int32)

    Parameters

    seconds

    the timeout in seconds.

  • Specifies a range of pages to be converted. By default all pages are converted. The first page has the page number of 1. Use a negative value to specify the last page in the PDF.

    Note

    This option is only available for e_reflow_paragraphs mode.

    Declaration

    Objective-C

    - (void)SetPages:(int)pageFrom pageTo:(int)pageTo;

    Swift

    func setPages(_ pageFrom: Int32, pageTo: Int32)

    Parameters

    pageFrom

    the first page to be converted.

    pageTo

    the last page to be converted (inclusive).

  • Specifies the password if the PDF requires one.

    Note

    This option is only available for e_reflow_paragraphs mode.

    Declaration

    Objective-C

    - (void)SetPDFPassword:(NSString *)password;

    Swift

    func setPDFPassword(_ password: String!)

    Parameters

    password

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

  • Specifies how image + hidden text pages should be converted. Default is e_ocr_image_text.

    Note

    This feature does not perform OCR.

    Note

    This option is only available for e_reflow_paragraphs mode.

    See

    SearchableImageSetting

    Declaration

    Objective-C

    - (void)SetSearchableImageSetting:(PTHTMLSearchableImageSetting)setting;

    Swift

    func setSearchableImageSetting(_ setting: PTHTMLSearchableImageSetting)

    Parameters

    setting

    the searchable image setting.

  • Determines whether to use

  • tags for list items. Default is false.

    Note

    This option is only available for e_reflow_paragraphs mode.
  • Declaration

    Objective-C

    - (void)SetSimpleLists:(BOOL)enable;

    Swift

    func setSimpleLists(_ enable: Bool)

    Parameters

    enable

    if true,

  • tags are used for list items.

  • Specifies whether hyphens in the PDF should be connected. This only works with English words. Default is false.

    Note

    This option is only available for e_reflow_paragraphs mode.

    Declaration

    Objective-C

    - (void)SetConnectHyphens:(BOOL)connect;

    Swift

    func setConnectHyphens(_ connect: Bool)

    Parameters

    connect

    if true, hyphens in the PDF will be connected.

  • 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.

    Declaration

    Objective-C

    - (void)SetDisableVerticalSplit:(BOOL)disable;

    Swift

    func setDisableVerticalSplit(_ disable: Bool)

    Parameters

    disable

    if true, the detection of section columns are disabled.

  • Determines whether to flow contents across the entire browser window. Default is false.

    Note

    This option is only available for e_reflow_paragraphs mode.

    Declaration

    Objective-C

    - (void)SetNoPageWidth:(BOOL)enable;

    Swift

    func setNoPageWidth(_ enable: Bool)

    Parameters

    enable

    if true, content will flow across entire page.