canvasPdfLayer
Layer API:
#.canvasPdfLayer( contextObject, height, width);
canvasPdfLayer API return rendering instance of Canvas-2D context. It accepts multiple parameters as specified below.
Example:
contextAttrObject - Canvas context attributes, which will be passed to the getContext method.
height: height of the PDF page
width: width of the PDF page
Layer Methods:
Layer.addPage()
Layer.exportPdf()
Layer.data()
PageInstance API:
pageInstance.setLayerId( String ) - For setting ID attribute to the Layer Dom element.
pageInstance.setClear( function ) - To set clear callback method. Accepts function as an input, which gets invoked on every refresh Cycle before render begins. The clear function gets context as an argument.
pageInstance.SetPixelRation( Int ); - To set device Pixel ratio.
pageInstance.SetSize( width, height ); - Optional - To set the Size of the canvas layer. If not, the parent container size will be inherited by the layer.
pageInstance.getPixels( x, y, width, height ); - To fetch pixels from the specified rectangle area of the canvas layer. It returns the ImageData object.
pageInstance.putPixels( imageData, x, y ); - To paint pixels to the canvas. It accepts ImageData along with position x, y as an argument.
pageInstance.clear( ); - To clear the canvas. It can be invoked in some special cases to clear the canvas.
pageInstance.setContext( prop, value ); - To set properties to the canvas context.
pageInstance.update( ); - To manually trigger the Layer update. In the case of the default behaviour, all the changes from VDOM will be applied to the DOM as a part of the refresh cycle.
pageInstance.destroy( ); - To remove layer instance. It removes the DOM element along with the vDOM. and Also unbinds all the event listeners is any.
Last updated