You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-8Lines changed: 21 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,22 +4,35 @@ html2pdf converts any webpage or element into a printable PDF entirely client-si
4
4
5
5
## Getting started
6
6
7
-
There are two ways to install html2pdf:
7
+
### HTML
8
8
9
-
1.**NPM:** Use `npm install --save html2pdf.js` to add html2pdf and its dependencies to your project.
10
-
2.**HTML:** Download `dist/html2pdf.bundle.min.js` to your project folder and include it in your HTML with: `<script src="html2pdf.bundle.min.js"></script>`.
9
+
The simplest way to use html2pdf is to download `dist/html2pdf.bundle.min.js` to your project folder and include it in your HTML with:
11
10
12
-
Once installed, html2pdf is ready to use. This command will generate a PDF of `#element-to-print` and prompt the user to save the result:
11
+
```html
12
+
<scriptsrc="html2pdf.bundle.min.js"></script>
13
+
```
14
+
15
+
*[Click here](#dependencies) for more information about using the unbundled version `dist/html2canvas.min.js`.*
16
+
17
+
### NPM
18
+
19
+
Install html2pdf and its dependencies using NPM with `npm install --save html2pdf.js` (make sure to include `.js` in the package name).
20
+
21
+
*Note: You can use NPM to create your project, but html2pdf **will not run in Node.js**, it must be run in a browser.*
22
+
23
+
### Bower
24
+
25
+
Install html2pdf and its dependencies using Bower with `bower install --save html2pdf.js` (make sure to include `.js` in the package name).
26
+
27
+
## Usage
28
+
29
+
Once installed, html2pdf is ready to use. The following command will generate a PDF of `#element-to-print` and prompt the user to save the result:
13
30
14
31
```js
15
32
var element =document.getElementById('element-to-print');
16
33
html2pdf(element);
17
34
```
18
35
19
-
*Note: html2pdf **will not run in Node.js**, it must be run in a browser.*
20
-
21
-
*[Click here](#dependencies) for more information about using the unbundled version `dist/html2canvas.min.js`.*
22
-
23
36
## Options
24
37
25
38
html2pdf can be configured using an optional `opt` parameter:
0 commit comments