Class HtmlHeadConfiguration

java.lang.Object
com.scroogexhtml.configuration.HtmlHeadConfiguration
All Implemented Interfaces:
Serializable

public class HtmlHeadConfiguration extends Object implements Serializable
Nested property which contains HTML HEAD section properties.

Trust boundary: every property here is integrator-supplied configuration, not attacker-reachable RTF content — no data parsed from the RTF input stream can reach this class or influence its values. As a defence in depth (since 11.5), characters XML does not allow are removed, a style sheet link must be a relative URL or use http or https, and the embedded style sheet cannot end its <style> element. This does not make untrusted values safe: a style sheet still controls the page's look. Do not populate these properties from untrusted input (e.g. a document title taken from the RTF file name, or the RTF file's own \info/\title metadata, which this converter does not even parse). See docs/SECURITY.md, section "What this does not protect against".

See Also:
  • Constructor Details

    • HtmlHeadConfiguration

      public HtmlHeadConfiguration(String defaultGenerator)
      Represents a configuration for the HTML head section.
      Parameters:
      defaultGenerator - the default value for the "generator" meta-tag.
  • Method Details

    • setDocumentTitle

      public void setDocumentTitle(String newValue)
      Sets the document title.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new documentTitle value
      Default value:
      "Untitled document"
    • setIncludeDefaultFontStyle

      public void setIncludeDefaultFontStyle(boolean newValue)
      If this property is set to true, the HTML head section will include a CSS definition for the default font style.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new includeDefaultFontStyle value
      See Also:
      Default value:
      false
    • setMetaAuthor

      public void setMetaAuthor(String newValue)
      This property may be used to specify a META tag which contains the document author.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new metaAuthor value
      Default value:
      empty
    • setMetaDescription

      public void setMetaDescription(String newValue)
      This property may be used to specify a document description.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new metaDescription value
      Default value:
      empty
    • setMetaGenerator

      public void setMetaGenerator(String newValue)
      This property may be used to specify the content of the generator "meta" element.
      Parameters:
      newValue - The new metaGenerator value
      Default value:
      name and version of the converter
    • setMetaKeywords

      public void setMetaKeywords(String newValue)
      This property may be used to specify keywords for the document.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new metaKeywords value
      Default value:
      empty
    • setMetaViewport

      public void setMetaViewport(String newValue)
      Use this property to define the viewport meta-tag manually.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new viewport value
      Default value:
      empty
    • setStyleSheetInclude

      public void setStyleSheetInclude(String newValue)
      Additional style sheet definitions which are stored in the HTML document.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Parameters:
      newValue - The new styleSheetInclude value
      Default value:
      empty
    • setStyleSheetLink

      public void setStyleSheetLink(String newValue)
      URL of a file which contains external CSS style sheet definitions for the HTML document.

      Note: this property is only effective if the property AddOuterHTML is set to true.

      Only a relative URL or one with the scheme http or https is written; any other link (for example javascript:, data:, //host/..., or one with spaces) is dropped with a warning. The same applies to addStyleSheetLink(java.lang.String) and setStyleSheetLinks(java.util.List<java.lang.String>).

      Parameters:
      newValue - The new styleSheetLink value
      Default value:
      empty
    • addStyleSheetLink

      public void addStyleSheetLink(String href)
      Adds a style sheet link to the list of style sheet links in the HTML head configuration.
      Parameters:
      href - The URL of the style sheet file
    • setStyleSheetLinks

      public void setStyleSheetLinks(List<String> newValue)
    • getDocumentTitle

      public String getDocumentTitle()
    • isIncludeDefaultFontStyle

      public boolean isIncludeDefaultFontStyle()
    • getMetaAuthor

      public String getMetaAuthor()
    • getMetaDescription

      public String getMetaDescription()
    • getMetaGenerator

      public String getMetaGenerator()
    • getMetaKeywords

      public String getMetaKeywords()
    • getMetaViewport

      public String getMetaViewport()
    • getStyleSheetInclude

      public String getStyleSheetInclude()
    • getStyleSheetLinks

      public List<String> getStyleSheetLinks()