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
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,10 @@ html2pdf converts any webpage or element into a printable PDF entirely client-si
6
6
7
7
There are two ways to install html2pdf:
8
8
9
-
1.**NPM:** Use `npm install --save html2pdf` to add html2pdf and its dependencies to your project. *Note: html2pdf **will not** run in Node.js, it must be run in a browser.*
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
+
1.**NPM:** Use `npm install --save html2pdf` 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:
11
+
12
+
`<script src="html2pdf.bundle.min.js"></script>`.
11
13
12
14
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:
13
15
@@ -16,11 +18,13 @@ var element = document.getElementById('element-to-print');
16
18
html2pdf(element);
17
19
```
18
20
21
+
**Note:** html2pdf **will not run in Node.js**, it must be run in a browser.
22
+
19
23
*[Click here](#dependencies) for more information about using the unbundled version `dist/html2canvas.min.js`.*
20
24
21
25
## Options
22
26
23
-
The PDF can be configured using an optional `opt` parameter:
27
+
html2pdf can be configured using an optional `opt` parameter:
24
28
25
29
```js
26
30
var element =document.getElementById('element-to-print');
@@ -69,9 +73,9 @@ These options are limited to the available settings for [HTMLCanvasElement.toDat
69
73
70
74
## Dependencies
71
75
72
-
html2pdf depends on the external packages [`html2canvas`](https://github.com/niklasvh/html2canvas) and [`jsPDF`](https://github.com/MrRio/jsPDF). These dependencies are automatically loaded when using NPM or the bundled package.
76
+
html2pdf depends on the external packages [html2canvas](https://github.com/niklasvh/html2canvas) and [jsPDF](https://github.com/MrRio/jsPDF). These dependencies are automatically loaded when using NPM or the bundled package.
73
77
74
-
If using the un-bundled`dist/html2pdf.min.js` (or its un-minified version), you must also include each dependency. Order is important, otherwise html2canvas will be overridden by jsPDF's own internal implementation:
78
+
If using the unbundled`dist/html2pdf.min.js` (or its un-minified version), you must also include each dependency. Order is important, otherwise html2canvas will be overridden by jsPDF's own internal implementation:
0 commit comments