Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
simple-react-pdf
Advanced tools
Simple PDF React component with vertical scroll bar (pdfjs-dist, ES6 syntax, Babel, Browserify).
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
FAQs
Simple PDF React component with vertical scroll bar (pdfjs-dist, ES6 syntax, Babel, Browserify).
The npm package simple-react-pdf receives a total of 588 weekly downloads. As such, simple-react-pdf popularity was classified as not popular.
We found that simple-react-pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.