Packages

 

com.aspose.imaging.imageoptions

Class Html5CanvasOptions

  • All Implemented Interfaces:
    com.aspose.ms.System.IDisposable, Closeable, AutoCloseable


    public class Html5CanvasOptions
    extends ImageOptionsBase

    The Html5 Canvas file format creation options.

    Code example:

    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);
    }
    

    • Constructor Detail

      • Html5CanvasOptions

        public Html5CanvasOptions()

        Initializes a new instance of the Html5CanvasOptions class.

      • Html5CanvasOptions

        public Html5CanvasOptions(Html5CanvasOptions imageOptions)

        Initializes a new instance of the ImageOptionsBase class.

        Parameters:
        imageOptions - The image options.
    • Method Detail

      • getCanvasTagId

        public final String getCanvasTagId()

        Gets the canvas tag identifier.

        Returns:
        the canvas tag identifier.
      • setCanvasTagId

        public final void setCanvasTagId(String value)

        Sets the canvas tag identifier.

        Parameters:
        value - the canvas tag identifier.
      • getFullHtmlPage

        public final boolean getFullHtmlPage()

        Gets a value indicating whether the full HTML page should be generated.

        Returns:
        a value indicating whether the full HTML page should be generated.
      • setFullHtmlPage

        public final void setFullHtmlPage(boolean value)

        Sets a value indicating whether the full HTML page should be generated.

        Parameters:
        value - a value indicating whether the full HTML page should be generated.
        Code example:

        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:
        the encoding.
      • setEncoding

        public final void setEncoding(Charset value)

        Sets the encoding.

        Parameters:
        value - the encoding.