Add a PDFLinkService
instance to the "simpleviewer" component example
This commit is contained in:
parent
e876dd8123
commit
297f760dce
@ -34,17 +34,26 @@ if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
|
||||
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';
|
||||
|
||||
var container = document.getElementById('viewerContainer');
|
||||
|
||||
// (Optionally) enable hyperlinks within PDF files.
|
||||
var pdfLinkService = new PDFJS.PDFLinkService();
|
||||
|
||||
var pdfViewer = new PDFJS.PDFViewer({
|
||||
container: container
|
||||
container: container,
|
||||
linkService: pdfLinkService,
|
||||
});
|
||||
pdfLinkService.setViewer(pdfViewer);
|
||||
|
||||
container.addEventListener('pagesinit', function () {
|
||||
// we can use pdfViewer now, e.g. let's change default scale.
|
||||
// We can use pdfViewer now, e.g. let's change default scale.
|
||||
pdfViewer.currentScaleValue = 'page-width';
|
||||
});
|
||||
|
||||
// Loading document.
|
||||
PDFJS.getDocument(DEFAULT_URL).then(function (pdfDocument) {
|
||||
// Document loaded, specifying document for the viewer.
|
||||
// Document loaded, specifying document for the viewer and
|
||||
// the (optional) linkService.
|
||||
pdfViewer.setDocument(pdfDocument);
|
||||
|
||||
pdfLinkService.setDocument(pdfDocument, null);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user