Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.
/ pdfviewer Public archive

PDF Viewer using Mozilla PDF JS

License

Notifications You must be signed in to change notification settings

teambition/pdfviewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PDF Viewer

Lightweight PDF viewer using Mozilla's PDF JS.

NPM version Build Status

Screenshot

'screenshot'

Pre-requirments

npm install
npm run build

Deploy dist to your own static server.

Usage

See example in test directory

Options

The options PdfViewer accepts are:

  1. pdfUrl(required): URL to your pdf file, can be relative or absolute. If it is a cross-domain path, the remote server must support CORS.

  2. staticHost(required): Static files host, PdfViewer dependents on Mozila's PDF.js and our viewer.js, which must be served.

  3. onerror(optional): A custom onerror callback function, if error occurs when reading or rendering your pdf file, this function will be called. If omitted, our viewer's default error handler will be used.

Examples

To get a demo:

  1. Run command:
npm start
  1. Test viewer.js:
http://localhost:9000
  1. Test pdfviewer.js (viewer.js in iframe):
http://localhost:9001

Who's using