react-pdf-js
react-pdf-js
provides a component for rendering PDF documents using PDF.js. Written for React 15/16 and ES2015 using the Airbnb style guide.
Demo
http://mikecousins.github.io/react-pdf-js/
Usage
Install with yarn add react-pdf-js
or npm install react-pdf-js
Use it in your app (showing some basic pagination as well):
;; Component state = {}; { this; } { this; } { this; } { let previousButton = <li className="previous" onClick=thishandlePrevious><a href="#"><i className="fa fa-arrow-left"></i> Previous</a></li>; if page === 1 previousButton = <li className="previous disabled"><a href="#"><i className="fa fa-arrow-left"></i> Previous</a></li>; let nextButton = <li className="next" onClick=thishandleNext><a href="#">Next <i className="fa fa-arrow-right"></i></a></li>; if page === pages nextButton = <li className="next disabled"><a href="#">Next <i className="fa fa-arrow-right"></i></a></li>; return <nav> <ul className="pager"> previousButton nextButton </ul> </nav> ; } { let pagination = null; if thisstatepages pagination = this; return <div> <PDF file="test.pdf" onDocumentComplete=thisonDocumentComplete page=thisstatepage /> pagination </div> } ;
License
MIT © mikecousins