Html5CanvasOptions
Inheritance: java.lang.Object, com.aspose.imaging.DisposableObject, com.aspose.imaging.ImageOptionsBase
public class Html5CanvasOptions extends ImageOptionsBase
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.
Constructors
Constructor | Description |
---|---|
Html5CanvasOptions() | Initializes a new instance of the Html5CanvasOptions class. |
Html5CanvasOptions(Html5CanvasOptions imageOptions) | Initializes a new instance of the ImageOptionsBase class. |
Methods
Method | Description |
---|---|
getCanvasTagId() | Gets the canvas tag identifier. |
setCanvasTagId(String value) | Sets the canvas tag identifier. |
getFullHtmlPage() | Gets a value indicating whether the full HTML page should be generated. |
setFullHtmlPage(boolean value) | Sets a value indicating whether the full HTML page should be generated. |
getEncoding() | Gets the encoding. |
setEncoding(Charset value) | Sets the encoding. |
Example: Any vector image (SVG, WMF, CMX, etc.
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.
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load("Sample.svg"))
{
com.aspose.imaging.imageoptions.VectorRasterizationOptions vectorRasterizationOptions = new com.aspose.imaging.imageoptions.SvgRasterizationOptions();
com.aspose.imaging.imageoptions.Html5CanvasOptions options = new com.aspose.imaging.imageoptions.Html5CanvasOptions();
options.setVectorRasterizationOptions(vectorRasterizationOptions);
image.save("Canvas.html", options);
}
Example: You can embed more than one Canvas image within HTML page or update already existing page.
You can embed more than one Canvas image within HTML page or update already existing page. In order to do that you need to export only the Canvas tag.
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load("Sample.svg"))
{
com.aspose.imaging.imageoptions.VectorRasterizationOptions vectorRasterizationOptions = new com.aspose.imaging.imageoptions.SvgRasterizationOptions();
com.aspose.imaging.imageoptions.Html5CanvasOptions options = new com.aspose.imaging.imageoptions.Html5CanvasOptions();
options.setVectorRasterizationOptions(vectorRasterizationOptions);
options.setFullHtmlPage(false);
image.save("Canvas.html", options);
}
Html5CanvasOptions()
public Html5CanvasOptions()
Initializes a new instance of the Html5CanvasOptions class.
Html5CanvasOptions(Html5CanvasOptions imageOptions)
public Html5CanvasOptions(Html5CanvasOptions imageOptions)
Initializes a new instance of the ImageOptionsBase
class.
Parameters:
Parameter | Type | Description |
---|---|---|
imageOptions | Html5CanvasOptions | The image options. |
getCanvasTagId()
public final String getCanvasTagId()
Gets the canvas tag identifier.
Returns: java.lang.String - the canvas tag identifier.
setCanvasTagId(String value)
public final void setCanvasTagId(String value)
Sets the canvas tag identifier.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.lang.String | the canvas tag identifier. |
getFullHtmlPage()
public final boolean getFullHtmlPage()
Gets a value indicating whether the full HTML page should be generated.
Returns: boolean - a value indicating whether the full HTML page should be generated.
setFullHtmlPage(boolean value)
public final void setFullHtmlPage(boolean value)
Sets a value indicating whether the full HTML page should be generated.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | a value indicating whether the full HTML page should be generated. |
Example: You can embed more than one Canvas image within HTML page or update already existing page. You can embed more than one Canvas image within HTML page or update already existing page. In order to do that you need to export only the Canvas tag.
try (com.aspose.imaging.Image image = com.aspose.imaging.Image.load("Sample.svg"))
{
com.aspose.imaging.imageoptions.VectorRasterizationOptions vectorRasterizationOptions = new com.aspose.imaging.imageoptions.SvgRasterizationOptions();
com.aspose.imaging.imageoptions.Html5CanvasOptions options = new com.aspose.imaging.imageoptions.Html5CanvasOptions();
options.setVectorRasterizationOptions(vectorRasterizationOptions);
options.setFullHtmlPage(false);
image.save("Canvas.html", options);
}
getEncoding()
public final Charset getEncoding()
Gets the encoding.
Returns: java.nio.charset.Charset - the encoding.
setEncoding(Charset value)
public final void setEncoding(Charset value)
Sets the encoding.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.nio.charset.Charset | the encoding. |