File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 2727 margin : 0 ;
2828 padding : 0 ;
2929 }
30+ # viewerContainer {
31+ overflow : auto;
32+ position : absolute;
33+ width : 100% ;
34+ height : 100% ;
35+ }
3036 </ style >
3137
3238 < link rel ="stylesheet " href ="../../build/components/pdf_viewer.css ">
Original file line number Diff line number Diff line change @@ -34,17 +34,26 @@ if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
3434var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf' ;
3535
3636var container = document . getElementById ( 'viewerContainer' ) ;
37+
38+ // (Optionally) enable hyperlinks within PDF files.
39+ var pdfLinkService = new PDFJS . PDFLinkService ( ) ;
40+
3741var pdfViewer = new PDFJS . PDFViewer ( {
38- container : container
42+ container : container ,
43+ linkService : pdfLinkService ,
3944} ) ;
45+ pdfLinkService . setViewer ( pdfViewer ) ;
4046
4147container . addEventListener ( 'pagesinit' , function ( ) {
42- // we can use pdfViewer now, e.g. let's change default scale.
48+ // We can use pdfViewer now, e.g. let's change default scale.
4349 pdfViewer . currentScaleValue = 'page-width' ;
4450} ) ;
4551
4652// Loading document.
4753PDFJS . getDocument ( DEFAULT_URL ) . then ( function ( pdfDocument ) {
48- // Document loaded, specifying document for the viewer.
54+ // Document loaded, specifying document for the viewer and
55+ // the (optional) linkService.
4956 pdfViewer . setDocument ( pdfDocument ) ;
57+
58+ pdfLinkService . setDocument ( pdfDocument , null ) ;
5059} ) ;
You can’t perform that action at this time.
0 commit comments