Gathering detailed insights and metrics for html2canvas
Gathering detailed insights and metrics for html2canvas
Gathering detailed insights and metrics for html2canvas
Gathering detailed insights and metrics for html2canvas
jspdf-html2canvas
A combine usage with jsPDF and html2canvas, which translating html content to PDF file.
@types/html2canvas
Stub TypeScript definitions entry for html2canvas, which provides its own types definitions
html2canvas-proxy
Cross-origin content proxy for html2canvas
vue-html2canvas
Vue mixin for Html2Canvas
npm install html2canvas
Typescript
Module System
Min. Node Version
Node Version
NPM Version
98.8
Supply Chain
93.1
Quality
76.2
Maintenance
100
Vulnerability
100
License
TypeScript (58.25%)
HTML (29.98%)
JavaScript (11.51%)
CSS (0.26%)
Total
278,102,235
Last Day
76,222
Last Week
2,355,991
Last Month
9,634,530
Last Year
94,602,778
30,719 Stars
1,066 Commits
4,818 Forks
506 Watching
6 Branches
50 Contributors
Latest Version
1.4.1
Package Id
html2canvas@1.4.1
Unpacked Size
3.22 MB
Size
604.93 kB
File Count
391
NPM Version
6.14.15
Node Version
12.22.9
Publised On
09 Dec 2024
Cumulative downloads
Total Downloads
Last day
12.9%
76,222
Compared to previous day
Last week
7.2%
2,355,991
Compared to previous week
Last month
1.7%
9,634,530
Compared to previous month
Last year
36.7%
94,602,778
Compared to previous year
2
72
Homepage | Downloads | Questions
The script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
The script renders the current page as a canvas image, by reading the DOM and the different styles applied to the elements.
It does not require any rendering from the server, as the whole image is created on the client's browser. However, as it is heavily dependent on the browser, this library is not suitable to be used in nodejs. It doesn't magically circumvent any browser content policy restrictions either, so rendering cross-origin content will require a proxy to get the content to the same origin.
The script is still in a very experimental state, so I don't recommend using it in a production environment nor start building applications with it yet, as there will be still major changes made.
The library should work fine on the following browsers (with Promise
polyfill):
As each CSS property needs to be manually built to be supported, there are a number of properties that are not yet supported.
The html2canvas library utilizes Promise
s and expects them to be available in the global context. If you wish to
support older browsers that do not natively support Promise
s, please include a polyfill such as
es6-promise before including html2canvas
.
To render an element
with html2canvas, simply call:
html2canvas(element[, options]);
The function returns a Promise containing the <canvas>
element. Simply add a promise fulfillment handler to the promise using then
:
html2canvas(document.body).then(function(canvas) {
document.body.appendChild(canvas);
});
You can download ready builds here.
Clone git repository:
$ git clone git://github.com/niklasvh/html2canvas.git
Install dependencies:
$ npm install
Build browser bundle
$ npm run build
For more information and examples, please visit the homepage or try the test console.
If you wish to contribute to the project, please send the pull requests to the develop branch. Before submitting any changes, try and test that the changes work with all the support browsers. If some CSS property isn't supported or is incomplete, please create appropriate tests for it as well before submitting any code changes.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
142 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-02
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More