public class HtmlMetafileFormat
Example:
// 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 int | PNG | |
Metafiles are rendered to raster PNG images.
|
||
static final int | SVG | |
Metafiles are converted to vector SVG images.
|
||
static final int | EMF_OR_WMF | |
Metafiles are saved as is, without conversion.
|