export_embedded_svg property

HtmlFixedSaveOptions.export_embedded_svg property

Specifies whether SVG resources should be embedded into Html document. Default value is True.

@property
def export_embedded_svg(self) -> bool:
    ...

@export_embedded_svg.setter
def export_embedded_svg(self, value: bool):
    ...

Examples

Shows how to determine where to store SVG objects when exporting a document to Html.

doc = aw.Document(file_name=MY_DIR + 'Images.docx')
# When we export a document with SVG objects to .html,
# Aspose.Words can place these objects in two possible locations.
# Setting the "ExportEmbeddedSvg" flag to "true" will embed all SVG object raw data
# within the output HTML, inside <image> tags.
# Setting this flag to "false" will create a file in the local file system for each SVG object.
# The HTML will link to each file using the "data" attribute of an <object> tag.
html_fixed_save_options = aw.saving.HtmlFixedSaveOptions()
html_fixed_save_options.export_embedded_svg = export_svgs
doc.save(file_name=ARTIFACTS_DIR + 'HtmlFixedSaveOptions.ExportEmbeddedSvgs.html', save_options=html_fixed_save_options)
out_doc_contents = system_helper.io.File.read_all_text(ARTIFACTS_DIR + 'HtmlFixedSaveOptions.ExportEmbeddedSvgs.html')
if export_svgs:
    self.assertFalse(system_helper.io.File.exist(ARTIFACTS_DIR + 'HtmlFixedSaveOptions.ExportEmbeddedSvgs/svg001.svg'))
    self.assertTrue(re.compile('<image id=\\"image004\\" xlink:href=.+/>').search(out_doc_contents) is not None)
else:
    self.assertTrue(system_helper.io.File.exist(ARTIFACTS_DIR + 'HtmlFixedSaveOptions.ExportEmbeddedSvgs/svg001.svg'))
    self.assertTrue(re.compile('<object type=\\"image/svg\\+xml\\" data=\\"HtmlFixedSaveOptions\\.ExportEmbeddedSvgs/svg001\\.svg\\"></object>').search(out_doc_contents) is not None)

See Also