mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Move the cMapUrl
and cMapPacked
options from the global PDFJS
object and into getDocument
instead
This commit is contained in:
parent
b674409397
commit
3c2fbdffe6
13 changed files with 72 additions and 63 deletions
|
@ -15,7 +15,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
if (!PDFJS.PDFViewer || !PDFJS.getDocument) {
|
||||
if (!PDFJS.PDFPageView || !PDFJS.getDocument) {
|
||||
alert('Please build the pdfjs-dist library using\n' +
|
||||
' `gulp dist-install`');
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ PDFJS.GlobalWorkerOptions.workerSrc =
|
|||
|
||||
// Some PDFs need external cmaps.
|
||||
//
|
||||
// PDFJS.cMapUrl = '../../node_modules/pdfjs-dist/cmaps/';
|
||||
// PDFJS.cMapPacked = true;
|
||||
var CMAP_URL = '../../node_modules/pdfjs-dist/cmaps/';
|
||||
var CMAP_PACKED = true;
|
||||
|
||||
var DEFAULT_URL = '../../web/compressed.tracemonkey-pldi-09.pdf';
|
||||
var PAGE_TO_VIEW = 1;
|
||||
|
@ -37,7 +37,11 @@ var SCALE = 1.0;
|
|||
var container = document.getElementById('pageContainer');
|
||||
|
||||
// Loading document.
|
||||
PDFJS.getDocument(DEFAULT_URL).then(function (pdfDocument) {
|
||||
PDFJS.getDocument({
|
||||
url: DEFAULT_URL,
|
||||
cMapUrl: CMAP_URL,
|
||||
cMapPacked: CMAP_PACKED,
|
||||
}).then(function(pdfDocument) {
|
||||
// Document loaded, retrieving the page.
|
||||
return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
|
||||
// Creating the page view with default parameters.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue