com.aspose.html

Class HTMLCanvasElement

    • Constructor Detail

      • HTMLCanvasElement

        public HTMLCanvasElement(com.aspose.html.dom.DOMName name,
                                 Document doc)
    • Method Detail

      • getWidth

        @DOMNameAttribute(name="width")
        public long getWidth()

        Is a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.

      • setWidth

        @DOMNameAttribute(name="width")
        public void setWidth(long value)

        Is a positive integer reflecting the width HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 300 is used.

      • getHeight

        @DOMNameAttribute(name="height")
        public long getHeight()

        Is a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.

      • setHeight

        @DOMNameAttribute(name="height")
        public void setHeight(long value)

        Is a positive integer reflecting the height HTML attribute of the canvas element interpreted in CSS pixels. When the attribute is not specified, or if it is set to an invalid value, like a negative, the default value of 150 is used.

      • toDataURL

        @DOMNameAttribute(name="toDataURL")
        public String toDataURL(@DOMParameterAttribute(name="type",optional=true)
                                                                     String type,
                                                                     @DOMParameterAttribute(name="type",optional=true)
                                                                     double encoderOptions)

        returns a data URI containing a representation of the image in the format specified by the type parameter (defaults to PNG). The returned image is in a resolution of 96 dpi.

        Parameters:
        type - A string indicating the image format. The default format type is image/png.
        encoderOptions - A Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp.
        Returns:
        A DOMString containing the requested data URI.
      • getBlob

        public com.aspose.html.io.Blob getBlob()
      • getBlob

        public com.aspose.html.io.Blob getBlob(String type)
      • getBlob

        public com.aspose.html.io.Blob getBlob(String type,
                                               double encoderOptions)
      • getContext

        @DOMNameAttribute(name="getContext")
        public Object getContext(String contextId,
                                                                       Object... args)

        Returns a drawing context on the canvas, or null if the context ID is not supported. A drawing context lets you draw on the canvas.

        Parameters:
        contextId - Is a string containing the context identifier defining the drawing context associated to the canvas
        args - Context attributes
        Returns:
        A RenderingContext