mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 17:48:07 +02:00
Refactors FindController dependencies.
This commit is contained in:
parent
3d49879211
commit
81fc46e666
5 changed files with 60 additions and 43 deletions
|
@ -30,6 +30,7 @@ PDFJS.workerSrc = '../../build/pdf.worker.js';
|
|||
// PDFJS.cMapPacked = true;
|
||||
|
||||
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';
|
||||
var SEARCH_FOR = ''; // try 'Mozilla';
|
||||
|
||||
var container = document.getElementById('viewerContainer');
|
||||
|
||||
|
@ -42,9 +43,19 @@ var pdfViewer = new PDFJS.PDFViewer({
|
|||
});
|
||||
pdfLinkService.setViewer(pdfViewer);
|
||||
|
||||
// (Optionally) enable find controller.
|
||||
var pdfFindController = new PDFJS.PDFFindController({
|
||||
pdfViewer: pdfViewer
|
||||
});
|
||||
pdfViewer.setFindController(pdfFindController);
|
||||
|
||||
container.addEventListener('pagesinit', function () {
|
||||
// We can use pdfViewer now, e.g. let's change default scale.
|
||||
pdfViewer.currentScaleValue = 'page-width';
|
||||
|
||||
if (SEARCH_FOR) { // We can try search for things
|
||||
pdfFindController.executeCommand('find', {query: SEARCH_FOR});
|
||||
}
|
||||
});
|
||||
|
||||
// Loading document.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue