[Pkg-javascript-commits] [pdf.js] 133/157: Add a `PDFLinkService` instance to the "simpleviewer" component example

David Prévot taffit at moszumanska.debian.org
Tue Aug 11 06:46:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 297f760dced40f077a7c97c67ece43961dc7b336
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date:   Thu Jun 25 12:24:29 2015 +0200

    Add a `PDFLinkService` instance to the "simpleviewer" component example
---
 examples/components/simpleviewer.js | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/examples/components/simpleviewer.js b/examples/components/simpleviewer.js
index 139adfa..db8256f 100644
--- a/examples/components/simpleviewer.js
+++ b/examples/components/simpleviewer.js
@@ -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);
 });

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list