com.groupdocs.editor

Class InputHtmlDocument

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, IAuxDisposable


    public final class InputHtmlDocument
    extends Object
    implements IAuxDisposable

    Encapsulates one HTML document, which is obtained from Document->HTML conversion and contains HTML markup and all related resources like CSS, images and fonts.


    The instances of this class are returned to the user during forward conversion (from document of any supported type to HTML). This class contains a set of useful methods and properties, which are required to "fill" the WYSIWYG HTML-editor.

    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void dispose()
      Disposes this HTML document instance, disposing its content and making its methods and properties non-working
      String getBodyContent()
      Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string.
      String getBodyContent(String externalResourcePrefix)
      Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string, where links to the external resources contain specified prefix.
      String getContent()
      Returns overall content of the HTML document as a string.
      String getContent(String externalResourcePrefix)
      Returns overall content of the HTML document as a string, where links to the external resources contain specified prefix.
      CssText getCss()
      Returns a CSS resource
      String getCssContent()
      Returns content of the external CSS as a string or NULL, if there is no CSS for this document.
      String getCssContent(String externalResourcePrefix)
      Returns content of the external CSS as a string, where links to the external resources contain specified prefix, or NULL, if there is no CSS for this document.
      String getEmbeddedHtml()
      Returns all content of this HTML document with all related resources in a form of a single string, where all resources are embedded inside the HTML markup in a base64-encoded form.
      List<FontResourceBase> getFontResources()
      Allows to obtain or specify external font resources, which are used by this HTML document
      List<RasterImageResourceBase> getImageResources()
      Allows to obtain or specify external image resources (raster images), which are used by this HTML document
      boolean isDisposed()
      Determines whether this HTML document is already disposed or not
      void save(String htmlFilePath)
      Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources.
      void save(String htmlFilePath, String resourcesFolderPath)
      Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources, which is located on specified path.
    • Method Detail

      • dispose

        public void dispose()

        Disposes this HTML document instance, disposing its content and making its methods and properties non-working

        Specified by:
        dispose in interface com.aspose.ms.System.IDisposable
      • getBodyContent

        public String getBodyContent()

        Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string.

        Returns:
        String, which contains the body of the HTML document


        WYSIWYG editors operate with the body of the document and cannot correctly process its meta information from the HEAD block. This method is designed for such cases.

      • getBodyContent

        public String getBodyContent(String externalResourcePrefix)

        Returns a body of the HTML document (content between opening and closing BODY tags without these tags) as a string, where links to the external resources contain specified prefix.

        Parameters:
        externalResourcePrefix - Through this parameter used can specify a prefix, which will be added to the links to all external resources (images, fonts, CSS), which will be present in the resultant HTML string. If NULL or empty, prefixes will not be added.


        WYSIWYG editors operate with the body of the document and cannot correctly process its meta information from the HEAD block. This method is designed for such cases.

        Returns:
        String, which contains the body of the HTML document with links, adjusted to the external resources
      • getContent

        public String getContent()

        Returns overall content of the HTML document as a string.

        Returns:
        String, which contains the content of the HTML document
      • getContent

        public String getContent(String externalResourcePrefix)

        Returns overall content of the HTML document as a string, where links to the external resources contain specified prefix.

        Parameters:
        externalResourcePrefix - Through this parameter used can specify a prefix, which will be added to the links to all external resources (images, fonts, CSS), which will be present in the resultant HTML string. If NULL or empty, prefixes will not be added.
        Returns:
        String, which contains the content of the HTML document with links, adjusted to the external resources
      • getCss

        public CssText getCss()

        Returns a CSS resource

      • getCssContent

        public String getCssContent()

        Returns content of the external CSS as a string or NULL, if there is no CSS for this document.

        Returns:
        CSS document content
      • getCssContent

        public String getCssContent(String externalResourcePrefix)

        Returns content of the external CSS as a string, where links to the external resources contain specified prefix, or NULL, if there is no CSS for this document.

        Parameters:
        externalResourcePrefix - Through this parameter used can specify a prefix, which will be added to the links to all external resources (images and fonts), which will be present in the resultant CSS string. If NULL or empty, prefixes will not be added.
        Returns:
        CSS document content
      • getEmbeddedHtml

        public String getEmbeddedHtml()

        Returns all content of this HTML document with all related resources in a form of a single string, where all resources are embedded inside the HTML markup in a base64-encoded form.

        Returns:
        String, which is not NULL or empty in any case
      • getFontResources

        public List<FontResourceBase> getFontResources()

        Allows to obtain or specify external font resources, which are used by this HTML document

      • getImageResources

        public List<RasterImageResourceBase> getImageResources()

        Allows to obtain or specify external image resources (raster images), which are used by this HTML document

      • isDisposed

        public boolean isDisposed()

        Determines whether this HTML document is already disposed or not

        Specified by:
        isDisposed in interface IAuxDisposable
      • save

        public void save(String htmlFilePath)

        Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources.

        Parameters:
        htmlFilePath - Full path to the file, where HTML markup will be stored. File will be created or overwritten, if exists. Accompanying resource folder will be created in the same folder, where HTML file exist.
      • save

        public void save(String htmlFilePath,
                String resourcesFolderPath)

        Saves this HTML document to the file on specified path, where HTML markup will be stored, and to the accompanying folder with resources, which is located on specified path.

        Parameters:
        htmlFilePath - Full path to the file, where HTML markup will be stored. Cannot be NULL or empty. File will be created or overwritten, if exists.
        resourcesFolderPath - Full path to the accompanying folder, where all related resources will be stored. Cannot be NULL or empty. Folder will be created, if not exists.