Skip to content
A React component to wrap PDF.js
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
docs
src
storybook
.babelrc
.editorconfig
.gitignore
.npmignore
CONTRIBUTING.md
LICENSE
README.md
package.json
yarn.lock

README.md

Saiku React PDF.js

A React component to wrap PDF.js.

npm downloads npm version npm license

Requirements

  • Node.js v6.0.0 or higher
  • NPM (v3.0.0+ recommended) (this comes with Node.js)

Installation

Using NPM:

npm install --save saiku-react-pdfjs

Using Yarn:

yarn add saiku-react-pdfjs

Usage

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;

Storybook

You can access saiku-react-pdfjs storybook here.

Contributing

If you want to help, please read the Contributing guide.

History

For detailed changelog, see Releases.

Credits

Big thanks to these great repositories:

License

Apache License Version 2 © Meteorite BI

You can’t perform that action at this time.