Gathering detailed insights and metrics for simple-react-pdf
Gathering detailed insights and metrics for simple-react-pdf
Gathering detailed insights and metrics for simple-react-pdf
Gathering detailed insights and metrics for simple-react-pdf
npm install simple-react-pdf
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
17 Stars
4 Commits
19 Forks
1 Watching
1 Branches
1 Contributors
Updated on 01 Dec 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
346.9%
362
Compared to previous day
Last week
182.7%
1,866
Compared to previous week
Last month
2.3%
5,285
Compared to previous month
Last year
51.2%
50,890
Compared to previous year
This is Simple PDF React component with vertical scroll bar. However, If your pdf document has only one page there will not be any scroll bar by default. If you still need scroll bars, just use CSS example (see demo index.html code for more details).
This version uses pdfjs-dist (npm PDF.js version) and ES6 syntax. Has been built with Babel and contains demo built with Browserify.
Screenshot example (3 x Simple PDF React component):
npm install simple-react-pdf
However, in production or if you do not plan to re-build it, do not install devDependencies
. See npm documentation page.
This is simple example that should be used in most cases. The pdf size (each canvas) will be automatically adjusted to the box size (div
with class SimplePDF
).
.SimplePDF {
width: 350px; /* width of pdf document box should be != 0 */
height: 500px; /* height of pdf document box should be != 0 */
border: 1px dashed red; /* optional */
margin: 15px; /* optional */
padding: 15px; /* optional */
float: left; /* optional */
}
The JavaScript React component code you have to use in your project:
import React from "react";
import ReactDOM from "react-dom";
import spdf from "simple-react-pdf";
<spdf.SimplePDF file="./example1.pdf"/>
*) Of course change the "example1.pdf
" to your pdf document filename and re-build the JavaScript code.
To update React component (e.g. load new pdf file after button click), you just have to send new props
to the React component again (see demo index.js for more details).
The demo is available in module directory. To test the demo just go to demo
directory in module folder and open index.html
in your browser.
cd node_modules/simple-react-pdf/demo
firefox index.html
For other browsers:
google-chrome --allow-file-access-from-files index.html
opera --allow-file-access-from-files index.html
In order to avoid Cross-Origin Resource Sharing (CORS) issue consider simple-react-pdf-service.
However, you can build the demo again with npm tool (e.g. after your private changes). To re-build the demo just go to demo
directory in module folder (if you are not there already):
cd node_modules/simple-react-pdf/demo
and run command:
npm run build
This should download all packages and build the demo index.js
file again. After it, you can open index.html
in your browser. Should work :-)
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/4 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
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