1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Adds fetch stream logic for networking part of PDF.js

This commit is contained in:
Mukul Mishra 2017-08-10 13:00:54 +05:30
parent f54dfc63dc
commit 3516a59384
6 changed files with 270 additions and 20 deletions

View file

@ -45,6 +45,7 @@ function initializePDFJS(callback) {
'pdfjs/display/global',
'pdfjs/display/api',
'pdfjs/display/network',
'pdfjs/display/fetch_stream',
'pdfjs-test/unit/annotation_spec',
'pdfjs-test/unit/api_spec',
'pdfjs-test/unit/bidi_spec',
@ -76,9 +77,15 @@ function initializePDFJS(callback) {
var displayGlobal = modules[0];
var displayApi = modules[1];
var PDFNetworkStream = modules[2].PDFNetworkStream;
var PDFFetchStream = modules[3].PDFFetchStream;
// Set network stream class for unit tests.
displayApi.setPDFNetworkStreamClass(PDFNetworkStream);
if (typeof Response !== 'undefined' && 'body' in Response.prototype) {
displayApi.setPDFNetworkStreamClass(PDFFetchStream);
} else {
displayApi.setPDFNetworkStreamClass(PDFNetworkStream);
}
// Configure the worker.
displayGlobal.PDFJS.workerSrc = '../../build/generic/build/pdf.worker.js';
// Opt-in to using the latest API.