Quick Start Canvas PDF Layer
Get started with node-i2d to create rich visualisations on node platform.
Integrate source code as specified on the installation page.
Import node-i2djs module
let { canvasPdfLayer } = require("node-i2djs");
Layer Creation:
Node-I2Djs offers an API for generating multi-page PDF documents. The following line of code creates a PDF instance using the canvasPdfLayer function, passing in the canvas context, as well as height and width as arguments.
canvasPdfLayer returns exclusive API to support creation of single or Multi page PDF creations.
Page creation
Invoking addPage method via PDFInstance returns pageInstance.
let
pageInstance = PDFInstance.addPage();
Element Creation:
pageInstance provides createEl api to create graphical elements. In the below example we are creating Circle element with attributes and style properties as specified below.
Apply changes to Canvas
With the below call, we are applying complete render tree onto the canvas layer.
Export PDF
exportPdf api returns pdfStream.
Last updated