pdf-viewer-reactjs
Simple react PDF Viewer component with controls like
-
Page navigation
-
Zoom
-
Rotation
Every element can be styled upon your preferences using default classes your own and also custom react element can be passed.
it is originally forked from mgr-pdf-viewer-react
Example: Live demo is available here
How to install
npm install pdf-viewer-reactjs
Note:
Due to causing broken css issue bulma, bulma-helpers & material-design-icons are removed from dependencies and added as peerDependencies
Please install bulma, bulma-helpers & material-design-icons from npm by yourself or provide custom css as per your requirement
How to use
import React from 'react'
import PDFViewer from 'pdf-viewer-reactjs'
const ExamplePDFViewer = () => {
return (
<PDFViewer
document={{
url: 'https://arxiv.org/pdf/quant-ph/0410100.pdf',
}}
/>
)
}
export default ExamplePDFViewer
Documentation
React component prop. types:
PropTypes.shape({
url: String,
base64: String,
})
PropTypes.shape({
scale: PropTypes.number,
rotationAngle: PropTypes.number,
})
PropTypes.shape({
text: PropTypes.string,
diagonal: PropTypes.bool,
opacity: PropTypes.string,
font: PropTypes.string,
size: PropTypes.string,
color: PropTypes.string,
})
PropTypes.oneOfType([
PropTypes.shape({
css: PropTypes.shape({
navbarWrapper: String,
zoomOutBtn: String,
resetZoomBtn: String,
zoomInBtn: String,
previousPageBtn: String,
pageIndicator: String,
nextPageBtn: String,
rotateLeftBtn: String,
resetRotationBtn: String,
rotateRightBtn: String
})
PropTypes.any
]);
Author
Ansuman Ghosh
ansu5555.com