A React component to wrap PDF.js.
- Node.js v6.0.0 or higher
- NPM (v3.0.0+ recommended) (this comes with Node.js)
Using NPM:
npm install --save saiku-react-pdfjs
Using Yarn:
yarn add saiku-react-pdfjs
Here's an example of basic usage:
import React, { Component } from 'react';
import SaikuPDF from 'saiku-react-pdfjs';
class MyApp extends Component {
constructor(props) {
super(props);
this.onDocumentComplete = this.onDocumentComplete.bind(this);
this.onPageComplete = this.onPageComplete.bind(this);
}
onDocumentComplete(numberOfPages, pdf) {
this.setState({ numberOfPages });
},
onPageComplete(currentPage, page) {
this.setState({ currentPage });
}
render() {
return (
<div>
<SaikuPDF
file="someFile.pdf"
page={2}
scale={1}
onDocumentComplete={this.onDocumentComplete}
onPageComplete={this.onPageComplete}
/>
<p>Page {this.state.currentPage} of {this.state.numberOfPages}</p>
</div>
);
}
}
export default MyApp;
You can access saiku-react-pdfjs storybook here.
If you want to help, please read the Contributing guide.
For detailed changelog, see Releases.
Big thanks to these great repositories:
Apache License Version 2 © Meteorite BI