Html5CanvasOptions Class

Summary: Create HTML5 Canvas files effortlessly with our API, allowing you to seamlessly
combine elements like forms, text, images, animations, and links. Benefit from
robust features including tag identifier and encoding settings support,
ensuring optimal performance and customization for your web projects.

Module: aspose.imaging.imageoptions

Full Name: aspose.imaging.imageoptions.Html5CanvasOptions

Inheritance: IHasXmpData, IHasMetadata, ImageOptionsBase

Constructors

NameDescription
Html5CanvasOptions()Initializes a new instance of the Html5CanvasOptions class.

Properties

NameTypeAccessDescription
buffer_size_hintintr/wGets or sets the buffer size hint which is defined max allowed size for all internal buffers.
canvas_tag_idstringr/wGets or sets the canvas tag identifier.
disposedboolrGets a value indicating whether this instance is disposed.
encodingstringr/wGets or sets the encoding.
full_frameboolr/wGets or sets a value indicating whether [full frame].
full_html_pageboolr/wGets or sets a value indicating whether the full HTML page should be generated.
keep_metadataboolr/wGets a value whether to keep original image metadata on export.
multi_page_optionsMultiPageOptionsr/wThe multipage options
paletteIColorPaletter/wGets or sets the color palette.
resolution_settingsResolutionSettingr/wGets or sets the resolution settings.
sourceSourcer/wGets or sets the source to create image in.
vector_rasterization_optionsVectorRasterizationOptionsr/wGets or sets the vector rasterization options.
xmp_dataXmpPacketWrapperr/wGets or sets the XMP metadata container.

Methods

NameDescription
clone()Clones this instance.

Constructor: Html5CanvasOptions()

 Html5CanvasOptions() 

Initializes a new instance of the Html5CanvasOptions class.

Method: clone()

 clone() 

Clones this instance.

Returns

TypeDescription
ImageOptionsBaseReturns shallow copy of this instance

Examples

Any vector image (SVG, WMF, CMX, etc.) can be used as a source for your Canvas images. The following code creates a simple Canvas image.


from aspose.imaging import Image
from aspose.imaging.imageoptions import Html5CanvasOptions, SvgRasterizationOptions

with Image.load("Sample.svg") as image:
	export_options = Html5CanvasOptions()
	export_options.vector_rasterization_options = SvgRasterizationOptions()
	image.save("Canvas.html", export_options)

You can embed more than one Canvas image within HTML page or update already exsiting page. In order to do that you need to export only the Canvas tag.


from aspose.imaging import Image
from aspose.imaging.imageoptions import Html5CanvasOptions, SvgRasterizationOptions

with Image.load("Sample.svg") as image:
	options = Html5CanvasOptions()
	options.vector_rasterization_options = SvgRasterizationOptions()
	options.full_html_page = False
	image.save("Canvas.html", options)