JSPM

saiku-react-pdfjs

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q35601F
  • License Apache-2.0

A React component to wrap PDF.js

Package Exports

  • saiku-react-pdfjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (saiku-react-pdfjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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