GithubHelp home page GithubHelp logo

osbi / saiku-react-pdfjs Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 933 KB

A React component to wrap PDF.js

Home Page: https://www.npmjs.com/package/saiku-react-pdfjs

License: Apache License 2.0

JavaScript 100.00%
react reactjs react-pdf pdf pdf-viewer pdfjs

saiku-react-pdfjs's Introduction

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

saiku-react-pdfjs's People

Contributors

brenopolanski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

saiku-react-pdfjs's Issues

Pass PDF password callbacks?

Doesn't seem that password handling is implemented, all it takes is a password callback to the PDFJS.getDocument if I'm not wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.