Skip to content

Commit cd774b7

Browse files
committed
Merge branch 'develop'
2 parents 401c95a + bdd01ad commit cd774b7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ Install html2pdf and its dependencies using NPM with `npm install --save html2pd
4949

5050
Install html2pdf and its dependencies using Bower with `bower install --save html2pdf.js` (make sure to include `.js` in the package name).
5151

52+
#### Console
53+
54+
If you're on a webpage that you can't modify directly and wish to use html2pdf to capture a screenshot, you can follow these steps:
55+
56+
1. Open your browser's console (instructions for different browsers [here](https://webmasters.stackexchange.com/a/77337/94367)).
57+
2. Paste in this code:
58+
```js
59+
function addScript(url) {
60+
var script = document.createElement('script');
61+
script.type = 'application/javascript';
62+
script.src = url;
63+
document.head.appendChild(script);
64+
}
65+
addScript('https://raw.githack.com/eKoopmans/html2pdf/master/dist/html2pdf.bundle.js');
66+
```
67+
3. You may now execute html2pdf commands directly from the console. To capture a default PDF of the entire page, use `html2pdf(document.body)`.
68+
5269
## Usage
5370

5471
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:

0 commit comments

Comments
 (0)