> For the complete documentation index, see [llms.txt](https://nswamy14.gitbook.io/node-i2djs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nswamy14.gitbook.io/node-i2djs/getting-started/quick-start-1.md).

# 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.

```
let PDFInstance = canvasPdfLayer({context config}, height, width);
```

canvasPdfLayer returns exclusive API to support creation of single or Multi page PDF creations.&#x20;

### &#x20;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.

```
let circle = pageInstance.createEl({
    el: 'circle',
    attr: {
        r: 50,
        cx: renderer.width / 2,
        cy: renderer.height / 2
    },
    style: {
        fillStyle: '#ff0000'
    }
})
```

### Apply changes to Canvas

With the below call, we are applying complete render tree onto the canvas layer.

```
PDFInstance.update()
```

### Export PDF

```
let pdfSteam = PDFInstance.exportPdf();
```

exportPdf api returns pdfStream.&#x20;
