File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,23 @@ Install html2pdf and its dependencies using NPM with `npm install --save html2pd
4949
5050Install 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
5471Once 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:
You can’t perform that action at this time.
0 commit comments