com.aspose.words

Class HtmlMetafileFormat

  • java.lang.Object
    • com.aspose.words.HtmlMetafileFormat
public class HtmlMetafileFormat 
extends java.lang.Object

Utility class containing constants. Indicates the format in which metafiles are saved to HTML documents.

Example:

Shows how to set a meta file in a different format.
// Create a document from an html string
String html =
        "<html>\r\n<svg xmlns='http://www.w3.org/2000/svg' width='500' height='40' viewBox='0 0 500 40'>\r\n<text x='0' y='35' font-family='Verdana' font-size='35'>Hello world!</text>\r\n</svg>\r\n</html>";

Document doc = new Document(new ByteArrayInputStream(html.getBytes()));

// This document contains a <svg> element in the form of text,
// which by default will be saved as a linked external .png when we save the document as html
// We can save with a HtmlSaveOptions object with this flag set to preserve the <svg> tag
HtmlSaveOptions options = new HtmlSaveOptions();
options.setMetafileFormat(HtmlMetafileFormat.SVG);

doc.save(getArtifactsDir() + "HtmlSaveOptions.MetafileFormat.html", options);

Field Summary
static final intPNG = 0
Metafiles are rendered to raster PNG images.
static final intSVG = 1
Metafiles are converted to vector SVG images.
static final intEMF_OR_WMF = 2
Metafiles are saved as is, without conversion.
 

    • Field Detail

      • PNG = 0

        public static final int PNG
        Metafiles are rendered to raster PNG images.
      • SVG = 1

        public static final int SVG
        Metafiles are converted to vector SVG images.
      • EMF_OR_WMF = 2

        public static final int EMF_OR_WMF
        Metafiles are saved as is, without conversion.