A basic PDF Viewer for SproutCore.
- PDF Rendering using the great Mozilla PDF.js Library (https://github.com/mozilla/pdf.js)
- Page navigation
- Zoom in/out
- Printing
First, you will have to include PDF.js (https://github.com/mozilla/pdf.js). Since the library is a bit heavy, you may want to load it as a module.
We recommand you to include:
- compatibility.js
- pdf.js
Once PDF.js is loaded you have to set some variables:
PDFJS.workerSrc = "http://assets.example.com/pdf.worker.js";
PDFJS.imageResourcesPath = "http://assets.example.com/images";
PDFJS.cMapUrl = "http://assets.example.com/cmaps";
PDFJS.cMapPacked = true;
You can add a PDF viewer the same as you would for any control:
MyApp.MyPdfView = SC.PdfViewerView.extend({
value: 'https://github.com/mozilla/pdf.js/raw/master/web/compressed.tracemonkey-pldi-09.pdf'
})
- Multiple pages rendering
- Provides text-selection functionality
- Provides a "search" or "find" functionality
- Add some tests
The MIT License (MIT)