2017-12-07 18:49:40 +03:00
|
|
|
---
|
|
|
|
title: "Getting Started"
|
2017-12-10 11:43:34 +03:00
|
|
|
description: "Learn how to start using html2canvas"
|
2017-12-10 17:28:34 +03:00
|
|
|
previousUrl: "/documentation"
|
2017-12-10 11:43:34 +03:00
|
|
|
previousTitle: "About"
|
|
|
|
nextUrl: "/configuration"
|
|
|
|
nextTitle: "Configuration"
|
2017-12-07 18:49:40 +03:00
|
|
|
---
|
|
|
|
|
2017-12-10 11:43:34 +03:00
|
|
|
## Installing
|
2017-12-07 18:49:40 +03:00
|
|
|
|
|
|
|
You can install `html2canvas` through npm or [download a built release](https://github.com/niklasvh/html2canvas/releases).
|
|
|
|
|
|
|
|
### npm
|
|
|
|
|
|
|
|
npm install html2canvas
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
import html2canvas from 'html2canvas';
|
|
|
|
```
|
|
|
|
|
2017-12-10 11:43:34 +03:00
|
|
|
## Usage
|
2017-12-07 18:49:40 +03:00
|
|
|
|
|
|
|
To render an `element` with html2canvas with some (optional) [options](/configuration/), simply call `html2canvas(element, options);`
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
html2canvas(document.body).then(function(canvas) {
|
|
|
|
document.body.appendChild(canvas);
|
|
|
|
});
|
|
|
|
```
|