Class HTMLConversionOptions

java.lang.Object
org.jpedal.render.output.ConversionOptions
org.jpedal.render.output.html.HTMLConversionOptions

public class HTMLConversionOptions extends ConversionOptions
The class to use for setting conversion options when converting to HTML.
  • Constructor Details

    • HTMLConversionOptions

      public HTMLConversionOptions(Map<String,String> jvmOptions)
    • HTMLConversionOptions

      public HTMLConversionOptions()
    • HTMLConversionOptions

      public HTMLConversionOptions(String optionsAsString)
  • Method Details

    • setTextMode

      public void setTextMode(ConversionOptions.TextMode value)
      The text mode controls how text is rendered in the html output, for example your text can be made selectable or as an image and made non selectable.

      For an explanation of text modes, please click here.

      Important : shapetext modes extract the font metrics from the embedded fonts and includes them as shapes. If there are no embedded fonts then the converter will use Arial to ensure that text is actually displayed, although this may not be an ideal match (and we recommend using embedded fonts).

      In the case where there are no embedded fonts, it's best to use a realtext mode.

      Possible values:

      • svg_realtext
      • svg_shapetext_selectable
      • svg_shapetext_nonselectable
      • image_realtext
      • image_shapetext_selectable
      • image_shapetext_nonselectable

      Default: svg_realtext

      Also set in the JVM options with -Dorg.jpedal.pdf2html.textMode=

      Parameters:
      value - The TextMode to use for conversion.
    • setDisableComments

      public void setDisableComments(boolean value)
      Disable comments inserted into the HTML output for clarity.

      Sections within the generated output are marked up with <!-- HTML comment tags --> to aid understanding of generated output and help parsing if necessary. Enabling this setting will remove those comments.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.disableComments=

      Parameters:
      value - Boolean true/false
    • setAddJavaScript

      public void setAddJavaScript(boolean value)
      Include all the JavaScript that is within the PDF file. This setting is for FormVu only and has no effect in BuildVu.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.addJavaScript=

      Parameters:
      value - Boolean true/false
    • setInlineSVG

      public void setInlineSVG(boolean value)
      Inline SVG within HTML (pure svg text modes only).

      This inlines the SVG within HTML so that there is no separate .svg file.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.inlineSVG=

      Parameters:
      value - Boolean true/false
    • setOverlay

      @Deprecated public void setOverlay(boolean value)
      Deprecated.
      we do not recommend that this option be used.
      Allow user to disable overlay we insert to fix selection issues in IE/FireFox if you only use IPad and want to add your own selection events (should generally not be used)

      Possible values:

      • true/false

      Default: true

      Also set with -Dorg.jpedal.pdf2html.overlay=

      Parameters:
      value - Boolean true/false
    • setMinFontSize

      public void setMinFontSize(int value)
      Sets the minimum font size to be used. This setting is designed for content aimed at Chinese, Japanese, Korean, Thai, and other markets where the locale-specific version of Chrome has a default minimum font size of 12px (Chinese) or 10px (Japanese).

      When this setting is used, any text below the provided font size will be rendered at that size and scaled down to the correct size using a CSS scale transform. Without this setting, Chrome may display text larger than intended.

      More information: https://bugs.chromium.org/p/chromium/issues/detail?id=36429

      Possible values:

      • 12 (for the Chinese market)
      • 10 (for the Japanese market)
      • Any integer value
      Default: 0

      Also set with -Dorg.jpedal.pdf2html.minFontSize=

      Parameters:
      value - int minimum font size to be used
    • setEmbedSvgAsBase64Image

      public void setEmbedSvgAsBase64Image(boolean value)
      Embeds the SVG background directly into the HTML file as a base64 image. This also has the effect of base64 embedding the images inside the SVG.

      Where possible, we recommend using the inlineSVG setting instead as it is more efficient. This is because base64 uses 4 ascii characters to encode 24-bits (3 bytes) of data. With this setting, images are base64 encoded within the SVG, and then the SVG is itself also base64 encoded within the HTML. Therefore, images use 1.78x bytes compared with externally referencing them. In addition, inline SVG is highly compressible when gzip compression is enabled by the web server, whereas base64 content is not.

      Note: This setting is not compatible with the experimental text mode setting.

      Possible values:

      • true/false

      Default: true

      Also set with -Dorg.jpedal.pdf2html.embedSvgAsBase64Image=

      Parameters:
      value - boolean true/false
    • setOmitNameDir

      public void setOmitNameDir(boolean b)
      Controls the folder structure of the output.

      By default, pages are output within a directory with the same name as the PDF file within the output directory specified.

      Setting omitNameDir to true will cause pages to be output directly within the output directory specified. Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.omitNameDir=

      Overrides:
      setOmitNameDir in class ConversionOptions
      Parameters:
      b - Boolean true/false
    • setCompressSVG

      public void setCompressSVG(boolean b)
      Generates compressed .svgz files rather than .svg (you will need to configure your web server to correctly serve these).

      It is recommended to enable this setting as svg file sizes can be reduced by as much as 80-90%!

      SVGZ files are simply SVG files which have been gzip compressed. Gzip compressed svg files are supported by all modern browsers (IE9 onwards, Firefox, Chrome, etc) as long as the web server is configured correctly.

      For more information, please click here.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.compressSVG=

      Overrides:
      setCompressSVG in class ConversionOptions
      Parameters:
      b - Boolean true/false
    • setScaling

      public void setScaling(float value)
      Sets the Scaling value of the converted content.

      Possible values:

      • 1 (float multiplier)
      • 1000x1000 (best fit width/height)
      • fitWidth1000 (best fit width)
      • fitHeight1000 (best fit height)

      Default: 1

      Also set with -Dorg.jpedal.pdf2html.scaling=

      Overrides:
      setScaling in class ConversionOptions
      Parameters:
      value - is of type float.
    • setLogicalPageRange

      public void setLogicalPageRange(PageRanges value)
      Set a page range using logical page numbering.

      For example, let's assume a 7 page document with a page range of "2,4,6".

      When using this setting, you will get 1.html, 2.html and 3.html, and navigation bars would assume that only these 3 pages exist.

      Possible values:

      • comma separated values including ranges. E.g. "1,3,5-8,10"

      Default: null

      Also set with -Dorg.jpedal.pdf2html.logicalPageRange=

      Overrides:
      setLogicalPageRange in class ConversionOptions
      Parameters:
      value - is of Object type PageRanges.
    • setRealPageRange

      public void setRealPageRange(PageRanges value)
      Set a page range using real page numbering.

      For example, let's assume a 7 page document with a page range of "2,4,6".

      When using this setting, you will get 2.html, 4.html and 6.html, and navigation bars would behave as if pages 1, 3, 5 and 7 exist.

      Possible values:

      • Comma separated values including ranges. E.g. "1,3,5-8,10"

      Default value: all pages, e.g. "1-39"

      Also set with -Dorg.jpedal.pdf2html.realPageRange=

      Overrides:
      setRealPageRange in class ConversionOptions
      Parameters:
      value - is of Object type PageRanges.
    • setScalingFitWidth

      public void setScalingFitWidth(int value)
      Overrides:
      setScalingFitWidth in class ConversionOptions
    • setScalingFitWidthHeight

      public void setScalingFitWidthHeight(int width, int height)
      Overrides:
      setScalingFitWidthHeight in class ConversionOptions
    • setScalingFitHeight

      public void setScalingFitHeight(int value)
      Overrides:
      setScalingFitHeight in class ConversionOptions
    • setEmbedImagesAsBase64Stream

      public void setEmbedImagesAsBase64Stream(boolean value)
      Embed images as Base64 stream.

      Inserts the images directly into the file as a base64 stream instead of referencing an external file.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.embedImagesAsBase64Stream=

      Overrides:
      setEmbedImagesAsBase64Stream in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setConvertSpacesToNbsp

      public void setConvertSpacesToNbsp(boolean value)
      Convert spaces into Non-breaking Spaces (&nbsp;) in the output.

      Possible values:

      • true/false

      Default: false Also set with -Dorg.jpedal.pdf2html.convertSpacesToNbsp=

      Overrides:
      setConvertSpacesToNbsp in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setConvertPDFExternalFileToOutputType

      public void setConvertPDFExternalFileToOutputType(boolean value)
      Set whether to convert links pointing to file.pdf into file.html inside GoToR and Launch link annotations. This setting is for FormVu only and has no effect in BuildVu.

      Possible values:

      • true/false

      Default: true

      Also set with -Dorg.jpedal.pdf2html.convertPDFExternalFileToOutputType=

      Overrides:
      setConvertPDFExternalFileToOutputType in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setFormTag

      public void setFormTag(String value)
      Replacing <form> with your version. This setting is for FormVu only and has no effect in BuildVu.

      Possible values:

      • <form **your code here**>

      Default: <form>

      Also set with -Dorg.jpedal.pdf2html.formTag=

      Overrides:
      setFormTag in class ConversionOptions
      Parameters:
      value - is of type String.
    • setIncludedFonts

      public void setIncludedFonts(ConversionOptions.Font[] includedFonts)
      Set fonts to convert to and include in HTML and CSS output.

      Possible values:

      Any comma separated list containing:

      • woff
      • otf
      • woff_base64,
      • otf_base64
      Default: woff

      Also set with -Dorg.jpedal.pdf2html.includedFonts=

      Overrides:
      setIncludedFonts in class ConversionOptions
      Parameters:
      includedFonts - is an array of Object type Font.
    • setKeepGlyfsSeparate

      public void setKeepGlyfsSeparate(boolean value)
      Position each glyph individually for more accurate positioning.

      Produces a larger file but may suit some use cases

      Possible values:

      • true/false
      Default: false

      Also set with -Dorg.jpedal.pdf2html.keepGlyfsSeparate=

      Overrides:
      setKeepGlyfsSeparate in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setSeparateToWords

      public void setSeparateToWords(boolean value)
      Divide text chunks into words based on spaces This improves accuracy but not as much as keepGlyfsSeparate, It produces a larger file but may suit some use cases.

      Possible values:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.separateTextToWords=

      Overrides:
      setSeparateToWords in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setFontsToRasterizeInTextMode

      public void setFontsToRasterizeInTextMode(String value)
      In Text Modes, you can override real text on a font by font basis,

      In svg_realtext text will appear as part of SVG as Vectors This setting has no effect in other modes,

      Needs to start EXCLUDE= or INCLUDE= followed by a list of comma separated fonts Comparison is case-insensitive so Arial, ARIAL and arial are the same.

      Possible values:

      • INCLUDE=font1,font2,font3 ... (rasterized JUST these fonts)
      • EXCLUDE=font1,font2,font3 ... (rasterized all fonts EXCEPT these fonts)

      For example:

      • options.setFontsToRasterizeInTextMode("EXCLUDE=PTSerif-Regular,Arial");
      • options.setFontsToRasterizeInTextMode("INCLUDE=PTSerif-Regular,Arial");

      Default: no effect

      Also set with -Dorg.jpedal.pdf2html.fontsToRasterizeInTextMode=

      Overrides:
      setFontsToRasterizeInTextMode in class ConversionOptions
      Parameters:
      value - is of type String.
    • setCompressImages

      public void setCompressImages(boolean value)
      When enabled, generated PNG images will be compressed to reduce file size.

      This setting has an effect only when svg text modes are used, or when setUseLegacyImageFileType is set to true.

      Rather than producing 24 bit RGB or 32 bit RGBA truecolor PNG images, instead the converter will produce 8 bit palette images that have undergone quantization and dithering. This is a lossy compression, but visual quality remains very high.

      Enabling compression will make conversion slower. On average, expect conversion time to at least double. File size saving can be significant. On files with large images, it is not unusual to see savings of 70-80% on the image file size.

      Possible value:

      • true/false

      Default: true

      Also set with -Dorg.jpedal.pdf2html.compressImages=

      Overrides:
      setCompressImages in class ConversionOptions
      Parameters:
      value - is of type boolean
    • setUseLegacyImageFileType

      public void setUseLegacyImageFileType(boolean value)
      If enabled, all images output will use the PNG file type.

      Possible value:

      • true/false

      Default: false

      Also set with -Dorg.jpedal.pdf2html.useLegacyImageFileType=

      Overrides:
      setUseLegacyImageFileType in class ConversionOptions
      Parameters:
      value - is of type boolean.
    • setImageScale

      public void setImageScale(float imageScale)
      Write out larger images to allow higher quality zooming.

      Default value is 1, which produces images at the same size they are displayed when the zoom is 100%. A value of 1.5 will generate images at 1.5x the standard size. The maximum size of an image is capped at the size of the source image stored in the PDF file. For example if the source image is 150x150, then increasing the imageScale value will not generate an image larger than 150x150.

      It is important to remember that file size grows exponentially with the scaling factor. For example, scaling an image by 2 actually multiplies the number of pixels by 4. We therefore recommend a value such as 1.5 or 2.

      Possible values:

      • Float value greater than 1 e.g. 1.5, 2

      Default: 1

      Also set with -Dorg.jpedal.pdf2html.imageScale=

      Overrides:
      setImageScale in class ConversionOptions
      Parameters:
      imageScale - is of type float
    • getAddJavaScript

      public boolean getAddJavaScript()