function CustomStyle() {}
n/a
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function CustomStyle() {}
n/a
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
n/a
function Metadata(meta) { if (typeof meta === 'string') { meta = fixMetadata(meta); var parser = new DOMParser(); meta = parser.parseFromString(meta, 'application/xml'); } else if (!(meta instanceof Document)) { (0, _util.error)('Metadata: Invalid metadata object'); } this.metaDocument = meta; this.metadata = Object.create(null); this.parse(); }
n/a
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
n/a
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { this.viewBox = viewBox; this.scale = scale; this.rotation = rotation; this.offsetX = offsetX; this.offsetY = offsetY; var centerX = (viewBox[2] + viewBox[0]) / 2; var centerY = (viewBox[3] + viewBox[1]) / 2; var rotateA, rotateB, rotateC, rotateD; rotation = rotation % 360; rotation = rotation < 0 ? rotation + 360 : rotation; switch (rotation) { case 180: rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; break; case 90: rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; break; case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } if (dontFlip) { rotateC = -rotateC; rotateD = -rotateD; } var offsetCanvasX, offsetCanvasY; var width, height; if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; height = Math.abs(viewBox[2] - viewBox[0]) * scale; } else { offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; width = Math.abs(viewBox[2] - viewBox[0]) * scale; height = Math.abs(viewBox[3] - viewBox[1]) * scale; } this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; this.width = width; this.height = height; this.fontScale = scale; }
n/a
function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; }
n/a
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
n/a
function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; }
n/a
function Util() {}
n/a
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; }
...
this.graphicsReadyCallback();
}
},
cancel: function InternalRenderTask_cancel() {
this.running = false;
this.cancelled = true;
if ((0, _dom_utils.getDefaultSetting)('pdfjsNext')) {
this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled
, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {
if (!this.graphicsReady) {
if (!this.graphicsReadyCallback) {
...
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function addLinkAttributes(link, params) { var url = params && params.url; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; if (url) { var target = params.target; if (typeof target === 'undefined') { target = getDefaultSetting('externalLinkTarget'); } link.target = LinkTargetStringMap[target]; var rel = params.rel; if (typeof rel === 'undefined') { rel = getDefaultSetting('externalLinkRel'); } link.rel = rel; } }
n/a
function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } throw new Error('The "Blob" constructor is not supported.'); }
n/a
function createObjectURL(data, contentType) { var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!forceDataSchema) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); } var buffer = 'data:' + contentType + ';base64,'; for (var i = 0, ii = data.length; i < ii; i += 3) { var b1 = data[i] & 0xFF; var b2 = data[i + 1] & 0xFF; var b3 = data[i + 2] & 0xFF; var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; var d4 = i + 2 < ii ? b3 & 0x3F : 64; buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; } return buffer; }
...
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType) {
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!forceDataSchema) {
var blob = createBlob(data, contentType);
return URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
for (var i = 0, ii = data.length; i < ii; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2,
...
function createPromiseCapability() { var capability = {}; capability.promise = new Promise(function (resolve, reject) { capability.resolve = resolve; capability.reject = reject; }); return capability; }
n/a
function createValidAbsoluteUrl(url, baseUrl) { if (!url) { return null; } try { var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); if (isValidProtocol(absoluteUrl)) { return absoluteUrl; } } catch (ex) {} return null; }
n/a
function getDocument(src, pdfDataRangeTransport, passwordCallback, progressCallback) { var task = new PDFDocumentLoadingTask(); if (arguments.length > 1) { (0, _util.deprecated)('getDocument is called with pdfDataRangeTransport, ' + 'passwordCallback or progressCallback argument'); } if (pdfDataRangeTransport) { if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { pdfDataRangeTransport = Object.create(pdfDataRangeTransport); pdfDataRangeTransport.length = src.length; pdfDataRangeTransport.initialData = src.initialData; if (!pdfDataRangeTransport.abort) { pdfDataRangeTransport.abort = function () {}; } } src = Object.create(src); src.range = pdfDataRangeTransport; } task.onPassword = passwordCallback || null; task.onProgress = progressCallback || null; var source; if (typeof src === 'string') { source = { url: src }; } else if ((0, _util.isArrayBuffer)(src)) { source = { data: src }; } else if (src instanceof PDFDataRangeTransport) { source = { range: src }; } else { if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { (0, _util.error)('Invalid parameter in getDocument, need either Uint8Array, ' + 'string or a parameter object'); } if (!src.url && !src.data && !src.range) { (0, _util.error)('Invalid parameter object: need either .data, .range or .url'); } source = src; } var params = {}; var rangeTransport = null; var worker = null; for (var key in source) { if (key === 'url' && typeof window !== 'undefined') { params[key] = new URL(source[key], window.location).href; continue; } else if (key === 'range') { rangeTransport = source[key]; continue; } else if (key === 'worker') { worker = source[key]; continue; } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; if (typeof pdfBytes === 'string') { params[key] = (0, _util.stringToBytes)(pdfBytes); } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN (pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { (0, _util.error)('Invalid PDF binary data: either typed array, string or ' + 'array-like object is expected in the data property.'); } continue; } params[key] = source[key]; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.disableNativeImageDecoder = params.disableNativeImageDecoder === true; params.ignoreErrors = params.stopAtErrors !== true; var CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; if (!worker) { var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); worker = workerPort ? new PDFWorker(null, workerPort) : new PDFWorker(); task._worker = worker; } var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { throw new Error('Loading aborted'); } return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { if (task.destroyed) { throw new Error('Loading aborted'); } var messageHandler = new _util.MessageHandler(docId, workerId, worker.port); var transport = new WorkerTransport(messageHandler, task, rangeTransport, CMapReaderFactory); task._transport = transport; messageHandler.send('Ready', null); }); }).catch(task._capability.reject); return task; }
n/a
function getFilenameFromUrl(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?'); var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); return url.substring(url.lastIndexOf('/', end) + 1, end); }
n/a
function isValidUrl(url, allowRelative) { (0, _util.deprecated)('isValidUrl(), please use createValidAbsoluteUrl() instead.'); var baseUrl = allowRelative ? 'http://example.com' : null; return (0, _util.createValidAbsoluteUrl)(url, baseUrl) !== null; }
n/a
function removeNullCharacters(str) { if (typeof str !== 'string') { warn('The argument for removeNullCharacters must be a string.'); return str; } return str.replace(NullCharactersRegExp, ''); }
n/a
function renderTextLayer(renderParameters) { var task = new TextLayerRenderTask(renderParameters.textContent, renderParameters.container, renderParameters.viewport, renderParameters .textDivs, renderParameters.enhanceTextSelection); task._render(renderParameters.timeout); return task; }
n/a
function shadow(obj, prop, value) { Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); return value; }
n/a
function AnnotationLayer_render(parameters) { var annotationElementFactory = new AnnotationElementFactory(); for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; if (!data) { continue; } var element = annotationElementFactory.create({ data: data, layer: parameters.div, page: parameters.page, viewport: parameters.viewport, linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'), renderInteractiveForms: parameters.renderInteractiveForms || false }); if (element.isRenderable) { parameters.div.appendChild(element.render()); } } }
...
container: container,
trigger: trigger,
color: data.color,
title: data.title,
contents: data.contents,
hideWrapper: true
});
var popup = popupElement.render();
popup.style.left = container.style.width;
container.appendChild(popup);
},
render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called');
}
};
...
function AnnotationLayer_update(parameters) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]'); if (element) { _dom_utils.CustomStyle.setProp('transform', element, 'matrix(' + parameters.viewport.transform.join(',') + ')'); } } parameters.div.removeAttribute('hidden'); }
...
composite = true;
}
var descriptor = dict.get('FontDescriptor');
if (descriptor) {
var hash = new MurmurHash3_64();
var encoding = baseDict.getRaw('Encoding');
if (isName(encoding)) {
hash.update(encoding.name);
} else if (isRef(encoding)) {
hash.update(encoding.toString());
} else if (isDict(encoding)) {
var keys = encoding.getKeys();
for (var i = 0, ii = keys.length; i < ii; i++) {
var entry = encoding.getRaw(keys[i]);
if (isName(entry)) {
...
function CustomStyle() {}
n/a
function get(propName, element) { if (arguments.length === 1 && typeof _cache[propName] === 'string') { return _cache[propName]; } element = element || document.documentElement; var style = element.style, prefixed, uPropName; if (typeof style[propName] === 'string') { return _cache[propName] = propName; } uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); for (var i = 0, l = prefixes.length; i < l; i++) { prefixed = prefixes[i] + uPropName; if (typeof style[prefixed] === 'string') { return _cache[propName] = prefixed; } } return _cache[propName] = 'undefined'; }
...
if (typeof style[prefixed] === 'string') {
return _cache[propName] = prefixed;
}
}
return _cache[propName] = 'undefined';
};
CustomStyle.setProp = function set(propName, element, str) {
var prop = this.getProp(propName);
if (prop !== 'undefined') {
element.style[prop] = str;
}
};
return CustomStyle;
}();
var RenderingCancelledException = function RenderingCancelledException() {
...
function set(propName, element, str) { var prop = this.getProp(propName); if (prop !== 'undefined') { element.style[prop] = str; } }
...
page = this.page,
viewport = this.viewport;
var container = document.createElement('section');
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
container.setAttribute('data-annotation-id', data.id);
var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data
.rect[3] + page.view[1]]);
_dom_utils.CustomStyle.setProp('transform', container, 'matrix(' +
viewport.transform.join(',') + ')');
_dom_utils.CustomStyle.setProp('transformOrigin', container, -rect[0] + 'px ' + -rect[1] + 'px');
if (!ignoreBorder && data.borderStyle.width > 0) {
container.style.borderWidth = data.borderStyle.width + 'px';
if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width;
}
...
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFDataRangeTransport_abort() {}
...
this.pagePromises = [];
var self = this;
var terminated = this.messageHandler.sendWithPromise('Terminate', null);
waitOn.push(terminated);
Promise.all(waitOn).then(function () {
self.fontLoader.clear();
if (self.pdfDataRangeTransport) {
self.pdfDataRangeTransport.abort();
self.pdfDataRangeTransport = null;
}
if (self.messageHandler) {
self.messageHandler.destroy();
self.messageHandler = null;
}
self.destroyCapability.resolve();
...
function PDFDataRangeTransport_addProgressListener(listener) { this._progressListeners.push(listener); }
...
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
messageHandler.send('OnDataRange', {
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
...
function PDFDataRangeTransport_addProgressiveReadListener(listener) { this._progressiveReadListeners.push(listener); }
...
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
}, this);
}
messageHandler.on('GetDoc', function transportDoc(data) {
...
function PDFDataRangeTransport_addRangeListener(listener) { this._rangeListeners.push(listener); }
...
return this.destroyCapability.promise;
},
setupMessageHandler: function WorkerTransport_setupMessageHandler() {
var messageHandler = this.messageHandler;
var loadingTask = this.loadingTask;
var pdfDataRangeTransport = this.pdfDataRangeTransport;
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
messageHandler.send('OnDataRange', {
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
...
function PDFDataRangeTransport_onDataProgress(loaded) { this._readyCapability.promise.then(function () { var listeners = this._progressListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](loaded); } }.bind(this)); }
n/a
function PDFDataRangeTransport_onDataProgress(chunk) { this._readyCapability.promise.then(function () { var listeners = this._progressiveReadListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](chunk); } }.bind(this)); }
n/a
function PDFDataRangeTransport_onDataRange(begin, chunk) { var listeners = this._rangeListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](begin, chunk); } }
n/a
function PDFDataRangeTransport_requestDataRange(begin, end) { throw new Error('Abstract method PDFDataRangeTransport.requestDataRange'); }
...
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
}, this);
}
messageHandler.on('GetDoc', function transportDoc(data) {
var pdfInfo = data.pdfInfo;
this.numPages = data.pdfInfo.numPages;
var loadingTask = this.loadingTask;
var pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask);
...
function PDFDataRangeTransport_transportReady() { this._readyCapability.resolve(); }
...
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
messageHandler.on('PDFManagerReady', function transportPage(data) {
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.transportReady();
}
}, this);
messageHandler.on('StartRenderPage', function transportRender(data) {
if (this.destroyed) {
return;
}
var page = this.pageCache[data.pageIndex];
...
function CustomStyle() {}
n/a
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function Metadata(meta) { if (typeof meta === 'string') { meta = fixMetadata(meta); var parser = new DOMParser(); meta = parser.parseFromString(meta, 'application/xml'); } else if (!(meta instanceof Document)) { (0, _util.error)('Metadata: Invalid metadata object'); } this.metaDocument = meta; this.metadata = Object.create(null); this.parse(); }
...
getOutline: function WorkerTransport_getOutline() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
};
});
},
getStats: function WorkerTransport_getStats() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { this.viewBox = viewBox; this.scale = scale; this.rotation = rotation; this.offsetX = offsetX; this.offsetY = offsetY; var centerX = (viewBox[2] + viewBox[0]) / 2; var centerY = (viewBox[3] + viewBox[1]) / 2; var rotateA, rotateB, rotateC, rotateD; rotation = rotation % 360; rotation = rotation < 0 ? rotation + 360 : rotation; switch (rotation) { case 180: rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; break; case 90: rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; break; case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } if (dontFlip) { rotateC = -rotateC; rotateD = -rotateD; } var offsetCanvasX, offsetCanvasY; var width, height; if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; height = Math.abs(viewBox[2] - viewBox[0]) * scale; } else { offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; width = Math.abs(viewBox[2] - viewBox[0]) * scale; height = Math.abs(viewBox[3] - viewBox[1]) * scale; } this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; this.width = width; this.height = height; this.fontScale = scale; }
...
get view() {
return this.pageInfo.view;
},
getViewport: function PDFPageProxy_getViewport(scale, rotate) {
if (arguments.length < 2) {
rotate = this.rotate;
}
return new _util.PageViewport(this.view, scale, rotate, 0, 0);
},
getAnnotations: function PDFPageProxy_getAnnotations(params) {
var intent = params && params.intent || null;
if (!this.annotationsPromise || this.annotationsIntent !== intent) {
this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent);
this.annotationsIntent = intent;
}
...
function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; }
...
this._passwordCapability = (0, _util.createPromiseCapability)();
if (loadingTask.onPassword) {
var updatePassword = function (password) {
this._passwordCapability.resolve({ password: password });
}.bind(this);
loadingTask.onPassword(updatePassword, exception.code);
} else {
this._passwordCapability.reject(new _util.PasswordException(exception.message, exception
.code));
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
...
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; }
...
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message
, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
messageHandler.on('PDFManagerReady', function transportPage(data) {
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.transportReady();
...
function Util() {}
n/a
function addLinkAttributes(link, params) { var url = params && params.url; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; if (url) { var target = params.target; if (typeof target === 'undefined') { target = getDefaultSetting('externalLinkTarget'); } link.target = LinkTargetStringMap[target]; var rel = params.rel; if (typeof rel === 'undefined') { rel = getDefaultSetting('externalLinkRel'); } link.rel = rel; } }
n/a
function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } throw new Error('The "Blob" constructor is not supported.'); }
n/a
function PDFJS_createObjectURL(data, contentType) { return (0, _util.createObjectURL)(data, contentType, PDFJS.disableCreateObjectURL); }
...
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType) {
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!forceDataSchema) {
var blob = createBlob(data, contentType);
return URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
for (var i = 0, ii = data.length; i < ii; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2,
...
function createPromiseCapability() { var capability = {}; capability.promise = new Promise(function (resolve, reject) { capability.resolve = resolve; capability.reject = reject; }); return capability; }
n/a
function getDocument(src, pdfDataRangeTransport, passwordCallback, progressCallback) { var task = new PDFDocumentLoadingTask(); if (arguments.length > 1) { (0, _util.deprecated)('getDocument is called with pdfDataRangeTransport, ' + 'passwordCallback or progressCallback argument'); } if (pdfDataRangeTransport) { if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { pdfDataRangeTransport = Object.create(pdfDataRangeTransport); pdfDataRangeTransport.length = src.length; pdfDataRangeTransport.initialData = src.initialData; if (!pdfDataRangeTransport.abort) { pdfDataRangeTransport.abort = function () {}; } } src = Object.create(src); src.range = pdfDataRangeTransport; } task.onPassword = passwordCallback || null; task.onProgress = progressCallback || null; var source; if (typeof src === 'string') { source = { url: src }; } else if ((0, _util.isArrayBuffer)(src)) { source = { data: src }; } else if (src instanceof PDFDataRangeTransport) { source = { range: src }; } else { if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { (0, _util.error)('Invalid parameter in getDocument, need either Uint8Array, ' + 'string or a parameter object'); } if (!src.url && !src.data && !src.range) { (0, _util.error)('Invalid parameter object: need either .data, .range or .url'); } source = src; } var params = {}; var rangeTransport = null; var worker = null; for (var key in source) { if (key === 'url' && typeof window !== 'undefined') { params[key] = new URL(source[key], window.location).href; continue; } else if (key === 'range') { rangeTransport = source[key]; continue; } else if (key === 'worker') { worker = source[key]; continue; } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; if (typeof pdfBytes === 'string') { params[key] = (0, _util.stringToBytes)(pdfBytes); } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN (pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { (0, _util.error)('Invalid PDF binary data: either typed array, string or ' + 'array-like object is expected in the data property.'); } continue; } params[key] = source[key]; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.disableNativeImageDecoder = params.disableNativeImageDecoder === true; params.ignoreErrors = params.stopAtErrors !== true; var CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; if (!worker) { var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); worker = workerPort ? new PDFWorker(null, workerPort) : new PDFWorker(); task._worker = worker; } var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { throw new Error('Loading aborted'); } return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { if (task.destroyed) { throw new Error('Loading aborted'); } var messageHandler = new _util.MessageHandler(docId, workerId, worker.port); var transport = new WorkerTransport(messageHandler, task, rangeTransport, CMapReaderFactory); task._transport = transport; messageHandler.send('Ready', null); }); }).catch(task._capability.reject); return task; }
n/a
function getFilenameFromUrl(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?'); var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); return url.substring(url.lastIndexOf('/', end) + 1, end); }
n/a
function isExternalLinkTargetSet() { var externalLinkTarget = getDefaultSetting('externalLinkTarget'); switch (externalLinkTarget) { case LinkTarget.NONE: return false; case LinkTarget.SELF: case LinkTarget.BLANK: case LinkTarget.PARENT: case LinkTarget.TOP: return true; } }
n/a
function isValidUrl(url, allowRelative) { (0, _util.deprecated)('isValidUrl(), please use createValidAbsoluteUrl() instead.'); var baseUrl = allowRelative ? 'http://example.com' : null; return (0, _util.createValidAbsoluteUrl)(url, baseUrl) !== null; }
n/a
function removeNullCharacters(str) { if (typeof str !== 'string') { warn('The argument for removeNullCharacters must be a string.'); return str; } return str.replace(NullCharactersRegExp, ''); }
n/a
function renderTextLayer(renderParameters) { var task = new TextLayerRenderTask(renderParameters.textContent, renderParameters.container, renderParameters.viewport, renderParameters .textDivs, renderParameters.enhanceTextSelection); task._render(renderParameters.timeout); return task; }
n/a
function shadow(obj, prop, value) { Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); return value; }
n/a
function AnnotationLayer_render(parameters) { var annotationElementFactory = new AnnotationElementFactory(); for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; if (!data) { continue; } var element = annotationElementFactory.create({ data: data, layer: parameters.div, page: parameters.page, viewport: parameters.viewport, linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'), renderInteractiveForms: parameters.renderInteractiveForms || false }); if (element.isRenderable) { parameters.div.appendChild(element.render()); } } }
...
container: container,
trigger: trigger,
color: data.color,
title: data.title,
contents: data.contents,
hideWrapper: true
});
var popup = popupElement.render();
popup.style.left = container.style.width;
container.appendChild(popup);
},
render: function AnnotationElement_render() {
throw new Error('Abstract method AnnotationElement.render called');
}
};
...
function AnnotationLayer_update(parameters) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]'); if (element) { _dom_utils.CustomStyle.setProp('transform', element, 'matrix(' + parameters.viewport.transform.join(',') + ')'); } } parameters.div.removeAttribute('hidden'); }
...
composite = true;
}
var descriptor = dict.get('FontDescriptor');
if (descriptor) {
var hash = new MurmurHash3_64();
var encoding = baseDict.getRaw('Encoding');
if (isName(encoding)) {
hash.update(encoding.name);
} else if (isRef(encoding)) {
hash.update(encoding.toString());
} else if (isDict(encoding)) {
var keys = encoding.getKeys();
for (var i = 0, ii = keys.length; i < ii; i++) {
var entry = encoding.getRaw(keys[i]);
if (isName(entry)) {
...
function CustomStyle() {}
n/a
function get(propName, element) { if (arguments.length === 1 && typeof _cache[propName] === 'string') { return _cache[propName]; } element = element || document.documentElement; var style = element.style, prefixed, uPropName; if (typeof style[propName] === 'string') { return _cache[propName] = propName; } uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); for (var i = 0, l = prefixes.length; i < l; i++) { prefixed = prefixes[i] + uPropName; if (typeof style[prefixed] === 'string') { return _cache[propName] = prefixed; } } return _cache[propName] = 'undefined'; }
...
if (typeof style[prefixed] === 'string') {
return _cache[propName] = prefixed;
}
}
return _cache[propName] = 'undefined';
};
CustomStyle.setProp = function set(propName, element, str) {
var prop = this.getProp(propName);
if (prop !== 'undefined') {
element.style[prop] = str;
}
};
return CustomStyle;
}();
var RenderingCancelledException = function RenderingCancelledException() {
...
function set(propName, element, str) { var prop = this.getProp(propName); if (prop !== 'undefined') { element.style[prop] = str; } }
...
page = this.page,
viewport = this.viewport;
var container = document.createElement('section');
var width = data.rect[2] - data.rect[0];
var height = data.rect[3] - data.rect[1];
container.setAttribute('data-annotation-id', data.id);
var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data
.rect[3] + page.view[1]]);
_dom_utils.CustomStyle.setProp('transform', container, 'matrix(' +
viewport.transform.join(',') + ')');
_dom_utils.CustomStyle.setProp('transformOrigin', container, -rect[0] + 'px ' + -rect[1] + 'px');
if (!ignoreBorder && data.borderStyle.width > 0) {
container.style.borderWidth = data.borderStyle.width + 'px';
if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) {
width = width - 2 * data.borderStyle.width;
height = height - 2 * data.borderStyle.width;
}
...
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function Metadata(meta) { if (typeof meta === 'string') { meta = fixMetadata(meta); var parser = new DOMParser(); meta = parser.parseFromString(meta, 'application/xml'); } else if (!(meta instanceof Document)) { (0, _util.error)('Metadata: Invalid metadata object'); } this.metaDocument = meta; this.metadata = Object.create(null); this.parse(); }
...
getOutline: function WorkerTransport_getOutline() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
};
});
},
getStats: function WorkerTransport_getStats() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
...
function Metadata_get(name) { return this.metadata[name] || null; }
...
Util.extendObj = function extendObj(obj1, obj2) {
for (var key in obj2) {
obj1[key] = obj2[key];
}
};
Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
while (dict && !dict.has(name)) {
dict = dict.get('Parent');
}
if (!dict) {
return null;
}
return getArray ? dict.getArray(name) : dict.get(name);
};
Util.inherit = function Util_inherit(sub, base, prototype) {
...
function Metadata_has(name) { return typeof this.metadata[name] !== 'undefined'; }
...
};
Util.extendObj = function extendObj(obj1, obj2) {
for (var key in obj2) {
obj1[key] = obj2[key];
}
};
Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) {
while (dict && !dict.has(name)) {
dict = dict.get('Parent');
}
if (!dict) {
return null;
}
return getArray ? dict.getArray(name) : dict.get(name);
};
...
function Metadata_parse() { var doc = this.metaDocument; var rdf = doc.documentElement; if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { rdf = rdf.firstChild; while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') { rdf = rdf.nextSibling; } } var nodeName = rdf ? rdf.nodeName.toLowerCase() : null; if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) { return; } var children = rdf.childNodes, desc, entry, name, i, ii, length, iLength; for (i = 0, length = children.length; i < length; i++) { desc = children[i]; if (desc.nodeName.toLowerCase() !== 'rdf:description') { continue; } for (ii = 0, iLength = desc.childNodes.length; ii < iLength; ii++) { if (desc.childNodes[ii].nodeName.toLowerCase() !== '#text') { entry = desc.childNodes[ii]; name = entry.nodeName.toLowerCase(); this.metadata[name] = entry.textContent.trim(); } } } }
...
}
if (isDict(this.params)) {
var colorTransform = this.params.get('ColorTransform');
if (isInt(colorTransform)) {
jpegImage.colorTransform = colorTransform;
}
}
jpegImage.parse(this.bytes);
var data = jpegImage.getData(this.drawWidth, this.drawHeight, this.forceRGB);
this.buffer = data;
this.bufferLength = data.length;
this.eof = true;
};
JpegStream.prototype.getBytes = function JpegStream_getBytes(length) {
this.ensureBuffer();
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFDataRangeTransport_abort() {}
...
this.pagePromises = [];
var self = this;
var terminated = this.messageHandler.sendWithPromise('Terminate', null);
waitOn.push(terminated);
Promise.all(waitOn).then(function () {
self.fontLoader.clear();
if (self.pdfDataRangeTransport) {
self.pdfDataRangeTransport.abort();
self.pdfDataRangeTransport = null;
}
if (self.messageHandler) {
self.messageHandler.destroy();
self.messageHandler = null;
}
self.destroyCapability.resolve();
...
function PDFDataRangeTransport_addProgressListener(listener) { this._progressListeners.push(listener); }
...
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
messageHandler.send('OnDataRange', {
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
...
function PDFDataRangeTransport_addProgressiveReadListener(listener) { this._progressiveReadListeners.push(listener); }
...
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
}, this);
}
messageHandler.on('GetDoc', function transportDoc(data) {
...
function PDFDataRangeTransport_addRangeListener(listener) { this._rangeListeners.push(listener); }
...
return this.destroyCapability.promise;
},
setupMessageHandler: function WorkerTransport_setupMessageHandler() {
var messageHandler = this.messageHandler;
var loadingTask = this.loadingTask;
var pdfDataRangeTransport = this.pdfDataRangeTransport;
if (pdfDataRangeTransport) {
pdfDataRangeTransport.addRangeListener(function (begin, chunk) {
messageHandler.send('OnDataRange', {
begin: begin,
chunk: chunk
});
});
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
...
function PDFDataRangeTransport_onDataProgress(loaded) { this._readyCapability.promise.then(function () { var listeners = this._progressListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](loaded); } }.bind(this)); }
n/a
function PDFDataRangeTransport_onDataProgress(chunk) { this._readyCapability.promise.then(function () { var listeners = this._progressiveReadListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](chunk); } }.bind(this)); }
n/a
function PDFDataRangeTransport_onDataRange(begin, chunk) { var listeners = this._rangeListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](begin, chunk); } }
n/a
function PDFDataRangeTransport_requestDataRange(begin, end) { throw new Error('Abstract method PDFDataRangeTransport.requestDataRange'); }
...
pdfDataRangeTransport.addProgressListener(function (loaded) {
messageHandler.send('OnDataProgress', { loaded: loaded });
});
pdfDataRangeTransport.addProgressiveReadListener(function (chunk) {
messageHandler.send('OnDataRange', { chunk: chunk });
});
messageHandler.on('RequestDataRange', function transportDataRange(data) {
pdfDataRangeTransport.requestDataRange(data.begin, data.end);
}, this);
}
messageHandler.on('GetDoc', function transportDoc(data) {
var pdfInfo = data.pdfInfo;
this.numPages = data.pdfInfo.numPages;
var loadingTask = this.loadingTask;
var pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask);
...
function PDFDataRangeTransport_transportReady() { this._readyCapability.resolve(); }
...
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
messageHandler.on('PDFManagerReady', function transportPage(data) {
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.transportReady();
}
}, this);
messageHandler.on('StartRenderPage', function transportRender(data) {
if (this.destroyed) {
return;
}
var page = this.pageCache[data.pageIndex];
...
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function PDFWorker_initialize() { if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker') && typeof Worker !== 'undefined') { var workerSrc = getWorkerSrc(); try { if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); } var worker = new Worker(workerSrc); var messageHandler = new _util.MessageHandler('main', 'worker', worker); var terminateEarly = function () { worker.removeEventListener('error', onWorkerError); messageHandler.destroy(); worker.terminate(); if (this.destroyed) { this._readyCapability.reject(new Error('Worker was destroyed')); } else { this._setupFakeWorker(); } }.bind(this); var onWorkerError = function (event) { if (!this._webWorker) { terminateEarly(); } }.bind(this); worker.addEventListener('error', onWorkerError); messageHandler.on('test', function PDFWorker_test(data) { worker.removeEventListener('error', onWorkerError); if (this.destroyed) { terminateEarly(); return; } var supportTypedArray = data && data.supportTypedArray; if (supportTypedArray) { this._messageHandler = messageHandler; this._port = worker; this._webWorker = worker; if (!data.supportTransfers) { isPostMessageTransfersDisabled = true; } this._readyCapability.resolve(); messageHandler.send('configure', { verbosity: (0, _util.getVerbosityLevel)() }); } else { this._setupFakeWorker(); messageHandler.destroy(); worker.terminate(); } }.bind(this)); messageHandler.on('console_log', function (data) { console.log.apply(console, data); }); messageHandler.on('console_error', function (data) { console.error.apply(console, data); }); messageHandler.on('ready', function (data) { worker.removeEventListener('error', onWorkerError); if (this.destroyed) { terminateEarly(); return; } try { sendTest(); } catch (e) { this._setupFakeWorker(); } }.bind(this)); var sendTest = function sendTest() { var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled; var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]); try { messageHandler.send('test', testObj, [testObj.buffer]); } catch (ex) { (0, _util.info)('Cannot use postMessage transfers'); testObj[0] = 0; messageHandler.send('test', testObj); } }; sendTest(); return; } catch (e) { (0, _util.info)('The worker has been disabled.'); } } this._setupFakeWorker(); }
...
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
},
get port() {
return this._port;
...
function PDFWorker_initializeFromPort(port) { this._port = port; this._messageHandler = new _util.MessageHandler('main', 'worker', port); this._messageHandler.on('ready', function () {}); this._readyCapability.resolve(); }
...
this.name = name;
this.destroyed = false;
this._readyCapability = (0, _util.createPromiseCapability)();
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
...
function PDFWorker_setupFakeWorker() { if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker')) { (0, _util.warn)('Setting up fake worker.'); isWorkerDisabled = true; } setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { if (this.destroyed) { this._readyCapability.reject(new Error('Worker was destroyed')); return; } var isTypedArraysPresent = Uint8Array !== Float32Array; var port = new FakeWorkerPort(isTypedArraysPresent); this._port = port; var id = 'fake' + nextFakeWorkerId++; var workerHandler = new _util.MessageHandler(id + '_worker', id, port); WorkerMessageHandler.setup(workerHandler, port); var messageHandler = new _util.MessageHandler(id, id + '_worker', port); this._messageHandler = messageHandler; this._readyCapability.resolve(); }.bind(this)); }
...
_initializeFromPort: function PDFWorker_initializeFromPort(port) {
this._port = port;
this._messageHandler = new _util.MessageHandler('main', 'worker', port);
this._messageHandler.on('ready', function () {});
this._readyCapability.resolve();
},
_initialize: function PDFWorker_initialize() {
this._setupFakeWorker();
},
_setupFakeWorker: function PDFWorker_setupFakeWorker() {
if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker')) {
(0, _util.warn)('Setting up fake worker.');
isWorkerDisabled = true;
}
setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
...
function PDFWorker_destroy() { this.destroyed = true; if (this._webWorker) { this._webWorker.terminate(); this._webWorker = null; } this._port = null; if (this._messageHandler) { this._messageHandler.destroy(); this._messageHandler = null; } }
...
}
PDFDocumentLoadingTask.prototype = {
get promise() {
return this._capability.promise;
},
destroy: function destroy() {
this.destroyed = true;
var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy
span>();
return transportDestroyed.then(function () {
this._transport = null;
if (this._worker) {
this._worker.destroy();
this._worker = null;
}
}.bind(this));
...
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { this.viewBox = viewBox; this.scale = scale; this.rotation = rotation; this.offsetX = offsetX; this.offsetY = offsetY; var centerX = (viewBox[2] + viewBox[0]) / 2; var centerY = (viewBox[3] + viewBox[1]) / 2; var rotateA, rotateB, rotateC, rotateD; rotation = rotation % 360; rotation = rotation < 0 ? rotation + 360 : rotation; switch (rotation) { case 180: rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; break; case 90: rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; break; case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } if (dontFlip) { rotateC = -rotateC; rotateD = -rotateD; } var offsetCanvasX, offsetCanvasY; var width, height; if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; height = Math.abs(viewBox[2] - viewBox[0]) * scale; } else { offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; width = Math.abs(viewBox[2] - viewBox[0]) * scale; height = Math.abs(viewBox[3] - viewBox[1]) * scale; } this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; this.width = width; this.height = height; this.fontScale = scale; }
...
get view() {
return this.pageInfo.view;
},
getViewport: function PDFPageProxy_getViewport(scale, rotate) {
if (arguments.length < 2) {
rotate = this.rotate;
}
return new _util.PageViewport(this.view, scale, rotate, 0, 0);
},
getAnnotations: function PDFPageProxy_getAnnotations(params) {
var intent = params && params.intent || null;
if (!this.annotationsPromise || this.annotationsIntent !== intent) {
this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent);
this.annotationsIntent = intent;
}
...
function PageViewPort_clone(args) { args = args || {}; var scale = 'scale' in args ? args.scale : this.scale; var rotation = 'rotation' in args ? args.rotation : this.rotation; return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip); }
...
var clipCount = 0;
var maskCount = 0;
SVGGraphics.prototype = {
save: function SVGGraphics_save() {
this.transformStack.push(this.transformMatrix);
var old = this.current;
this.extraStack.push(old);
this.current = old.clone();
},
restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
...
function PageViewport_convertToPdfPoint(x, y) { return Util.applyInverseTransform([x, y], this.transform); }
n/a
function PageViewport_convertToViewportPoint(x, y) { return Util.applyTransform([x, y], this.transform); }
n/a
function PageViewport_convertToViewportRectangle(rect) { var tl = Util.applyTransform([rect[0], rect[1]], this.transform); var br = Util.applyTransform([rect[2], rect[3]], this.transform); return [tl[0], tl[1], br[0], br[1]]; }
n/a
function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; }
...
this._passwordCapability = (0, _util.createPromiseCapability)();
if (loadingTask.onPassword) {
var updatePassword = function (password) {
this._passwordCapability.resolve({ password: password });
}.bind(this);
loadingTask.onPassword(updatePassword, exception.code);
} else {
this._passwordCapability.reject(new _util.PasswordException(exception.message, exception
.code));
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
...
function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function SVGGraphics_ensureClipGroup() { if (!this.current.clipGroup) { var clipGroup = document.createElementNS(NS, 'svg:g'); clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); this.svg.appendChild(clipGroup); this.current.clipGroup = clipGroup; } return this.current.clipGroup; }
...
return this.current.clipGroup;
},
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.activeClipUrl) {
this._ensureClipGroup().appendChild(this.tgrp);
} else {
this.svg.appendChild(this.tgrp);
}
}
return this.tgrp;
}
};
...
function SVGGraphics_ensureTransformGroup() { if (!this.tgrp) { this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); if (this.current.activeClipUrl) { this._ensureClipGroup().appendChild(this.tgrp); } else { this.svg.appendChild(this.tgrp); } } return this.tgrp; }
...
if (current.fillColor !== SVG_DEFAULTS.fillColor) {
current.tspan.setAttributeNS(null, 'fill', current.fillColor);
}
current.txtElement.setAttributeNS(null, 'transform', pm(current.textMatrix) + ' scale(1, -1)');
current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve');
current.txtElement.appendChild(current.tspan);
current.txtgrp.appendChild(current.txtElement);
this._ensureTransformGroup().appendChild(current.txtElement);
},
setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) {
this.setLeading(-y);
this.moveText(x, y);
},
addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
if (!this.cssStyle) {
...
function SVGGraphics_initialize(viewport) { var svg = document.createElementNS(NS, 'svg:svg'); svg.setAttributeNS(null, 'version', '1.1'); svg.setAttributeNS(null, 'width', viewport.width + 'px'); svg.setAttributeNS(null, 'height', viewport.height + 'px'); svg.setAttributeNS(null, 'preserveAspectRatio', 'none'); svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height); var definitions = document.createElementNS(NS, 'svg:defs'); svg.appendChild(definitions); this.defs = definitions; var rootGroup = document.createElementNS(NS, 'svg:g'); rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform)); svg.appendChild(rootGroup); this.svg = rootGroup; return svg; }
...
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
},
get port() {
return this._port;
...
function SVGGraphics_addFontStyle(fontObj) { if (!this.cssStyle) { this.cssStyle = document.createElementNS(NS, 'svg:style'); this.cssStyle.setAttributeNS(null, 'type', 'text/css'); this.defs.appendChild(this.cssStyle); } var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); this.cssStyle.textContent += '@font-face { font-family: "' + fontObj.loadedName + '";' + ' src: url(' + url + '); }\n'; }
...
},
setFont: function SVGGraphics_setFont(details) {
var current = this.current;
var fontObj = this.commonObjs.get(details[0]);
var size = details[1];
this.current.font = fontObj;
if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) {
this.addFontStyle(fontObj);
this.embeddedFonts[fontObj.loadedName] = fontObj;
}
current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal
';
var italic = fontObj.italic ? 'italic' : 'normal';
if (size < 0) {
size = -size;
...
function SVGGraphics_beginText() { this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; this.current.textMatrix = _util.IDENTITY_MATRIX; this.current.lineMatrix = _util.IDENTITY_MATRIX; this.current.tspan = document.createElementNS(NS, 'svg:tspan'); this.current.txtElement = document.createElementNS(NS, 'svg:text'); this.current.txtgrp = document.createElementNS(NS, 'svg:g'); this.current.xcoords = []; }
...
var opTreeLen = opTree.length;
for (var x = 0; x < opTreeLen; x++) {
var fn = opTree[x].fn;
var fnId = opTree[x].fnId;
var args = opTree[x].args;
switch (fnId | 0) {
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
...
function SVGGraphics_clip(type) { var current = this.current; var clipId = 'clippath' + clipCount; clipCount++; var clipPath = document.createElementNS(NS, 'svg:clipPath'); clipPath.setAttributeNS(null, 'id', clipId); clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); var clipElement = current.element.cloneNode(); if (type === 'evenodd') { clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); } else { clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); } clipPath.appendChild(clipElement); this.defs.appendChild(clipPath); if (current.activeClipUrl) { current.clipGroup = null; this.extraStack.forEach(function (prev) { prev.clipGroup = null; }); } current.activeClipUrl = 'url(#' + clipId + ')'; this.tgrp = null; }
...
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
...
function SVGGraphics_closeFillStroke() { this.closePath(); this.fillStroke(); }
...
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
...
function SVGGraphics_closePath() { var current = this.current; var d = current.path.getAttributeNS(null, 'd'); d += 'Z'; current.path.setAttributeNS(null, 'd', d); }
...
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
...
function SVGGraphics_closeStroke() { this.closePath(); this.stroke(); }
...
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
...
function SVGGraphics_constructPath(ops, args) { var current = this.current; var x = current.x, y = current.y; current.path = document.createElementNS(NS, 'svg:path'); var d = []; var opLength = ops.length; for (var i = 0, j = 0; i < opLength; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: x = args[j++]; y = args[j++]; var width = args[j++]; var height = args[j++]; var xw = x + width; var yh = y + height; d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); break; case _util.OPS.moveTo: x = args[j++]; y = args[j++]; d.push('M', pf(x), pf(y)); break; case _util.OPS.lineTo: x = args[j++]; y = args[j++]; d.push('L', pf(x), pf(y)); break; case _util.OPS.curveTo: x = args[j + 4]; y = args[j + 5]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); j += 6; break; case _util.OPS.curveTo2: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); j += 4; break; case _util.OPS.curveTo3: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); j += 4; break; case _util.OPS.closePath: d.push('Z'); break; } } current.path.setAttributeNS(null, 'd', d.join(' ')); current.path.setAttributeNS(null, 'stroke-miterlimit', pf(current.miterLimit)); current.path.setAttributeNS(null, 'stroke-linecap', current.lineCap); current.path.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); current.path.setAttributeNS(null, 'stroke-width', pf(current.lineWidth) + 'px'); current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); current.path.setAttributeNS(null, 'fill', 'none'); this._ensureTransformGroup().appendChild(current.path); current.element = current.path; current.setCurrentPoint(x, y); }
...
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
...
function SVGGraphics_convertOpList(operatorList) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var REVOPS = []; var opList = []; for (var op in _util.OPS) { REVOPS[_util.OPS[op]] = op; } for (var x = 0; x < fnArrayLen; x++) { var fnId = fnArray[x]; opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x] }); } return opListToTree(opList); }
...
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree);
return svgElement;
}.bind(this));
},
convertOpList: function SVGGraphics_convertOpList(operatorList) {
var argsArray = operatorList.argsArray;
var fnArray = operatorList.fnArray;
...
function SVGGraphics_endPath() {}
...
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
default:
(0, _util.warn)('Unimplemented operator ' + fn);
break;
...
function SVGGraphics_endText() {}
...
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
...
function SVGGraphics_eoFill() { var current = this.current; current.element.setAttributeNS(null, 'fill', current.fillColor); current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); }
...
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
...
function SVGGraphics_eoFillStroke() { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); this.fillStroke(); }
...
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
...
function SVGGraphics_executeOpTree(opTree) { var opTreeLen = opTree.length; for (var x = 0; x < opTreeLen; x++) { var fn = opTree[x].fn; var fnId = opTree[x].fnId; var args = opTree[x].args; switch (fnId | 0) { case _util.OPS.beginText: this.beginText(); break; case _util.OPS.setLeading: this.setLeading(args); break; case _util.OPS.setLeadingMoveText: this.setLeadingMoveText(args[0], args[1]); break; case _util.OPS.setFont: this.setFont(args); break; case _util.OPS.showText: this.showText(args[0]); break; case _util.OPS.showSpacedText: this.showText(args[0]); break; case _util.OPS.endText: this.endText(); break; case _util.OPS.moveText: this.moveText(args[0], args[1]); break; case _util.OPS.setCharSpacing: this.setCharSpacing(args[0]); break; case _util.OPS.setWordSpacing: this.setWordSpacing(args[0]); break; case _util.OPS.setHScale: this.setHScale(args[0]); break; case _util.OPS.setTextMatrix: this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.setLineWidth: this.setLineWidth(args[0]); break; case _util.OPS.setLineJoin: this.setLineJoin(args[0]); break; case _util.OPS.setLineCap: this.setLineCap(args[0]); break; case _util.OPS.setMiterLimit: this.setMiterLimit(args[0]); break; case _util.OPS.setFillRGBColor: this.setFillRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setStrokeRGBColor: this.setStrokeRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setDash: this.setDash(args[0], args[1]); break; case _util.OPS.setGState: this.setGState(args[0]); break; case _util.OPS.fill: this.fill(); break; case _util.OPS.eoFill: this.eoFill(); break; case _util.OPS.stroke: this.stroke(); break; case _util.OPS.fillStroke: this.fillStroke(); break; case _util.OPS.eoFillStroke: this.eoFillStroke(); break; case _util.OPS.clip: this.clip('nonzero'); break; case _util.OPS.eoClip: this.clip('evenodd'); break; case _util.OPS.paintSolidColorImageMask: this.paintSolidColorImageMask(); break; case _util.OPS.paintJpegXObject: this.paintJpegXObject(args[0], args[1], args[2]); break; case _util.OPS.paintImageXObject: this.paintImageXObject(args[0]); break; case _util.OPS.paintInlineImageXObject: this.paintInlineImageXObject(args[0]); break; case _util.OPS.paintImageMaskXObject: this.paintImageMaskXObject(args[0]); break; case _util.OPS.paintFormXObjectBegin: this.paintFormXObjectBegin(args[0], args[1]); break; case _util.OPS.paintFormXObjectEnd: this.paintFormXObjectEnd(); break; case _util.OPS.closePath: this.closePath(); break; case _util.OPS.closeStroke: this.closeStroke(); break; case _util.OPS.closeFillStroke: this.closeFillStroke(); break; case _util.OPS.nextLine: this.nextLine(); break; case _util.OPS.transform: this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.constructPath: this.constructPath(args[0], args[1]); break; case _util.OPS.endPath: this.endPath(); break; case 92: this.group(opTree[x].items); break; default: (0, _util.warn)('Unimplemented operator ' + fn); break; } } }
...
restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
var self = this;
...
function SVGGraphics_fill() { var current = this.current; current.element.setAttributeNS(null, 'fill', current.fillColor); }
...
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
...
function SVGGraphics_fillStroke() { this.stroke(); this.fill(); }
...
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
...
function SVGGraphics_getSVG(operatorList, viewport) { this.viewport = viewport; var svgElement = this._initialize(viewport); return this.loadDependencies(operatorList).then(function () { this.transformMatrix = _util.IDENTITY_MATRIX; var opTree = this.convertOpList(operatorList); this.executeOpTree(opTree); return svgElement; }.bind(this)); }
n/a
function SVGGraphics_group(items) { this.save(); this.executeOpTree(items); this.restore(); }
...
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
default:
(0, _util.warn)('Unimplemented operator ' + fn);
break;
}
}
},
...
function SVGGraphics_loadDependencies(operatorList) { var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var argsArray = operatorList.argsArray; var self = this; for (var i = 0; i < fnArrayLen; i++) { if (_util.OPS.dependency === fnArray[i]) { var deps = argsArray[i]; for (var n = 0, nn = deps.length; n < nn; n++) { var obj = deps[n]; var common = obj.substring(0, 2) === 'g_'; var promise; if (common) { promise = new Promise(function (resolve) { self.commonObjs.get(obj, resolve); }); } else { promise = new Promise(function (resolve) { self.objs.get(obj, resolve); }); } this.current.dependencies.push(promise); } } } return Promise.all(this.current.dependencies); }
...
var transformMatrix = [a, b, c, d, e, f];
this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree);
return svgElement;
}.bind(this));
},
convertOpList: function SVGGraphics_convertOpList(operatorList) {
...
function SVGGraphics_moveText(x, y) { var current = this.current; this.current.x = this.current.lineX += x; this.current.y = this.current.lineY += y; current.xcoords = []; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); }
...
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
...
function SVGGraphics_nextLine() { this.moveText(0, this.current.leading); }
...
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
...
function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { if ((0, _util.isArray)(matrix) && matrix.length === 6) { this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } if ((0, _util.isArray)(bbox) && bbox.length === 4) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; var cliprect = document.createElementNS(NS, 'svg:rect'); cliprect.setAttributeNS(null, 'x', bbox[0]); cliprect.setAttributeNS(null, 'y', bbox[1]); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); this.endPath(); } }
...
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
...
function SVGGraphics_paintFormXObjectEnd() {}
...
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
...
function SVGGraphics_paintImageMaskXObject(imgData) { var current = this.current; var width = imgData.width; var height = imgData.height; var fillColor = current.fillColor; current.maskId = 'mask' + maskCount++; var mask = document.createElementNS(NS, 'svg:mask'); mask.setAttributeNS(null, 'id', current.maskId); var rect = document.createElementNS(NS, 'svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', pf(width)); rect.setAttributeNS(null, 'height', pf(height)); rect.setAttributeNS(null, 'fill', fillColor); rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); this.defs.appendChild(mask); this._ensureTransformGroup().appendChild(rect); this.paintInlineImageXObject(imgData, mask); }
...
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
...
function SVGGraphics_paintImageXObject(objId) { var imgData = this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } this.paintInlineImageXObject(imgData); }
...
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
...
function SVGGraphics_paintInlineImageXObject(imgData, mask) { var width = imgData.width; var height = imgData.height; var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema); var cliprect = document.createElementNS(NS, 'svg:rect'); cliprect.setAttributeNS(null, 'x', '0'); cliprect.setAttributeNS(null, 'y', '0'); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); var imgEl = document.createElementNS(NS, 'svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-height)); imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / width) + ' ' + pf(-1 / height) + ')'); if (mask) { mask.appendChild(imgEl); } else { this._ensureTransformGroup().appendChild(imgEl); } }
...
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
...
function SVGGraphics_paintJpegXObject(objId, w, h) { var imgObj = this.objs.get(objId); var imgEl = document.createElementNS(NS, 'svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); imgEl.setAttributeNS(null, 'width', imgObj.width + 'px'); imgEl.setAttributeNS(null, 'height', imgObj.height + 'px'); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-h)); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); this._ensureTransformGroup().appendChild(imgEl); }
...
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
...
function SVGGraphics_paintSolidColorImageMask() { var current = this.current; var rect = document.createElementNS(NS, 'svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'height', '1px'); rect.setAttributeNS(null, 'fill', current.fillColor); this._ensureTransformGroup().appendChild(rect); }
...
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
...
function SVGGraphics_restore() { this.transformMatrix = this.transformStack.pop(); this.current = this.extraStack.pop(); this.tgrp = null; }
...
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
var self = this;
for (var i = 0; i < fnArrayLen; i++) {
...
function SVGGraphics_save() { this.transformStack.push(this.transformMatrix); var old = this.current; this.extraStack.push(old); this.current = old.clone(); }
...
},
restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
...
function SVGGraphics_setCharSpacing(charSpacing) { this.current.charSpacing = charSpacing; }
...
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
...
function SVGGraphics_setDash(dashArray, dashPhase) { this.current.dashArray = dashArray; this.current.dashPhase = dashPhase; }
...
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
...
function SVGGraphics_setFillRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.fillColor = color; this.current.tspan = document.createElementNS(NS, 'svg:tspan'); this.current.xcoords = []; }
...
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
...
function SVGGraphics_setFont(details) { var current = this.current; var fontObj = this.commonObjs.get(details[0]); var size = details[1]; this.current.font = fontObj; if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { this.addFontStyle(fontObj); this.embeddedFonts[fontObj.loadedName] = fontObj; } current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal'; var italic = fontObj.italic ? 'italic' : 'normal'; if (size < 0) { size = -size; current.fontDirection = -1; } else { current.fontDirection = 1; } current.fontSize = size; current.fontFamily = fontObj.loadedName; current.fontWeight = bold; current.fontStyle = italic; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.xcoords = []; }
...
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
...
function SVGGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; var key = state[0]; var value = state[1]; switch (key) { case 'LW': this.setLineWidth(value); break; case 'LC': this.setLineCap(value); break; case 'LJ': this.setLineJoin(value); break; case 'ML': this.setMiterLimit(value); break; case 'D': this.setDash(value[0], value[1]); break; case 'Font': this.setFont(value); break; default: (0, _util.warn)('Unimplemented graphic state ' + key); break; } } }
...
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
...
function SVGGraphics_setHScale(scale) { this.current.textHScale = scale / 100; }
...
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
...
function SVGGraphics_setLeading(leading) { this.current.leading = -leading; }
...
var fnId = opTree[x].fnId;
var args = opTree[x].args;
switch (fnId | 0) {
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
...
function SVGGraphics_setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); }
...
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
...
function SVGGraphics_setLineCap(style) { this.current.lineCap = LINE_CAP_STYLES[style]; }
...
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
...
function SVGGraphics_setLineJoin(style) { this.current.lineJoin = LINE_JOIN_STYLES[style]; }
...
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
...
function SVGGraphics_setLineWidth(width) { this.current.lineWidth = width; }
...
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
...
function SVGGraphics_setMiterLimit(limit) { this.current.miterLimit = limit; }
...
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
...
function SVGGraphics_setStrokeRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.strokeColor = color; }
...
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
...
function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { var current = this.current; this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; current.xcoords = []; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.txtElement = document.createElementNS(NS, 'svg:text'); current.txtElement.appendChild(current.tspan); }
...
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
...
function SVGGraphics_setTextRise(textRise) { this.current.textRise = textRise; }
n/a
function SVGGraphics_setWordSpacing(wordSpacing) { this.current.wordSpacing = wordSpacing; }
...
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
...
function SVGGraphics_showText(glyphs) { var current = this.current; var font = current.font; var fontSize = current.fontSize; if (fontSize === 0) { return; } var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; var fontDirection = current.fontDirection; var textHScale = current.textHScale * fontDirection; var glyphsLength = glyphs.length; var vertical = font.vertical; var widthAdvanceScale = fontSize * current.fontMatrix[0]; var x = 0, i; for (i = 0; i < glyphsLength; ++i) { var glyph = glyphs[i]; if (glyph === null) { x += fontDirection * wordSpacing; continue; } else if ((0, _util.isNum)(glyph)) { x += -glyph * fontSize * 0.001; continue; } current.xcoords.push(current.x + x * textHScale); var width = glyph.width; var character = glyph.fontChar; var charWidth = width * widthAdvanceScale + charSpacing * fontDirection; x += charWidth; current.tspan.textContent += character; } if (vertical) { current.y -= x * textHScale; } else { current.x += x * textHScale; } current.tspan.setAttributeNS(null, 'x', current.xcoords.map(pf).join(' ')); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); } if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight); } if (current.fillColor !== SVG_DEFAULTS.fillColor) { current.tspan.setAttributeNS(null, 'fill', current.fillColor); } current.txtElement.setAttributeNS(null, 'transform', pm(current.textMatrix) + ' scale(1, -1)'); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.appendChild(current.tspan); current.txtgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement); }
...
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
...
function SVGGraphics_stroke() { var current = this.current; current.element.setAttributeNS(null, 'stroke', current.strokeColor); current.element.setAttributeNS(null, 'fill', 'none'); }
...
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
...
function SVGGraphics_transform(a, b, c, d, e, f) { var transformMatrix = [a, b, c, d, e, f]; this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); this.tgrp = null; }
...
}
}
}
return Promise.all(this.current.dependencies);
},
transform: function SVGGraphics_transform(a, b, c, d, e, f) {
var transformMatrix = [a, b, c, d, e, f];
this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
...
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; }
...
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message
, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
messageHandler.on('PDFManagerReady', function transportPage(data) {
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.transportReady();
...
function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function listen(cb) { (0, _util.deprecated)('Global UnsupportedManager.listen is used: ' + ' use PDFDocumentLoadingTask.onUnsupportedFeature instead '); listeners.push(cb); }
n/a
function notify(featureId) { for (var i = 0, ii = listeners.length; i < ii; i++) { listeners[i](featureId); } }
...
return;
}
var featureId = data.featureId;
var loadingTask = this.loadingTask;
if (loadingTask.onUnsupportedFeature) {
loadingTask.onUnsupportedFeature(featureId);
}
_UnsupportedManager.notify(featureId);
}, this);
messageHandler.on('JpegDecode', function (data) {
if (this.destroyed) {
return Promise.reject(new Error('Worker was destroyed'));
}
if (typeof document === 'undefined') {
return Promise.reject(new Error('"document" is not defined.'));
...
function Util() {}
n/a
function Util_appendToArray(arr1, arr2) { Array.prototype.push.apply(arr1, arr2); }
...
this.bufferLength = newLength;
};
StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
var baseStreams = [];
for (var i = 0, ii = this.streams.length; i < ii; i++) {
var stream = this.streams[i];
if (stream.getBaseStreams) {
Util.appendToArray(baseStreams, stream.getBaseStreams());
}
}
return baseStreams;
};
return StreamsSequenceStream;
}();
var FlateStream = function FlateStreamClosure() {
...
function Util_apply3dTransform(m, v) { return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v [2]]; }
n/a
function Util_applyInverseTransform(p, m) { var d = m[0] * m[3] - m[1] * m[2]; var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; return [xt, yt]; }
...
},
convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) {
var tl = Util.applyTransform([rect[0], rect[1]], this.transform);
var br = Util.applyTransform([rect[2], rect[3]], this.transform);
return [tl[0], tl[1], br[0], br[1]];
},
convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) {
return Util.applyInverseTransform([x, y], this.transform);
}
};
return PageViewport;
}();
var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9
, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039
, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D
, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC];
function stringToPDFString(str) {
var i,
...
function Util_applyTransform(p, m) { var xt = p[0] * m[0] + p[1] * m[2] + m[4]; var yt = p[0] * m[1] + p[1] * m[3] + m[5]; return [xt, yt]; }
...
Util.applyInverseTransform = function Util_applyInverseTransform(p, m) {
var d = m[0] * m[3] - m[1] * m[2];
var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
return [xt, yt];
};
Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) {
var p1 = Util.applyTransform(r, m);
var p2 = Util.applyTransform(r.slice(2, 4), m);
var p3 = Util.applyTransform([r[0], r[3]], m);
var p4 = Util.applyTransform([r[2], r[1]], m);
return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math
.max(p1[1], p2[1], p3[1], p4[1])];
};
Util.inverseTransform = function Util_inverseTransform(m) {
var d = m[0] * m[3] - m[1] * m[2];
...
function extendObj(obj1, obj2) { for (var key in obj2) { obj1[key] = obj2[key]; } }
...
if (!xobjs) {
xobjs = resources.get('XObject') || Dict.empty;
}
var name = args[0].name;
if (xobjsCache.key === name) {
if (xobjsCache.texts) {
Util.appendToArray(textContent.items, xobjsCache.texts.items);
Util.extendObj(textContent.styles, xobjsCache.texts.styles);
}
break;
}
var xobj = xobjs.get(name);
if (!xobj) {
break;
}
...
function Util_getAxialAlignedBoundingBox(r, m) { var p1 = Util.applyTransform(r, m); var p2 = Util.applyTransform(r.slice(2, 4), m); var p3 = Util.applyTransform([r[0], r[3]], m); var p4 = Util.applyTransform([r[2], r[1]], m); return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math .max(p1[1], p2[1], p3[1], p4[1])]; }
...
angleSin = Math.sin(angle);
}
var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale;
var divHeight = fontHeight;
var m, b;
if (angle !== 0) {
m = [angleCos, angleSin, -angleSin, angleCos, left, top];
b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m);
} else {
b = [left, top, left + divWidth, top + divHeight];
}
task._bounds.push({
left: b[0],
top: b[1],
right: b[2],
...
function Util_getInheritableProperty(dict, name, getArray) { while (dict && !dict.has(name)) { dict = dict.get('Parent'); } if (!dict) { return null; } return getArray ? dict.getArray(name) : dict.get(name); }
...
};
switch (subtype) {
case 'Link':
return new LinkAnnotation(parameters);
case 'Text':
return new TextAnnotation(parameters);
case 'Widget':
var fieldType = Util.getInheritableProperty(dict, 'FT');
fieldType = isName(fieldType) ? fieldType.name : null;
switch (fieldType) {
case 'Tx':
return new TextWidgetAnnotation(parameters);
case 'Btn':
return new ButtonWidgetAnnotation(parameters);
case 'Ch':
...
function Util_inherit(sub, base, prototype) { sub.prototype = Object.create(base.prototype); sub.prototype.constructor = sub; for (var prop in prototype) { sub.prototype[prop] = prototype[prop]; } }
...
};
return AnnotationElement;
}();
var LinkAnnotationElement = function LinkAnnotationElementClosure() {
function LinkAnnotationElement(parameters) {
AnnotationElement.call(this, parameters, true);
}
_util.Util.inherit(LinkAnnotationElement, AnnotationElement, {
render: function LinkAnnotationElement_render() {
this.container.className = 'linkAnnotation';
var link = document.createElement('a');
(0, _dom_utils.addLinkAttributes)(link, {
url: this.data.url,
target: this.data.newWindow ? _dom_utils.LinkTarget.BLANK : undefined
});
...
function Util_intersect(rect1, rect2) { function compare(a, b) { return a - b; } var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare), result = []; rect1 = Util.normalizeRect(rect1); rect2 = Util.normalizeRect(rect2); if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { result[0] = orderedX[1]; result[2] = orderedX[2]; } else { return false; } if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { result[1] = orderedY[1]; result[3] = orderedY[2]; } else { return false; } return result; }
...
},
get view() {
var mediaBox = this.mediaBox,
cropBox = this.cropBox;
if (mediaBox === cropBox) {
return shadow(this, 'view', mediaBox);
}
var intersection = Util.intersect(cropBox, mediaBox);
return shadow(this, 'view', intersection || mediaBox);
},
get rotate() {
var rotate = this.getInheritedPageProp('Rotate') || 0;
if (rotate % 90 !== 0) {
rotate = 0;
} else if (rotate >= 360) {
...
function Util_inverseTransform(m) { var d = m[0] * m[3] - m[1] * m[2]; return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; }
n/a
function Util_loadScript(src, callback) { var script = document.createElement('script'); var loaded = false; script.setAttribute('src', src); if (callback) { script.onload = function () { if (!loaded) { callback(); } loaded = true; }; } document.getElementsByTagName('head')[0].appendChild(script); }
...
function setupFakeWorkerGlobal() {
var WorkerMessageHandler;
if (fakeWorkerFilesLoadedCapability) {
return fakeWorkerFilesLoadedCapability.promise;
}
fakeWorkerFilesLoadedCapability = (0, _util.createPromiseCapability)();
var loader = fakeWorkerFilesLoader || function (callback) {
_util.Util.loadScript(getWorkerSrc(), function () {
callback(window.pdfjsDistBuildPdfWorker.WorkerMessageHandler);
});
};
loader(fakeWorkerFilesLoadedCapability.resolve);
return fakeWorkerFilesLoadedCapability.promise;
}
function FakeWorkerPort(defer) {
...
function Util_makeCssRgb(r, g, b) { rgbBuf[1] = r; rgbBuf[3] = g; rgbBuf[5] = b; return rgbBuf.join(''); }
...
case _util.AnnotationBorderStyleType.UNDERLINE:
container.style.borderBottomStyle = 'solid';
break;
default:
break;
}
if (data.color) {
container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color
[1] | 0, data.color[2] | 0);
} else {
container.style.borderWidth = 0;
}
}
container.style.left = rect[0] + 'px';
container.style.top = rect[1] + 'px';
container.style.width = width + 'px';
...
function Util_normalizeRect(rect) { var r = rect.slice(0); if (rect[0] > rect[2]) { r[0] = rect[2]; r[2] = rect[0]; } if (rect[1] > rect[3]) { r[1] = rect[3]; r[3] = rect[1]; } return r; }
...
Util.intersect = function Util_intersect(rect1, rect2) {
function compare(a, b) {
return a - b;
}
var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare),
orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare),
result = [];
rect1 = Util.normalizeRect(rect1);
rect2 = Util.normalizeRect(rect2);
if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1
[0]) {
result[0] = orderedX[1];
result[2] = orderedX[2];
} else {
return false;
}
...
function Util_prependToArray(arr1, arr2) { Array.prototype.unshift.apply(arr1, arr2); }
n/a
function Util_sign(num) { return num < 0 ? -1 : 1; }
n/a
function Util_singularValueDecompose2dScale(m) { var transpose = [m[0], m[2], m[1], m[3]]; var a = m[0] * transpose[0] + m[1] * transpose[2]; var b = m[0] * transpose[1] + m[1] * transpose[3]; var c = m[2] * transpose[0] + m[3] * transpose[2]; var d = m[2] * transpose[1] + m[3] * transpose[3]; var first = (a + d) / 2; var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; var sx = first + second || 1; var sy = first - second || 1; return [Math.sqrt(sx), Math.sqrt(sy)]; }
...
error('getPattern type unknown: ' + shadingType);
}
var matrix = this.matrix;
if (matrix) {
p0 = Util.applyTransform(p0, matrix);
p1 = Util.applyTransform(p1, matrix);
if (shadingType === ShadingType.RADIAL) {
var scale = Util.singularValueDecompose2dScale(matrix);
r0 *= scale[0];
r1 *= scale[1];
}
}
return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
}
};
...
function Util_toRoman(number, lowerCase) { assert(isInt(number) && number > 0, 'The number should be a positive integer.'); var pos, romanBuf = []; while (number >= 1000) { number -= 1000; romanBuf.push('M'); } pos = number / 100 | 0; number %= 100; romanBuf.push(ROMAN_NUMBER_MAP[pos]); pos = number / 10 | 0; number %= 10; romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); var romanStr = romanBuf.join(''); return lowerCase ? romanStr.toLowerCase() : romanStr; }
...
}
switch (style) {
case 'D':
currentLabel = currentIndex;
break;
case 'R':
case 'r':
currentLabel = Util.toRoman(currentIndex, style === 'r');
break;
case 'A':
case 'a':
var LIMIT = 26;
var A_UPPER_CASE = 0x41,
A_LOWER_CASE = 0x61;
var baseCharCode = style === 'a' ? A_LOWER_CASE : A_UPPER_CASE;
...
function Util_transform(m1, m2) { return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2 [3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; }
...
}
}
}
return Promise.all(this.current.dependencies);
},
transform: function SVGGraphics_transform(a, b, c, d, e, f) {
var transformMatrix = [a, b, c, d, e, f];
this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
...
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function PDFWorker_initialize() { if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker') && typeof Worker !== 'undefined') { var workerSrc = getWorkerSrc(); try { if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); } var worker = new Worker(workerSrc); var messageHandler = new _util.MessageHandler('main', 'worker', worker); var terminateEarly = function () { worker.removeEventListener('error', onWorkerError); messageHandler.destroy(); worker.terminate(); if (this.destroyed) { this._readyCapability.reject(new Error('Worker was destroyed')); } else { this._setupFakeWorker(); } }.bind(this); var onWorkerError = function (event) { if (!this._webWorker) { terminateEarly(); } }.bind(this); worker.addEventListener('error', onWorkerError); messageHandler.on('test', function PDFWorker_test(data) { worker.removeEventListener('error', onWorkerError); if (this.destroyed) { terminateEarly(); return; } var supportTypedArray = data && data.supportTypedArray; if (supportTypedArray) { this._messageHandler = messageHandler; this._port = worker; this._webWorker = worker; if (!data.supportTransfers) { isPostMessageTransfersDisabled = true; } this._readyCapability.resolve(); messageHandler.send('configure', { verbosity: (0, _util.getVerbosityLevel)() }); } else { this._setupFakeWorker(); messageHandler.destroy(); worker.terminate(); } }.bind(this)); messageHandler.on('console_log', function (data) { console.log.apply(console, data); }); messageHandler.on('console_error', function (data) { console.error.apply(console, data); }); messageHandler.on('ready', function (data) { worker.removeEventListener('error', onWorkerError); if (this.destroyed) { terminateEarly(); return; } try { sendTest(); } catch (e) { this._setupFakeWorker(); } }.bind(this)); var sendTest = function sendTest() { var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled; var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]); try { messageHandler.send('test', testObj, [testObj.buffer]); } catch (ex) { (0, _util.info)('Cannot use postMessage transfers'); testObj[0] = 0; messageHandler.send('test', testObj); } }; sendTest(); return; } catch (e) { (0, _util.info)('The worker has been disabled.'); } } this._setupFakeWorker(); }
...
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
},
get port() {
return this._port;
...
function PDFWorker_initializeFromPort(port) { this._port = port; this._messageHandler = new _util.MessageHandler('main', 'worker', port); this._messageHandler.on('ready', function () {}); this._readyCapability.resolve(); }
...
this.name = name;
this.destroyed = false;
this._readyCapability = (0, _util.createPromiseCapability)();
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
...
function PDFWorker_setupFakeWorker() { if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker')) { (0, _util.warn)('Setting up fake worker.'); isWorkerDisabled = true; } setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { if (this.destroyed) { this._readyCapability.reject(new Error('Worker was destroyed')); return; } var isTypedArraysPresent = Uint8Array !== Float32Array; var port = new FakeWorkerPort(isTypedArraysPresent); this._port = port; var id = 'fake' + nextFakeWorkerId++; var workerHandler = new _util.MessageHandler(id + '_worker', id, port); WorkerMessageHandler.setup(workerHandler, port); var messageHandler = new _util.MessageHandler(id, id + '_worker', port); this._messageHandler = messageHandler; this._readyCapability.resolve(); }.bind(this)); }
...
_initializeFromPort: function PDFWorker_initializeFromPort(port) {
this._port = port;
this._messageHandler = new _util.MessageHandler('main', 'worker', port);
this._messageHandler.on('ready', function () {});
this._readyCapability.resolve();
},
_initialize: function PDFWorker_initialize() {
this._setupFakeWorker();
},
_setupFakeWorker: function PDFWorker_setupFakeWorker() {
if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker')) {
(0, _util.warn)('Setting up fake worker.');
isWorkerDisabled = true;
}
setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
...
function PDFWorker_destroy() { this.destroyed = true; if (this._webWorker) { this._webWorker.terminate(); this._webWorker = null; } this._port = null; if (this._messageHandler) { this._messageHandler.destroy(); this._messageHandler = null; } }
...
}
PDFDocumentLoadingTask.prototype = {
get promise() {
return this._capability.promise;
},
destroy: function destroy() {
this.destroyed = true;
var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy
span>();
return transportDestroyed.then(function () {
this._transport = null;
if (this._worker) {
this._worker.destroy();
this._worker = null;
}
}.bind(this));
...
function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; }
...
this.graphicsReadyCallback();
}
},
cancel: function InternalRenderTask_cancel() {
this.running = false;
this.cancelled = true;
if ((0, _dom_utils.getDefaultSetting)('pdfjsNext')) {
this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled
, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {
if (!this.graphicsReady) {
if (!this.graphicsReadyCallback) {
...
function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function SVGGraphics_ensureClipGroup() { if (!this.current.clipGroup) { var clipGroup = document.createElementNS(NS, 'svg:g'); clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); this.svg.appendChild(clipGroup); this.current.clipGroup = clipGroup; } return this.current.clipGroup; }
...
return this.current.clipGroup;
},
_ensureTransformGroup: function SVGGraphics_ensureTransformGroup() {
if (!this.tgrp) {
this.tgrp = document.createElementNS(NS, 'svg:g');
this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix));
if (this.current.activeClipUrl) {
this._ensureClipGroup().appendChild(this.tgrp);
} else {
this.svg.appendChild(this.tgrp);
}
}
return this.tgrp;
}
};
...
function SVGGraphics_ensureTransformGroup() { if (!this.tgrp) { this.tgrp = document.createElementNS(NS, 'svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); if (this.current.activeClipUrl) { this._ensureClipGroup().appendChild(this.tgrp); } else { this.svg.appendChild(this.tgrp); } } return this.tgrp; }
...
if (current.fillColor !== SVG_DEFAULTS.fillColor) {
current.tspan.setAttributeNS(null, 'fill', current.fillColor);
}
current.txtElement.setAttributeNS(null, 'transform', pm(current.textMatrix) + ' scale(1, -1)');
current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve');
current.txtElement.appendChild(current.tspan);
current.txtgrp.appendChild(current.txtElement);
this._ensureTransformGroup().appendChild(current.txtElement);
},
setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) {
this.setLeading(-y);
this.moveText(x, y);
},
addFontStyle: function SVGGraphics_addFontStyle(fontObj) {
if (!this.cssStyle) {
...
function SVGGraphics_initialize(viewport) { var svg = document.createElementNS(NS, 'svg:svg'); svg.setAttributeNS(null, 'version', '1.1'); svg.setAttributeNS(null, 'width', viewport.width + 'px'); svg.setAttributeNS(null, 'height', viewport.height + 'px'); svg.setAttributeNS(null, 'preserveAspectRatio', 'none'); svg.setAttributeNS(null, 'viewBox', '0 0 ' + viewport.width + ' ' + viewport.height); var definitions = document.createElementNS(NS, 'svg:defs'); svg.appendChild(definitions); this.defs = definitions; var rootGroup = document.createElementNS(NS, 'svg:g'); rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform)); svg.appendChild(rootGroup); this.svg = rootGroup; return svg; }
...
this._port = null;
this._webWorker = null;
this._messageHandler = null;
if (port) {
this._initializeFromPort(port);
return;
}
this._initialize();
}
PDFWorker.prototype = {
get promise() {
return this._readyCapability.promise;
},
get port() {
return this._port;
...
function SVGGraphics_addFontStyle(fontObj) { if (!this.cssStyle) { this.cssStyle = document.createElementNS(NS, 'svg:style'); this.cssStyle.setAttributeNS(null, 'type', 'text/css'); this.defs.appendChild(this.cssStyle); } var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); this.cssStyle.textContent += '@font-face { font-family: "' + fontObj.loadedName + '";' + ' src: url(' + url + '); }\n'; }
...
},
setFont: function SVGGraphics_setFont(details) {
var current = this.current;
var fontObj = this.commonObjs.get(details[0]);
var size = details[1];
this.current.font = fontObj;
if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) {
this.addFontStyle(fontObj);
this.embeddedFonts[fontObj.loadedName] = fontObj;
}
current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX;
var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal
';
var italic = fontObj.italic ? 'italic' : 'normal';
if (size < 0) {
size = -size;
...
function SVGGraphics_beginText() { this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; this.current.textMatrix = _util.IDENTITY_MATRIX; this.current.lineMatrix = _util.IDENTITY_MATRIX; this.current.tspan = document.createElementNS(NS, 'svg:tspan'); this.current.txtElement = document.createElementNS(NS, 'svg:text'); this.current.txtgrp = document.createElementNS(NS, 'svg:g'); this.current.xcoords = []; }
...
var opTreeLen = opTree.length;
for (var x = 0; x < opTreeLen; x++) {
var fn = opTree[x].fn;
var fnId = opTree[x].fnId;
var args = opTree[x].args;
switch (fnId | 0) {
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
...
function SVGGraphics_clip(type) { var current = this.current; var clipId = 'clippath' + clipCount; clipCount++; var clipPath = document.createElementNS(NS, 'svg:clipPath'); clipPath.setAttributeNS(null, 'id', clipId); clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); var clipElement = current.element.cloneNode(); if (type === 'evenodd') { clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); } else { clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); } clipPath.appendChild(clipElement); this.defs.appendChild(clipPath); if (current.activeClipUrl) { current.clipGroup = null; this.extraStack.forEach(function (prev) { prev.clipGroup = null; }); } current.activeClipUrl = 'url(#' + clipId + ')'; this.tgrp = null; }
...
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
...
function SVGGraphics_closeFillStroke() { this.closePath(); this.fillStroke(); }
...
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
...
function SVGGraphics_closePath() { var current = this.current; var d = current.path.getAttributeNS(null, 'd'); d += 'Z'; current.path.setAttributeNS(null, 'd', d); }
...
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
...
function SVGGraphics_closeStroke() { this.closePath(); this.stroke(); }
...
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
...
function SVGGraphics_constructPath(ops, args) { var current = this.current; var x = current.x, y = current.y; current.path = document.createElementNS(NS, 'svg:path'); var d = []; var opLength = ops.length; for (var i = 0, j = 0; i < opLength; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: x = args[j++]; y = args[j++]; var width = args[j++]; var height = args[j++]; var xw = x + width; var yh = y + height; d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); break; case _util.OPS.moveTo: x = args[j++]; y = args[j++]; d.push('M', pf(x), pf(y)); break; case _util.OPS.lineTo: x = args[j++]; y = args[j++]; d.push('L', pf(x), pf(y)); break; case _util.OPS.curveTo: x = args[j + 4]; y = args[j + 5]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); j += 6; break; case _util.OPS.curveTo2: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); j += 4; break; case _util.OPS.curveTo3: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); j += 4; break; case _util.OPS.closePath: d.push('Z'); break; } } current.path.setAttributeNS(null, 'd', d.join(' ')); current.path.setAttributeNS(null, 'stroke-miterlimit', pf(current.miterLimit)); current.path.setAttributeNS(null, 'stroke-linecap', current.lineCap); current.path.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); current.path.setAttributeNS(null, 'stroke-width', pf(current.lineWidth) + 'px'); current.path.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); current.path.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); current.path.setAttributeNS(null, 'fill', 'none'); this._ensureTransformGroup().appendChild(current.path); current.element = current.path; current.setCurrentPoint(x, y); }
...
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
...
function SVGGraphics_convertOpList(operatorList) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var REVOPS = []; var opList = []; for (var op in _util.OPS) { REVOPS[_util.OPS[op]] = op; } for (var x = 0; x < fnArrayLen; x++) { var fnId = fnArray[x]; opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x] }); } return opListToTree(opList); }
...
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree);
return svgElement;
}.bind(this));
},
convertOpList: function SVGGraphics_convertOpList(operatorList) {
var argsArray = operatorList.argsArray;
var fnArray = operatorList.fnArray;
...
function SVGGraphics_endPath() {}
...
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
default:
(0, _util.warn)('Unimplemented operator ' + fn);
break;
...
function SVGGraphics_endText() {}
...
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
...
function SVGGraphics_eoFill() { var current = this.current; current.element.setAttributeNS(null, 'fill', current.fillColor); current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); }
...
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
...
function SVGGraphics_eoFillStroke() { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); this.fillStroke(); }
...
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
...
function SVGGraphics_executeOpTree(opTree) { var opTreeLen = opTree.length; for (var x = 0; x < opTreeLen; x++) { var fn = opTree[x].fn; var fnId = opTree[x].fnId; var args = opTree[x].args; switch (fnId | 0) { case _util.OPS.beginText: this.beginText(); break; case _util.OPS.setLeading: this.setLeading(args); break; case _util.OPS.setLeadingMoveText: this.setLeadingMoveText(args[0], args[1]); break; case _util.OPS.setFont: this.setFont(args); break; case _util.OPS.showText: this.showText(args[0]); break; case _util.OPS.showSpacedText: this.showText(args[0]); break; case _util.OPS.endText: this.endText(); break; case _util.OPS.moveText: this.moveText(args[0], args[1]); break; case _util.OPS.setCharSpacing: this.setCharSpacing(args[0]); break; case _util.OPS.setWordSpacing: this.setWordSpacing(args[0]); break; case _util.OPS.setHScale: this.setHScale(args[0]); break; case _util.OPS.setTextMatrix: this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.setLineWidth: this.setLineWidth(args[0]); break; case _util.OPS.setLineJoin: this.setLineJoin(args[0]); break; case _util.OPS.setLineCap: this.setLineCap(args[0]); break; case _util.OPS.setMiterLimit: this.setMiterLimit(args[0]); break; case _util.OPS.setFillRGBColor: this.setFillRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setStrokeRGBColor: this.setStrokeRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setDash: this.setDash(args[0], args[1]); break; case _util.OPS.setGState: this.setGState(args[0]); break; case _util.OPS.fill: this.fill(); break; case _util.OPS.eoFill: this.eoFill(); break; case _util.OPS.stroke: this.stroke(); break; case _util.OPS.fillStroke: this.fillStroke(); break; case _util.OPS.eoFillStroke: this.eoFillStroke(); break; case _util.OPS.clip: this.clip('nonzero'); break; case _util.OPS.eoClip: this.clip('evenodd'); break; case _util.OPS.paintSolidColorImageMask: this.paintSolidColorImageMask(); break; case _util.OPS.paintJpegXObject: this.paintJpegXObject(args[0], args[1], args[2]); break; case _util.OPS.paintImageXObject: this.paintImageXObject(args[0]); break; case _util.OPS.paintInlineImageXObject: this.paintInlineImageXObject(args[0]); break; case _util.OPS.paintImageMaskXObject: this.paintImageMaskXObject(args[0]); break; case _util.OPS.paintFormXObjectBegin: this.paintFormXObjectBegin(args[0], args[1]); break; case _util.OPS.paintFormXObjectEnd: this.paintFormXObjectEnd(); break; case _util.OPS.closePath: this.closePath(); break; case _util.OPS.closeStroke: this.closeStroke(); break; case _util.OPS.closeFillStroke: this.closeFillStroke(); break; case _util.OPS.nextLine: this.nextLine(); break; case _util.OPS.transform: this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.constructPath: this.constructPath(args[0], args[1]); break; case _util.OPS.endPath: this.endPath(); break; case 92: this.group(opTree[x].items); break; default: (0, _util.warn)('Unimplemented operator ' + fn); break; } } }
...
restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
var self = this;
...
function SVGGraphics_fill() { var current = this.current; current.element.setAttributeNS(null, 'fill', current.fillColor); }
...
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
...
function SVGGraphics_fillStroke() { this.stroke(); this.fill(); }
...
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
case _util.OPS.clip:
this.clip('nonzero');
break;
...
function SVGGraphics_getSVG(operatorList, viewport) { this.viewport = viewport; var svgElement = this._initialize(viewport); return this.loadDependencies(operatorList).then(function () { this.transformMatrix = _util.IDENTITY_MATRIX; var opTree = this.convertOpList(operatorList); this.executeOpTree(opTree); return svgElement; }.bind(this)); }
n/a
function SVGGraphics_group(items) { this.save(); this.executeOpTree(items); this.restore(); }
...
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
case _util.OPS.endPath:
this.endPath();
break;
case 92:
this.group(opTree[x].items);
break;
default:
(0, _util.warn)('Unimplemented operator ' + fn);
break;
}
}
},
...
function SVGGraphics_loadDependencies(operatorList) { var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var argsArray = operatorList.argsArray; var self = this; for (var i = 0; i < fnArrayLen; i++) { if (_util.OPS.dependency === fnArray[i]) { var deps = argsArray[i]; for (var n = 0, nn = deps.length; n < nn; n++) { var obj = deps[n]; var common = obj.substring(0, 2) === 'g_'; var promise; if (common) { promise = new Promise(function (resolve) { self.commonObjs.get(obj, resolve); }); } else { promise = new Promise(function (resolve) { self.objs.get(obj, resolve); }); } this.current.dependencies.push(promise); } } } return Promise.all(this.current.dependencies); }
...
var transformMatrix = [a, b, c, d, e, f];
this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
var opTree = this.convertOpList(operatorList);
this.executeOpTree(opTree);
return svgElement;
}.bind(this));
},
convertOpList: function SVGGraphics_convertOpList(operatorList) {
...
function SVGGraphics_moveText(x, y) { var current = this.current; this.current.x = this.current.lineX += x; this.current.y = this.current.lineY += y; current.xcoords = []; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); }
...
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
...
function SVGGraphics_nextLine() { this.moveText(0, this.current.leading); }
...
case _util.OPS.closeStroke:
this.closeStroke();
break;
case _util.OPS.closeFillStroke:
this.closeFillStroke();
break;
case _util.OPS.nextLine:
this.nextLine();
break;
case _util.OPS.transform:
this.transform(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.constructPath:
this.constructPath(args[0], args[1]);
break;
...
function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { if ((0, _util.isArray)(matrix) && matrix.length === 6) { this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } if ((0, _util.isArray)(bbox) && bbox.length === 4) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; var cliprect = document.createElementNS(NS, 'svg:rect'); cliprect.setAttributeNS(null, 'x', bbox[0]); cliprect.setAttributeNS(null, 'y', bbox[1]); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); this.endPath(); } }
...
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
...
function SVGGraphics_paintFormXObjectEnd() {}
...
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
case _util.OPS.closePath:
this.closePath();
break;
case _util.OPS.closeStroke:
this.closeStroke();
break;
...
function SVGGraphics_paintImageMaskXObject(imgData) { var current = this.current; var width = imgData.width; var height = imgData.height; var fillColor = current.fillColor; current.maskId = 'mask' + maskCount++; var mask = document.createElementNS(NS, 'svg:mask'); mask.setAttributeNS(null, 'id', current.maskId); var rect = document.createElementNS(NS, 'svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', pf(width)); rect.setAttributeNS(null, 'height', pf(height)); rect.setAttributeNS(null, 'fill', fillColor); rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); this.defs.appendChild(mask); this._ensureTransformGroup().appendChild(rect); this.paintInlineImageXObject(imgData, mask); }
...
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
case _util.OPS.paintFormXObjectEnd:
this.paintFormXObjectEnd();
break;
...
function SVGGraphics_paintImageXObject(objId) { var imgData = this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } this.paintInlineImageXObject(imgData); }
...
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
...
function SVGGraphics_paintInlineImageXObject(imgData, mask) { var width = imgData.width; var height = imgData.height; var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema); var cliprect = document.createElementNS(NS, 'svg:rect'); cliprect.setAttributeNS(null, 'x', '0'); cliprect.setAttributeNS(null, 'y', '0'); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); var imgEl = document.createElementNS(NS, 'svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-height)); imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / width) + ' ' + pf(-1 / height) + ')'); if (mask) { mask.appendChild(imgEl); } else { this._ensureTransformGroup().appendChild(imgEl); } }
...
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
case _util.OPS.paintImageMaskXObject:
this.paintImageMaskXObject(args[0]);
break;
case _util.OPS.paintFormXObjectBegin:
this.paintFormXObjectBegin(args[0], args[1]);
break;
...
function SVGGraphics_paintJpegXObject(objId, w, h) { var imgObj = this.objs.get(objId); var imgEl = document.createElementNS(NS, 'svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); imgEl.setAttributeNS(null, 'width', imgObj.width + 'px'); imgEl.setAttributeNS(null, 'height', imgObj.height + 'px'); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-h)); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); this._ensureTransformGroup().appendChild(imgEl); }
...
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
case _util.OPS.paintInlineImageXObject:
this.paintInlineImageXObject(args[0]);
break;
...
function SVGGraphics_paintSolidColorImageMask() { var current = this.current; var rect = document.createElementNS(NS, 'svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'height', '1px'); rect.setAttributeNS(null, 'fill', current.fillColor); this._ensureTransformGroup().appendChild(rect); }
...
case _util.OPS.clip:
this.clip('nonzero');
break;
case _util.OPS.eoClip:
this.clip('evenodd');
break;
case _util.OPS.paintSolidColorImageMask:
this.paintSolidColorImageMask();
break;
case _util.OPS.paintJpegXObject:
this.paintJpegXObject(args[0], args[1], args[2]);
break;
case _util.OPS.paintImageXObject:
this.paintImageXObject(args[0]);
break;
...
function SVGGraphics_restore() { this.transformMatrix = this.transformStack.pop(); this.current = this.extraStack.pop(); this.tgrp = null; }
...
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
var self = this;
for (var i = 0; i < fnArrayLen; i++) {
...
function SVGGraphics_save() { this.transformStack.push(this.transformMatrix); var old = this.current; this.extraStack.push(old); this.current = old.clone(); }
...
},
restore: function SVGGraphics_restore() {
this.transformMatrix = this.transformStack.pop();
this.current = this.extraStack.pop();
this.tgrp = null;
},
group: function SVGGraphics_group(items) {
this.save();
this.executeOpTree(items);
this.restore();
},
loadDependencies: function SVGGraphics_loadDependencies(operatorList) {
var fnArray = operatorList.fnArray;
var fnArrayLen = fnArray.length;
var argsArray = operatorList.argsArray;
...
function SVGGraphics_setCharSpacing(charSpacing) { this.current.charSpacing = charSpacing; }
...
case _util.OPS.endText:
this.endText();
break;
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
...
function SVGGraphics_setDash(dashArray, dashPhase) { this.current.dashArray = dashArray; this.current.dashPhase = dashPhase; }
...
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
...
function SVGGraphics_setFillRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.fillColor = color; this.current.tspan = document.createElementNS(NS, 'svg:tspan'); this.current.xcoords = []; }
...
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
...
function SVGGraphics_setFont(details) { var current = this.current; var fontObj = this.commonObjs.get(details[0]); var size = details[1]; this.current.font = fontObj; if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { this.addFontStyle(fontObj); this.embeddedFonts[fontObj.loadedName] = fontObj; } current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal'; var italic = fontObj.italic ? 'italic' : 'normal'; if (size < 0) { size = -size; current.fontDirection = -1; } else { current.fontDirection = 1; } current.fontSize = size; current.fontFamily = fontObj.loadedName; current.fontWeight = bold; current.fontStyle = italic; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.xcoords = []; }
...
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
...
function SVGGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; var key = state[0]; var value = state[1]; switch (key) { case 'LW': this.setLineWidth(value); break; case 'LC': this.setLineCap(value); break; case 'LJ': this.setLineJoin(value); break; case 'ML': this.setMiterLimit(value); break; case 'D': this.setDash(value[0], value[1]); break; case 'Font': this.setFont(value); break; default: (0, _util.warn)('Unimplemented graphic state ' + key); break; } } }
...
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
...
function SVGGraphics_setHScale(scale) { this.current.textHScale = scale / 100; }
...
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
...
function SVGGraphics_setLeading(leading) { this.current.leading = -leading; }
...
var fnId = opTree[x].fnId;
var args = opTree[x].args;
switch (fnId | 0) {
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
...
function SVGGraphics_setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); }
...
case _util.OPS.beginText:
this.beginText();
break;
case _util.OPS.setLeading:
this.setLeading(args);
break;
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
...
function SVGGraphics_setLineCap(style) { this.current.lineCap = LINE_CAP_STYLES[style]; }
...
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
...
function SVGGraphics_setLineJoin(style) { this.current.lineJoin = LINE_JOIN_STYLES[style]; }
...
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
...
function SVGGraphics_setLineWidth(width) { this.current.lineWidth = width; }
...
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
...
function SVGGraphics_setMiterLimit(limit) { this.current.miterLimit = limit; }
...
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
case _util.OPS.setLineCap:
this.setLineCap(args[0]);
break;
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
...
function SVGGraphics_setStrokeRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.strokeColor = color; }
...
case _util.OPS.setMiterLimit:
this.setMiterLimit(args[0]);
break;
case _util.OPS.setFillRGBColor:
this.setFillRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setStrokeRGBColor:
this.setStrokeRGBColor(args[0], args[1], args[2]);
break;
case _util.OPS.setDash:
this.setDash(args[0], args[1]);
break;
case _util.OPS.setGState:
this.setGState(args[0]);
break;
...
function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { var current = this.current; this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; current.xcoords = []; current.tspan = document.createElementNS(NS, 'svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.txtElement = document.createElementNS(NS, 'svg:text'); current.txtElement.appendChild(current.tspan); }
...
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
case _util.OPS.setLineWidth:
this.setLineWidth(args[0]);
break;
case _util.OPS.setLineJoin:
this.setLineJoin(args[0]);
break;
...
function SVGGraphics_setTextRise(textRise) { this.current.textRise = textRise; }
n/a
function SVGGraphics_setWordSpacing(wordSpacing) { this.current.wordSpacing = wordSpacing; }
...
case _util.OPS.moveText:
this.moveText(args[0], args[1]);
break;
case _util.OPS.setCharSpacing:
this.setCharSpacing(args[0]);
break;
case _util.OPS.setWordSpacing:
this.setWordSpacing(args[0]);
break;
case _util.OPS.setHScale:
this.setHScale(args[0]);
break;
case _util.OPS.setTextMatrix:
this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
break;
...
function SVGGraphics_showText(glyphs) { var current = this.current; var font = current.font; var fontSize = current.fontSize; if (fontSize === 0) { return; } var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; var fontDirection = current.fontDirection; var textHScale = current.textHScale * fontDirection; var glyphsLength = glyphs.length; var vertical = font.vertical; var widthAdvanceScale = fontSize * current.fontMatrix[0]; var x = 0, i; for (i = 0; i < glyphsLength; ++i) { var glyph = glyphs[i]; if (glyph === null) { x += fontDirection * wordSpacing; continue; } else if ((0, _util.isNum)(glyph)) { x += -glyph * fontSize * 0.001; continue; } current.xcoords.push(current.x + x * textHScale); var width = glyph.width; var character = glyph.fontChar; var charWidth = width * widthAdvanceScale + charSpacing * fontDirection; x += charWidth; current.tspan.textContent += character; } if (vertical) { current.y -= x * textHScale; } else { current.x += x * textHScale; } current.tspan.setAttributeNS(null, 'x', current.xcoords.map(pf).join(' ')); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); } if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight); } if (current.fillColor !== SVG_DEFAULTS.fillColor) { current.tspan.setAttributeNS(null, 'fill', current.fillColor); } current.txtElement.setAttributeNS(null, 'transform', pm(current.textMatrix) + ' scale(1, -1)'); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.appendChild(current.tspan); current.txtgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement); }
...
case _util.OPS.setLeadingMoveText:
this.setLeadingMoveText(args[0], args[1]);
break;
case _util.OPS.setFont:
this.setFont(args);
break;
case _util.OPS.showText:
this.showText(args[0]);
break;
case _util.OPS.showSpacedText:
this.showText(args[0]);
break;
case _util.OPS.endText:
this.endText();
break;
...
function SVGGraphics_stroke() { var current = this.current; current.element.setAttributeNS(null, 'stroke', current.strokeColor); current.element.setAttributeNS(null, 'fill', 'none'); }
...
case _util.OPS.fill:
this.fill();
break;
case _util.OPS.eoFill:
this.eoFill();
break;
case _util.OPS.stroke:
this.stroke();
break;
case _util.OPS.fillStroke:
this.fillStroke();
break;
case _util.OPS.eoFillStroke:
this.eoFillStroke();
break;
...
function SVGGraphics_transform(a, b, c, d, e, f) { var transformMatrix = [a, b, c, d, e, f]; this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); this.tgrp = null; }
...
}
}
}
return Promise.all(this.current.dependencies);
},
transform: function SVGGraphics_transform(a, b, c, d, e, f) {
var transformMatrix = [a, b, c, d, e, f];
this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix);
this.tgrp = null;
},
getSVG: function SVGGraphics_getSVG(operatorList, viewport) {
this.viewport = viewport;
var svgElement = this._initialize(viewport);
return this.loadDependencies(operatorList).then(function () {
this.transformMatrix = _util.IDENTITY_MATRIX;
...
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
...
function Annotation(params) { var dict = params.dict; this.setFlags(dict.get('F')); this.setRectangle(dict.getArray('Rect')); this.setColor(dict.getArray('C')); this.setBorderStyle(dict); this.setAppearance(dict); this.data = {}; this.data.id = params.id; this.data.subtype = params.subtype; this.data.annotationFlags = this.flags; this.data.rect = this.rectangle; this.data.color = this.color; this.data.borderStyle = this.borderStyle; this.data.hasAppearance = !!this.appearance; }
n/a
function AnnotationBorderStyle() { this.width = 1; this.style = AnnotationBorderStyleType.SOLID; this.dashArray = [3]; this.horizontalCornerRadius = 0; this.verticalCornerRadius = 0; }
n/a
function AnnotationFactory() {}
n/a
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFDocumentProxy(pdfInfo, transport, loadingTask) { this.pdfInfo = pdfInfo; this.transport = transport; this.loadingTask = loadingTask; }
n/a
function PDFPageProxy(pageIndex, pageInfo, transport) { this.pageIndex = pageIndex; this.pageInfo = pageInfo; this.transport = transport; this.stats = new _util.StatTimer(); this.stats.enabled = (0, _dom_utils.getDefaultSetting)('enableStats'); this.commonObjs = transport.commonObjs; this.objs = new PDFObjects(); this.cleanupAfterRender = false; this.pendingCleanup = false; this.intentStates = Object.create(null); this.destroyed = false; }
n/a
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function getDocument(src, pdfDataRangeTransport, passwordCallback, progressCallback) { var task = new PDFDocumentLoadingTask(); if (arguments.length > 1) { (0, _util.deprecated)('getDocument is called with pdfDataRangeTransport, ' + 'passwordCallback or progressCallback argument'); } if (pdfDataRangeTransport) { if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { pdfDataRangeTransport = Object.create(pdfDataRangeTransport); pdfDataRangeTransport.length = src.length; pdfDataRangeTransport.initialData = src.initialData; if (!pdfDataRangeTransport.abort) { pdfDataRangeTransport.abort = function () {}; } } src = Object.create(src); src.range = pdfDataRangeTransport; } task.onPassword = passwordCallback || null; task.onProgress = progressCallback || null; var source; if (typeof src === 'string') { source = { url: src }; } else if ((0, _util.isArrayBuffer)(src)) { source = { data: src }; } else if (src instanceof PDFDataRangeTransport) { source = { range: src }; } else { if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { (0, _util.error)('Invalid parameter in getDocument, need either Uint8Array, ' + 'string or a parameter object'); } if (!src.url && !src.data && !src.range) { (0, _util.error)('Invalid parameter object: need either .data, .range or .url'); } source = src; } var params = {}; var rangeTransport = null; var worker = null; for (var key in source) { if (key === 'url' && typeof window !== 'undefined') { params[key] = new URL(source[key], window.location).href; continue; } else if (key === 'range') { rangeTransport = source[key]; continue; } else if (key === 'worker') { worker = source[key]; continue; } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; if (typeof pdfBytes === 'string') { params[key] = (0, _util.stringToBytes)(pdfBytes); } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN (pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { (0, _util.error)('Invalid PDF binary data: either typed array, string or ' + 'array-like object is expected in the data property.'); } continue; } params[key] = source[key]; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.disableNativeImageDecoder = params.disableNativeImageDecoder === true; params.ignoreErrors = params.stopAtErrors !== true; var CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; if (!worker) { var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); worker = workerPort ? new PDFWorker(null, workerPort) : new PDFWorker(); task._worker = worker; } var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { throw new Error('Loading aborted'); } return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { if (task.destroyed) { throw new Error('Loading aborted'); } var messageHandler = new _util.MessageHandler(docId, workerId, worker.port); var transport = new WorkerTransport(messageHandler, task, rangeTransport, CMapReaderFactory); task._transport = transport; messageHandler.send('Ready', null); }); }).catch(task._capability.reject); return task; }
n/a
function ArithmeticDecoder(data, start, end) { this.data = data; this.bp = start; this.dataEnd = end; this.chigh = data[start]; this.clow = 0; this.byteIn(); this.chigh = this.chigh << 7 & 0xFFFF | this.clow >> 9 & 0x7F; this.clow = this.clow << 7 & 0xFFFF; this.ct -= 7; this.a = 0x8000; }
n/a
function bidi(str, startLevel, vertical) { var isLTR = true; var strLength = str.length; if (strLength === 0 || vertical) { return createBidiText(str, isLTR, vertical); } chars.length = strLength; types.length = strLength; var numBidi = 0; var i, ii; for (i = 0; i < strLength; ++i) { chars[i] = str.charAt(i); var charCode = str.charCodeAt(i); var charType = 'L'; if (charCode <= 0x00ff) { charType = baseTypes[charCode]; } else if (0x0590 <= charCode && charCode <= 0x05f4) { charType = 'R'; } else if (0x0600 <= charCode && charCode <= 0x06ff) { charType = arabicTypes[charCode & 0xff]; if (!charType) { warn('Bidi: invalid Unicode character ' + charCode.toString(16)); } } else if (0x0700 <= charCode && charCode <= 0x08AC) { charType = 'AL'; } if (charType === 'R' || charType === 'AL' || charType === 'AN') { numBidi++; } types[i] = charType; } if (numBidi === 0) { isLTR = true; return createBidiText(str, isLTR); } if (startLevel === -1) { if (numBidi / strLength < 0.3) { isLTR = true; startLevel = 0; } else { isLTR = false; startLevel = 1; } } var levels = []; for (i = 0; i < strLength; ++i) { levels[i] = startLevel; } var e = isOdd(startLevel) ? 'R' : 'L'; var sor = e; var eor = sor; var lastType = sor; for (i = 0; i < strLength; ++i) { if (types[i] === 'NSM') { types[i] = lastType; } else { lastType = types[i]; } } lastType = sor; var t; for (i = 0; i < strLength; ++i) { t = types[i]; if (t === 'EN') { types[i] = lastType === 'AL' ? 'AN' : 'EN'; } else if (t === 'R' || t === 'L' || t === 'AL') { lastType = t; } } for (i = 0; i < strLength; ++i) { t = types[i]; if (t === 'AL') { types[i] = 'R'; } } for (i = 1; i < strLength - 1; ++i) { if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') { types[i] = 'EN'; } if (types[i] === 'CS' && (types[i - 1] === 'EN' || types[i - 1] === 'AN') && types[i + 1] === types[i - 1]) { types[i] = types[i - 1]; } } for (i = 0; i < strLength; ++i) { if (types[i] === 'EN') { var j; for (j = i - 1; j >= 0; --j) { if (types[j] !== 'ET') { break; } types[j] = 'EN'; } for (j = i + 1; j < strLength; ++j) { if (types[j] !== 'ET') { break; } types[j] = 'EN'; } } } for (i = 0; i < strLength; ++i) { t = types[i]; if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') { types[i] = 'ON'; } } lastType = sor; for (i = 0; i < strLength; ++i) { t = types[i]; if (t === 'EN') { types[i] = lastType === 'L' ? 'L' : 'EN'; } else if (t === 'R' || t === 'L') { lastType = t; } } for (i = 0; i < strLength; ++i) { if (types[i] === 'ON') { var end = findUnequal(types, i + 1, 'ON'); var before = sor; if (i > 0) { before = types[i - 1]; } var after = eor; if (end + 1 < strLength) { after = types[end + 1]; } if (before !== 'L') { before = 'R'; } if (after !== 'L') { after = 'R'; } if (before === after) { setValues(types, i, end, before); } i = end - 1; } } for (i = 0; i < strLength; ++i) { if (types[i] === 'ON') { types[i] = e; } } for (i = 0; i < strLength; ++i) { t = types[i]; if (isEven(levels[i])) { if (t === 'R') { levels[i] += 1; } else if (t === 'AN' || t === 'EN') { levels[i] += 2; } } else { if (t === 'L' || t === 'AN' || t === 'EN') { levels[i] += 1; } } } var highestLevel = -1; var lowestOddLevel = 99; var level; for (i = 0, ii = levels.length; i < ii; ++i) { level = levels[i]; if (highestLevel < level) { highestLevel = level; } if (lowestOddLevel > level && isOdd(level)) { ...
n/a
function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, imageLayer) { this.ctx = canvasCtx; this.current = new CanvasExtraState(); this.stateStack = []; this.pendingClip = null; this.pendingEOFill = false; this.res = null; this.xobjs = null; this.commonObjs = commonObjs; this.objs = objs; this.canvasFactory = canvasFactory; this.imageLayer = imageLayer; this.groupStack = []; this.processingType3 = null; this.baseTransform = null; this.baseTransformStack = []; this.groupLevel = 0; this.smaskStack = []; this.smaskCounter = 0; this.tempSMask = null; this.cachedCanvases = new CachedCanvases(this.canvasFactory); if (canvasCtx) { addContextCurrentTransform(canvasCtx); } this.cachedGetSinglePixelWidth = null; }
...
}
if ((0, _dom_utils.getDefaultSetting)('pdfBug') && _util.globalScope.StepperManager && _util.globalScope
.StepperManager.enabled) {
this.stepper = _util.globalScope.StepperManager.create(this.pageNumber - 1);
this.stepper.init(this.operatorList);
this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint();
}
var params = this.params;
this.gfx = new _canvas.CanvasGraphics(params.canvasContext, this.commonObjs, this.objs
, this.canvasFactory, params.imageLayer);
this.gfx.beginDrawing(params.transform, params.viewport, transparency);
this.operatorListIdx = 0;
this.graphicsReady = true;
if (this.graphicsReadyCallback) {
this.graphicsReadyCallback();
}
},
...
function CFF() { this.header = null; this.names = []; this.topDict = null; this.strings = new CFFStrings(); this.globalSubrIndex = null; this.encoding = null; this.charset = null; this.charStrings = null; this.fdArray = []; this.fdSelect = null; this.isCIDFont = false; }
n/a
function CFFCharset(predefined, format, charset, raw) { this.predefined = predefined; this.format = format; this.charset = charset; this.raw = raw; }
n/a
function CFFCompiler(cff) { this.cff = cff; }
n/a
function CFFHeader(major, minor, hdrSize, offSize) { this.major = major; this.minor = minor; this.hdrSize = hdrSize; this.offSize = offSize; }
n/a
function CFFIndex() { this.objects = []; this.length = 0; }
n/a
function CFFParser(file, properties, seacAnalysisEnabled) { this.bytes = file.getBytes(); this.properties = properties; this.seacAnalysisEnabled = !!seacAnalysisEnabled; }
n/a
function CFFPrivateDict(strings) { if (tables === null) { tables = CFFDict.createTables(layout); } CFFDict.call(this, tables, strings); this.subrsIndex = null; }
n/a
function CFFStrings() { this.strings = []; }
n/a
function CFFTopDict(strings) { if (tables === null) { tables = CFFDict.createTables(layout); } CFFDict.call(this, tables, strings); this.privateDict = null; }
n/a
function ChunkedStream(length, chunkSize, manager) { this.bytes = new Uint8Array(length); this.start = 0; this.pos = 0; this.end = length; this.chunkSize = chunkSize; this.loadedChunks = []; this.numChunksLoaded = 0; this.numChunks = Math.ceil(length / chunkSize); this.manager = manager; this.progressiveDataLength = 0; this.lastSuccessfulEnsureByteChunk = -1; }
n/a
function ChunkedStreamManager(pdfNetworkStream, args) { var chunkSize = args.rangeChunkSize; var length = args.length; this.stream = new ChunkedStream(length, chunkSize, this); this.length = length; this.chunkSize = chunkSize; this.pdfNetworkStream = pdfNetworkStream; this.url = args.url; this.disableAutoFetch = args.disableAutoFetch; this.msgHandler = args.msgHandler; this.currRequestId = 0; this.chunksNeededByRequest = Object.create(null); this.requestsByChunk = Object.create(null); this.promisesByRequest = Object.create(null); this.progressiveDataLength = 0; this.aborted = false; this._loadedStreamCapability = createPromiseCapability(); }
n/a
function CMap(builtInCMap) { this.codespaceRanges = [[], [], [], []]; this.numCodespaceRanges = 0; this._map = []; this.name = ''; this.vertical = false; this.useCMap = null; this.builtInCMap = builtInCMap; }
n/a
function IdentityCMap(vertical, n) { CMap.call(this); this.vertical = vertical; this.addCodespaceRange(n, 0, 0xffff); }
n/a
function ColorSpace() { error('should not call ColorSpace constructor'); }
n/a
function AES128Cipher(key) { this.key = expandKey128(key); this.buffer = new Uint8Array(16); this.bufferPosition = 0; }
n/a
function AES256Cipher(key) { this.key = expandKey256(key); this.buffer = new Uint8Array(16); this.bufferPosition = 0; }
n/a
function ARCFourCipher(key) { this.a = 0; this.b = 0; var s = new Uint8Array(256); var i, j = 0, tmp, keyLength = key.length; for (i = 0; i < 256; ++i) { s[i] = i; } for (i = 0; i < 256; ++i) { tmp = s[i]; j = j + tmp + key[i % keyLength] & 0xFF; s[i] = s[j]; s[j] = tmp; } this.s = s; }
n/a
function CipherTransformFactory(dict, fileId, password) { var filter = dict.get('Filter'); if (!isName(filter, 'Standard')) { error('unknown encryption method'); } this.dict = dict; var algorithm = dict.get('V'); if (!isInt(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) { error('unsupported encryption algorithm'); } this.algorithm = algorithm; var keyLength = dict.get('Length'); if (!keyLength) { if (algorithm <= 3) { keyLength = 40; } else { var cfDict = dict.get('CF'); var streamCryptoName = dict.get('StmF'); if (isDict(cfDict) && isName(streamCryptoName)) { cfDict.suppressEncryption = true; var handlerDict = cfDict.get(streamCryptoName.name); keyLength = handlerDict && handlerDict.get('Length') || 128; if (keyLength < 40) { keyLength <<= 3; } } } } if (!isInt(keyLength) || keyLength < 40 || keyLength % 8 !== 0) { error('invalid key length'); } var ownerPassword = stringToBytes(dict.get('O')).subarray(0, 32); var userPassword = stringToBytes(dict.get('U')).subarray(0, 32); var flags = dict.get('P'); var revision = dict.get('R'); var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get('EncryptMetadata') !== false; this.encryptMetadata = encryptMetadata; var fileIdBytes = stringToBytes(fileId); var passwordBytes; if (password) { if (revision === 6) { try { password = utf8StringToString(password); } catch (ex) { warn('CipherTransformFactory: ' + 'Unable to convert UTF8 encoded password.'); } } passwordBytes = stringToBytes(password); } var encryptionKey; if (algorithm !== 5) { encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata ); } else { var ownerValidationSalt = stringToBytes(dict.get('O')).subarray(32, 40); var ownerKeySalt = stringToBytes(dict.get('O')).subarray(40, 48); var uBytes = stringToBytes(dict.get('U')).subarray(0, 48); var userValidationSalt = stringToBytes(dict.get('U')).subarray(32, 40); var userKeySalt = stringToBytes(dict.get('U')).subarray(40, 48); var ownerEncryption = stringToBytes(dict.get('OE')); var userEncryption = stringToBytes(dict.get('UE')); var perms = stringToBytes(dict.get('Perms')); encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword , userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms); } if (!encryptionKey && !password) { throw new PasswordException('No password given', PasswordResponses.NEED_PASSWORD); } else if (!encryptionKey && password) { var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength); encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata ); } if (!encryptionKey) { throw new PasswordException('Incorrect Password', PasswordResponses.INCORRECT_PASSWORD); } this.encryptionKey = encryptionKey; if (algorithm >= 4) { var cf = dict.get('CF'); if (isDict(cf)) { cf.suppressEncryption = true; } this.cf = cf; this.stmf = dict.get('StmF') || identityName; this.strf = dict.get('StrF') || identityName; this.eff = dict.get('EFF') || this.stmf; } }
n/a
function PDF17() {}
n/a
function PDF20() {}
n/a
function hash(data, offset, length) { var h0 = 1732584193, h1 = -271733879, h2 = -1732584194, h3 = 271733878; var paddedLength = length + 72 & ~63; var padded = new Uint8Array(paddedLength); var i, j, n; for (i = 0; i < length; ++i) { padded[i] = data[offset++]; } padded[i++] = 0x80; n = paddedLength - 8; while (i < n) { padded[i++] = 0; } padded[i++] = length << 3 & 0xFF; padded[i++] = length >> 5 & 0xFF; padded[i++] = length >> 13 & 0xFF; padded[i++] = length >> 21 & 0xFF; padded[i++] = length >>> 29 & 0xFF; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; var w = new Int32Array(16); for (i = 0; i < paddedLength;) { for (j = 0; j < 16; ++j, i += 4) { w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24; } var a = h0, b = h1, c = h2, d = h3, f, g; for (j = 0; j < 64; ++j) { if (j < 16) { f = b & c | ~b & d; g = j; } else if (j < 32) { f = d & b | ~d & c; g = 5 * j + 1 & 15; } else if (j < 48) { f = b ^ c ^ d; g = 3 * j + 5 & 15; } else { f = c ^ (b | ~d); g = 7 * j & 15; } var tmp = d, rotateArg = a + f + k[j] + w[g] | 0, rotate = r[j]; d = c; c = b; b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0; a = tmp; } h0 = h0 + a | 0; h1 = h1 + b | 0; h2 = h2 + c | 0; h3 = h3 + d | 0; } return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF , h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]); }
n/a
function hash(data, offset, length) { var h0 = 0x6a09e667, h1 = 0xbb67ae85, h2 = 0x3c6ef372, h3 = 0xa54ff53a, h4 = 0x510e527f, h5 = 0x9b05688c, h6 = 0x1f83d9ab, h7 = 0x5be0cd19; var paddedLength = Math.ceil((length + 9) / 64) * 64; var padded = new Uint8Array(paddedLength); var i, j, n; for (i = 0; i < length; ++i) { padded[i] = data[offset++]; } padded[i++] = 0x80; n = paddedLength - 8; while (i < n) { padded[i++] = 0; } padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = length >>> 29 & 0xFF; padded[i++] = length >> 21 & 0xFF; padded[i++] = length >> 13 & 0xFF; padded[i++] = length >> 5 & 0xFF; padded[i++] = length << 3 & 0xFF; var w = new Uint32Array(64); for (i = 0; i < paddedLength;) { for (j = 0; j < 16; ++j) { w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; i += 4; } for (j = 16; j < 64; ++j) { w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0; } var a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, t1, t2; for (j = 0; j < 64; ++j) { t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j]; t2 = sigma(a) + maj(a, b, c); h = g; g = f; f = e; e = d + t1 | 0; d = c; c = b; b = a; a = t1 + t2 | 0; } h0 = h0 + a | 0; h1 = h1 + b | 0; h2 = h2 + c | 0; h3 = h3 + d | 0; h4 = h4 + e | 0; h5 = h5 + f | 0; h6 = h6 + g | 0; h7 = h7 + h | 0; } return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF , h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]); }
n/a
function hash(data, offset, length) { return calculateSHA512(data, offset, length, true); }
n/a
function hash(data, offset, length, mode384) { mode384 = !!mode384; var h0, h1, h2, h3, h4, h5, h6, h7; if (!mode384) { h0 = new Word64(0x6a09e667, 0xf3bcc908); h1 = new Word64(0xbb67ae85, 0x84caa73b); h2 = new Word64(0x3c6ef372, 0xfe94f82b); h3 = new Word64(0xa54ff53a, 0x5f1d36f1); h4 = new Word64(0x510e527f, 0xade682d1); h5 = new Word64(0x9b05688c, 0x2b3e6c1f); h6 = new Word64(0x1f83d9ab, 0xfb41bd6b); h7 = new Word64(0x5be0cd19, 0x137e2179); } else { h0 = new Word64(0xcbbb9d5d, 0xc1059ed8); h1 = new Word64(0x629a292a, 0x367cd507); h2 = new Word64(0x9159015a, 0x3070dd17); h3 = new Word64(0x152fecd8, 0xf70e5939); h4 = new Word64(0x67332667, 0xffc00b31); h5 = new Word64(0x8eb44a87, 0x68581511); h6 = new Word64(0xdb0c2e0d, 0x64f98fa7); h7 = new Word64(0x47b5481d, 0xbefa4fa4); } var paddedLength = Math.ceil((length + 17) / 128) * 128; var padded = new Uint8Array(paddedLength); var i, j, n; for (i = 0; i < length; ++i) { padded[i] = data[offset++]; } padded[i++] = 0x80; n = paddedLength - 16; while (i < n) { padded[i++] = 0; } padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = 0; padded[i++] = length >>> 29 & 0xFF; padded[i++] = length >> 21 & 0xFF; padded[i++] = length >> 13 & 0xFF; padded[i++] = length >> 5 & 0xFF; padded[i++] = length << 3 & 0xFF; var w = new Array(80); for (i = 0; i < 80; i++) { w[i] = new Word64(0, 0); } var a = new Word64(0, 0), b = new Word64(0, 0), c = new Word64(0, 0); var d = new Word64(0, 0), e = new Word64(0, 0), f = new Word64(0, 0); var g = new Word64(0, 0), h = new Word64(0, 0); var t1 = new Word64(0, 0), t2 = new Word64(0, 0); var tmp1 = new Word64(0, 0), tmp2 = new Word64(0, 0), tmp3; for (i = 0; i < paddedLength;) { for (j = 0; j < 16; ++j) { w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3]; w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7]; i += 8; } for (j = 16; j < 80; ++j) { tmp3 = w[j]; littleSigmaPrime(tmp3, w[j - 2], tmp2); tmp3.add(w[j - 7]); littleSigma(tmp1, w[j - 15], tmp2); tmp3.add(tmp1); tmp3.add(w[j - 16]); } a.assign(h0); b.assign(h1); c.assign(h2); d.assign(h3); e.assign(h4); f.assign(h5); g.assign(h6); h.assign(h7); for (j = 0; j < 80; ++j) { t1.assign(h); sigmaPrime(tmp1, e, tmp2); t1.add(tmp1); ch(tmp1, e, f, g, tmp2); t1.add(tmp1); t1.add(k[j]); t1.add(w[j]); sigma(t2, a, tmp2); maj(tmp1, a, b, c, tmp2); t2.add(tmp1); tmp3 = h; h = g; g = f; f = e; d.add(t1); e = d; d = c; c = b; b = a; tmp3.assign(t1); tmp3.add(t2); a = tmp3; } h0.add(a); h1.add(b); h2.add(c); h3.add(d); h4.add(e); h5.add(f); h6.add(g); h7.add(h); } var result; if (!mode384) { result = new Uint8Array(64); h0.copyTo(result, 0); h1.copyTo(result, 8); h2.copyTo(result, 16); h3.copyTo(result, 24); h4.copyTo(result, 32); h5.copyTo(result, 40); h6.copyTo(result, 48); h7.copyTo(result, 56); } else { result = new Uint8Array(48); h0.copyTo(result, 0); h1.copyTo(result, 8); h2.copyTo(result, 16); h3.copyTo(result, 24); h4.copyTo(result, 32); h5.copyTo(result, 40); } return result; }
n/a
function PDFDocument(pdfManager, arg) { var stream; if (isStream(arg)) { stream = arg; } else if (isArrayBuffer(arg)) { stream = new Stream(arg); } else { error('PDFDocument: Unknown argument type'); } assert(stream.length > 0, 'stream must have data'); this.pdfManager = pdfManager; this.stream = stream; this.xref = new XRef(stream, pdfManager); }
n/a
function Page(pdfManager, xref, pageIndex, pageDict, ref, fontCache, builtInCMapCache) { this.pdfManager = pdfManager; this.pageIndex = pageIndex; this.pageDict = pageDict; this.xref = xref; this.ref = ref; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; this.evaluatorOptions = pdfManager.evaluatorOptions; this.resourcesPromise = null; var uniquePrefix = 'p' + this.pageIndex + '_'; var idCounters = { obj: 0 }; this.idFactory = { createObjId: function createObjId() { return uniquePrefix + ++idCounters.obj; } }; }
n/a
function CustomStyle() {}
n/a
function DOMCMapReaderFactory(params) { this.baseUrl = params.baseUrl || null; this.isCompressed = params.isCompressed || false; }
n/a
function DOMCanvasFactory() {}
...
return this.annotationsPromise;
},
render: function PDFPageProxy_render(params) {
var stats = this.stats;
stats.time('Overall');
this.pendingCleanup = false;
var renderingIntent = params.intent === 'print' ? 'print' : 'display';
var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory();
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = Object.create(null);
}
var intentState = this.intentStates[renderingIntent];
if (!intentState.displayReadyCapability) {
intentState.receivingOperatorList = true;
intentState.displayReadyCapability = (0, _util.createPromiseCapability)();
...
function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; }
...
this.graphicsReadyCallback();
}
},
cancel: function InternalRenderTask_cancel() {
this.running = false;
this.cancelled = true;
if ((0, _dom_utils.getDefaultSetting)('pdfjsNext')) {
this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled
, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {
if (!this.graphicsReady) {
if (!this.graphicsReadyCallback) {
...
function addLinkAttributes(link, params) { var url = params && params.url; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; if (url) { var target = params.target; if (typeof target === 'undefined') { target = getDefaultSetting('externalLinkTarget'); } link.target = LinkTargetStringMap[target]; var rel = params.rel; if (typeof rel === 'undefined') { rel = getDefaultSetting('externalLinkRel'); } link.rel = rel; } }
n/a
function getDefaultSetting(id) { var globalSettings = _util.globalScope.PDFJS; switch (id) { case 'pdfBug': return globalSettings ? globalSettings.pdfBug : false; case 'disableAutoFetch': return globalSettings ? globalSettings.disableAutoFetch : false; case 'disableStream': return globalSettings ? globalSettings.disableStream : false; case 'disableRange': return globalSettings ? globalSettings.disableRange : false; case 'disableFontFace': return globalSettings ? globalSettings.disableFontFace : false; case 'disableCreateObjectURL': return globalSettings ? globalSettings.disableCreateObjectURL : false; case 'disableWebGL': return globalSettings ? globalSettings.disableWebGL : true; case 'cMapUrl': return globalSettings ? globalSettings.cMapUrl : null; case 'cMapPacked': return globalSettings ? globalSettings.cMapPacked : false; case 'postMessageTransfers': return globalSettings ? globalSettings.postMessageTransfers : true; case 'workerPort': return globalSettings ? globalSettings.workerPort : null; case 'workerSrc': return globalSettings ? globalSettings.workerSrc : null; case 'disableWorker': return globalSettings ? globalSettings.disableWorker : false; case 'maxImageSize': return globalSettings ? globalSettings.maxImageSize : -1; case 'imageResourcesPath': return globalSettings ? globalSettings.imageResourcesPath : ''; case 'isEvalSupported': return globalSettings ? globalSettings.isEvalSupported : true; case 'externalLinkTarget': if (!globalSettings) { return LinkTarget.NONE; } switch (globalSettings.externalLinkTarget) { case LinkTarget.NONE: case LinkTarget.SELF: case LinkTarget.BLANK: case LinkTarget.PARENT: case LinkTarget.TOP: return globalSettings.externalLinkTarget; } (0, _util.warn)('PDFJS.externalLinkTarget is invalid: ' + globalSettings.externalLinkTarget); globalSettings.externalLinkTarget = LinkTarget.NONE; return LinkTarget.NONE; case 'externalLinkRel': return globalSettings ? globalSettings.externalLinkRel : DEFAULT_LINK_REL; case 'enableStats': return !!(globalSettings && globalSettings.enableStats); case 'pdfjsNext': return !!(globalSettings && globalSettings.pdfjsNext); default: throw new Error('Unknown default setting: ' + id); } }
n/a
function getFilenameFromUrl(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?'); var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); return url.substring(url.lastIndexOf('/', end) + 1, end); }
n/a
function isExternalLinkTargetSet() { var externalLinkTarget = getDefaultSetting('externalLinkTarget'); switch (externalLinkTarget) { case LinkTarget.NONE: return false; case LinkTarget.SELF: case LinkTarget.BLANK: case LinkTarget.PARENT: case LinkTarget.TOP: return true; } }
n/a
function isValidUrl(url, allowRelative) { (0, _util.deprecated)('isValidUrl(), please use createValidAbsoluteUrl() instead.'); var baseUrl = allowRelative ? 'http://example.com' : null; return (0, _util.createValidAbsoluteUrl)(url, baseUrl) !== null; }
n/a
function getEncoding(encodingName) { switch (encodingName) { case 'WinAnsiEncoding': return WinAnsiEncoding; case 'StandardEncoding': return StandardEncoding; case 'MacRomanEncoding': return MacRomanEncoding; case 'SymbolSetEncoding': return SymbolSetEncoding; case 'ZapfDingbatsEncoding': return ZapfDingbatsEncoding; case 'ExpertEncoding': return ExpertEncoding; case 'MacExpertEncoding': return MacExpertEncoding; default: return null; } }
n/a
function OperatorList(intent, messageHandler, pageIndex) { this.messageHandler = messageHandler; this.fnArray = []; this.argsArray = []; this.dependencies = Object.create(null); this._totalLength = 0; this.pageIndex = pageIndex; this.intent = intent; }
n/a
function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) { this.pdfManager = pdfManager; this.xref = xref; this.handler = handler; this.pageIndex = pageIndex; this.idFactory = idFactory; this.fontCache = fontCache; this.builtInCMapCache = builtInCMapCache; this.options = options || DefaultPartialEvaluatorOptions; this.fetchBuiltInCMap = function (name) { var cachedCMap = builtInCMapCache[name]; if (cachedCMap) { return Promise.resolve(cachedCMap); } return handler.sendWithPromise('FetchBuiltInCMap', { name: name }).then(function (data) { if (data.compressionType !== CMapCompressionType.NONE) { builtInCMapCache[name] = data; } return data; }); }; }
n/a
function FontFaceObject(translatedData, options) { this.compiledGlyphs = Object.create(null); for (var i in translatedData) { this[i] = translatedData[i]; } this.options = options; }
...
if ((0, _dom_utils.getDefaultSetting)('pdfBug') && _util.globalScope.FontInspector && _util.globalScope
['FontInspector'].enabled) {
fontRegistry = {
registerFont: function registerFont(font, url) {
_util.globalScope['FontInspector'].fontAdded(font, url);
}
};
}
var font = new _font_loader.FontFaceObject(exportedData, {
isEvalSuported: (0, _dom_utils.getDefaultSetting)('isEvalSupported'),
disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'),
fontRegistry: fontRegistry
});
this.fontLoader.bind([font], function fontReady(fontObjs) {
this.commonObjs.resolve(id, font);
}.bind(this));
...
function FontLoader(docId) { this.docId = docId; this.styleElement = null; this.nativeFontFaces = []; this.loadTestFontId = 0; this.loadingContext = { requests: [], nextRequestId: 0 }; }
...
}();
var WorkerTransport = function WorkerTransportClosure() {
function WorkerTransport(messageHandler, loadingTask, pdfDataRangeTransport, CMapReaderFactory) {
this.messageHandler = messageHandler;
this.loadingTask = loadingTask;
this.pdfDataRangeTransport = pdfDataRangeTransport;
this.commonObjs = new PDFObjects();
this.fontLoader = new _font_loader.FontLoader(loadingTask.docId);
this.CMapReaderFactory = new CMapReaderFactory({
baseUrl: (0, _dom_utils.getDefaultSetting)('cMapUrl'),
isCompressed: (0, _dom_utils.getDefaultSetting)('cMapPacked')
});
this.destroyed = false;
this.destroyCapability = null;
this._passwordCapability = null;
...
function ErrorFont(error) { this.error = error; this.loadedName = 'g_font_error'; this.loading = false; }
n/a
function Font(name, file, properties) { var charCode, glyphName, unicode; this.name = name; this.loadedName = properties.loadedName; this.isType3Font = properties.isType3Font; this.sizes = []; this.missingFile = false; this.glyphCache = Object.create(null); this.isSerifFont = !!(properties.flags & FontFlags.Serif); this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); var type = properties.type; var subtype = properties.subtype; this.type = type; this.fallbackName = this.isMonospace ? 'monospace' : this.isSerifFont ? 'serif' : 'sans-serif'; this.differences = properties.differences; this.widths = properties.widths; this.defaultWidth = properties.defaultWidth; this.composite = properties.composite; this.wideChars = properties.wideChars; this.cMap = properties.cMap; this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS; this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS; this.fontMatrix = properties.fontMatrix; this.bbox = properties.bbox; this.toUnicode = properties.toUnicode; this.toFontChar = []; if (properties.type === 'Type3') { for (charCode = 0; charCode < 256; charCode++) { this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode]; } this.fontType = FontType.TYPE3; return; } this.cidEncoding = properties.cidEncoding; this.vertical = properties.vertical; if (this.vertical) { this.vmetrics = properties.vmetrics; this.defaultVMetrics = properties.defaultVMetrics; } var glyphsUnicodeMap; if (!file || file.isEmpty) { if (file) { warn('Font file is empty in "' + name + '" (' + this.loadedName + ')'); } this.missingFile = true; var fontName = name.replace(/[,_]/g, '-'); var stdFontMap = getStdFontMap(), nonStdFontMap = getNonStdFontMap(); var isStandardFont = !!stdFontMap[fontName] || !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]); fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName; this.bold = fontName.search(/bold/gi) !== -1; this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1; this.black = name.search(/Black/g) !== -1; this.remeasure = Object.keys(this.widths).length > 0; if (isStandardFont && type === 'CIDFontType2' && properties.cidEncoding.indexOf('Identity-') === 0) { var GlyphMapForStandardFonts = getGlyphMapForStandardFonts(); var map = []; for (charCode in GlyphMapForStandardFonts) { map[+charCode] = GlyphMapForStandardFonts[charCode]; } if (/Arial-?Black/i.test(name)) { var SupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack(); for (charCode in SupplementalGlyphMapForArialBlack) { map[+charCode] = SupplementalGlyphMapForArialBlack[charCode]; } } var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap; if (!isIdentityUnicode) { this.toUnicode.forEach(function (charCode, unicodeCharCode) { map[+charCode] = unicodeCharCode; }); } this.toFontChar = map; this.toUnicode = new ToUnicodeMap(map); } else if (/Symbol/i.test(fontName)) { this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), properties.differences); } else if (/Dingbats/i.test(fontName)) { if (/Wingdings/i.test(name)) { warn('Non-embedded Wingdings font, falling back to ZapfDingbats.'); } this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), properties.differences); } else if (isStandardFont) { this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences); } else { glyphsUnicodeMap = getGlyphsUnicode(); this.toUnicode.forEach(function (charCode, unicodeCharCode) { if (!this.composite) { glyphName = properties.differences[charCode] || properties.defaultEncoding[charC ...
n/a
function IdentityToUnicodeMap(firstChar, lastChar) { this.firstChar = firstChar; this.lastChar = lastChar; }
n/a
function ToUnicodeMap(cmap) { this._map = cmap; }
n/a
function getFontType(type, subtype) { switch (type) { case 'Type1': return subtype === 'Type1C' ? FontType.TYPE1C : FontType.TYPE1; case 'CIDFontType0': return subtype === 'CIDFontType0C' ? FontType.CIDFONTTYPE0C : FontType.CIDFONTTYPE0; case 'OpenType': return FontType.OPENTYPE; case 'TrueType': return FontType.TRUETYPE; case 'CIDFontType2': return FontType.CIDFONTTYPE2; case 'MMType1': return FontType.MMTYPE1; case 'Type0': return FontType.TYPE0; default: return FontType.UNKNOWN; } }
n/a
function PostScriptCompiler() {}
n/a
function PostScriptEvaluator(operators) { this.operators = operators; }
n/a
function isPDFFunction(v) { var fnDict; if ((typeof v === 'undefined' ? 'undefined' : _typeof(v)) !== 'object') { return false; } else if (isDict(v)) { fnDict = v; } else if (isStream(v)) { fnDict = v.dict; } else { return false; } return fnDict.has('FunctionType'); }
n/a
getDingbatsGlyphsUnicode = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getGlyphsUnicode = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
function PDFImage(xref, res, image, inline, smask, mask, isMask) { this.image = image; var dict = image.dict; if (dict.has('Filter')) { var filter = dict.get('Filter').name; if (filter === 'JPXDecode') { var jpxImage = new JpxImage(); jpxImage.parseImageProperties(image.stream); image.stream.reset(); image.bitsPerComponent = jpxImage.bitsPerComponent; image.numComps = jpxImage.componentsCount; } else if (filter === 'JBIG2Decode') { image.bitsPerComponent = 1; image.numComps = 1; } } this.width = dict.get('Width', 'W'); this.height = dict.get('Height', 'H'); if (this.width < 1 || this.height < 1) { error('Invalid image width: ' + this.width + ' or height: ' + this.height); } this.interpolate = dict.get('Interpolate', 'I') || false; this.imageMask = dict.get('ImageMask', 'IM') || false; this.matte = dict.get('Matte') || false; var bitsPerComponent = image.bitsPerComponent; if (!bitsPerComponent) { bitsPerComponent = dict.get('BitsPerComponent', 'BPC'); if (!bitsPerComponent) { if (this.imageMask) { bitsPerComponent = 1; } else { error('Bits per component missing in image: ' + this.imageMask); } } } this.bpc = bitsPerComponent; if (!this.imageMask) { var colorSpace = dict.get('ColorSpace', 'CS'); if (!colorSpace) { info('JPX images (which do not require color spaces)'); switch (image.numComps) { case 1: colorSpace = Name.get('DeviceGray'); break; case 3: colorSpace = Name.get('DeviceRGB'); break; case 4: colorSpace = Name.get('DeviceCMYK'); break; default: error('JPX images with ' + this.numComps + ' color components not supported.'); } } this.colorSpace = ColorSpace.parse(colorSpace, xref, res); this.numComps = this.colorSpace.numComps; } this.decode = dict.getArray('Decode', 'D'); this.needsDecode = false; if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode) || isMask && !ColorSpace.isDefaultDecode( this.decode, 1))) { this.needsDecode = true; var max = (1 << bitsPerComponent) - 1; this.decodeCoefficients = []; this.decodeAddends = []; for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) { var dmin = this.decode[i]; var dmax = this.decode[i + 1]; this.decodeCoefficients[j] = dmax - dmin; this.decodeAddends[j] = max * dmin; } } if (smask) { this.smask = new PDFImage(xref, res, smask, false); } else if (mask) { if (isStream(mask)) { var maskDict = mask.dict, imageMask = maskDict.get('ImageMask', 'IM'); if (!imageMask) { warn('Ignoring /Mask in image without /ImageMask.'); } else { this.mask = new PDFImage(xref, res, mask, false, null, null, true); } } else { this.mask = mask; } } }
n/a
function Jbig2Image() {}
n/a
function JpegImage() { this.decodeTransform = null; this.colorTransform = -1; }
n/a
function JpxImage() { this.failOnCorruptedImage = false; }
n/a
function Metadata(meta) { if (typeof meta === 'string') { meta = fixMetadata(meta); var parser = new DOMParser(); meta = parser.parseFromString(meta, 'application/xml'); } else if (!(meta instanceof Document)) { (0, _util.error)('Metadata: Invalid metadata object'); } this.metaDocument = meta; this.metadata = Object.create(null); this.parse(); }
...
getOutline: function WorkerTransport_getOutline() {
return this.messageHandler.sendWithPromise('GetOutline', null);
},
getMetadata: function WorkerTransport_getMetadata() {
return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) {
return {
info: results[0],
metadata: results[1] ? new _metadata.Metadata(results[1]) : null
};
});
},
getStats: function WorkerTransport_getStats() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
...
getMetrics = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
function MurmurHash3_64(seed) { var SEED = 0xc3d2e1f0; this.h1 = seed ? seed & 0xffffffff : SEED; this.h2 = seed ? seed & 0xffffffff : SEED; }
n/a
function NetworkManager(url, args) { this.url = url; args = args || {}; this.isHttp = /^https?:/i.test(url); this.httpHeaders = this.isHttp && args.httpHeaders || {}; this.withCredentials = args.withCredentials || false; this.getXhr = args.getXhr || function NetworkManager_getXhr() { return new XMLHttpRequest(); }; this.currXhrId = 0; this.pendingRequests = Object.create(null); this.loadedRequests = Object.create(null); }
n/a
function PDFNetworkStream(options) { this._options = options; var source = options.source; this._manager = new NetworkManager(source.url, { httpHeaders: source.httpHeaders, withCredentials: source.withCredentials }); this._rangeChunkSize = source.rangeChunkSize; this._fullRequestReader = null; this._rangeRequestReaders = []; }
n/a
function Catalog(pdfManager, xref, pageFactory) { this.pdfManager = pdfManager; this.xref = xref; this.catDict = xref.getCatalogObj(); assert(isDict(this.catDict), 'catalog object is not a dictionary'); this.fontCache = new RefSetCache(); this.builtInCMapCache = Object.create(null); this.pageKidsCountCache = new RefSetCache(); this.pageFactory = pageFactory; this.pagePromises = []; }
n/a
function FileSpec(root, xref) { if (!root || !isDict(root)) { return; } this.xref = xref; this.root = root; if (root.has('FS')) { this.fs = root.get('FS'); } this.description = root.has('Desc') ? stringToPDFString(root.get('Desc')) : ''; if (root.has('RF')) { warn('Related file specifications are not supported'); } this.contentAvailable = true; if (!root.has('EF')) { this.contentAvailable = false; warn('Non-embedded file specifications are not supported'); } }
n/a
function ObjectLoader(obj, keys, xref) { this.obj = obj; this.keys = keys; this.xref = xref; this.refSet = null; this.capability = null; }
n/a
function XRef(stream, pdfManager) { this.stream = stream; this.pdfManager = pdfManager; this.entries = []; this.xrefstms = Object.create(null); this.cache = []; this.stats = { streamTypes: [], fontTypes: [] }; }
n/a
function Lexer(stream, knownCommands) { this.stream = stream; this.nextChar(); this.strBuf = []; this.knownCommands = knownCommands; }
n/a
function Parser(lexer, allowStreams, xref, recoveryMode) { this.lexer = lexer; this.allowStreams = allowStreams; this.xref = xref; this.recoveryMode = recoveryMode || false; this.imageCache = Object.create(null); this.refill(); }
n/a
function Pattern() { error('should not call Pattern constructor'); }
n/a
function getTilingPatternIR(operatorList, dict, args) { var matrix = dict.getArray('Matrix'); var bbox = dict.getArray('BBox'); var xstep = dict.get('XStep'); var ystep = dict.get('YStep'); var paintType = dict.get('PaintType'); var tilingType = dict.get('TilingType'); return ['TilingPattern', args, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType]; }
n/a
function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { this.operatorList = IR[2]; this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; this.bbox = _util.Util.normalizeRect(IR[4]); this.xstep = IR[5]; this.ystep = IR[6]; this.paintType = IR[7]; this.tilingType = IR[8]; this.color = color; this.canvasGraphicsFactory = canvasGraphicsFactory; this.baseTransform = baseTransform; this.type = 'Pattern'; this.ctx = ctx; }
...
var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice();
var self = this;
var canvasGraphicsFactory = {
createCanvasGraphics: function createCanvasGraphics(ctx) {
return new CanvasGraphics(ctx, self.commonObjs, self.objs, self.canvasFactory);
}
};
pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory
, baseTransform);
} else {
pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR);
}
return pattern;
},
setStrokeColorN: function CanvasGraphics_setStrokeColorN() {
this.current.strokeColor = this.getColorN_Pattern(arguments);
...
function getShadingPatternFromIR(raw) { var shadingIR = ShadingIRs[raw[0]]; if (!shadingIR) { (0, _util.error)('Unknown IR type: ' + raw[0]); } return shadingIR.fromIR(raw); }
n/a
function CustomStyle() {}
n/a
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); }
n/a
function PDFWorker(name, port) { this.name = name; this.destroyed = false; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { this._initializeFromPort(port); return; } this._initialize(); }
n/a
function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; }
...
this.graphicsReadyCallback();
}
},
cancel: function InternalRenderTask_cancel() {
this.running = false;
this.cancelled = true;
if ((0, _dom_utils.getDefaultSetting)('pdfjsNext')) {
this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled
, page ' + this.pageNumber, 'canvas'));
} else {
this.callback('cancelled');
}
},
operatorListChanged: function InternalRenderTask_operatorListChanged() {
if (!this.graphicsReady) {
if (!this.graphicsReadyCallback) {
...
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function addLinkAttributes(link, params) { var url = params && params.url; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; if (url) { var target = params.target; if (typeof target === 'undefined') { target = getDefaultSetting('externalLinkTarget'); } link.target = LinkTargetStringMap[target]; var rel = params.rel; if (typeof rel === 'undefined') { rel = getDefaultSetting('externalLinkRel'); } link.rel = rel; } }
n/a
function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } throw new Error('The "Blob" constructor is not supported.'); }
n/a
function createObjectURL(data, contentType) { var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!forceDataSchema) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); } var buffer = 'data:' + contentType + ';base64,'; for (var i = 0, ii = data.length; i < ii; i += 3) { var b1 = data[i] & 0xFF; var b2 = data[i + 1] & 0xFF; var b3 = data[i + 2] & 0xFF; var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; var d4 = i + 2 < ii ? b3 & 0x3F : 64; buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; } return buffer; }
...
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType) {
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!forceDataSchema) {
var blob = createBlob(data, contentType);
return URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
for (var i = 0, ii = data.length; i < ii; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2,
...
function createPromiseCapability() { var capability = {}; capability.promise = new Promise(function (resolve, reject) { capability.resolve = resolve; capability.reject = reject; }); return capability; }
n/a
function createValidAbsoluteUrl(url, baseUrl) { if (!url) { return null; } try { var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); if (isValidProtocol(absoluteUrl)) { return absoluteUrl; } } catch (ex) {} return null; }
n/a
function getDocument(src, pdfDataRangeTransport, passwordCallback, progressCallback) { var task = new PDFDocumentLoadingTask(); if (arguments.length > 1) { (0, _util.deprecated)('getDocument is called with pdfDataRangeTransport, ' + 'passwordCallback or progressCallback argument'); } if (pdfDataRangeTransport) { if (!(pdfDataRangeTransport instanceof PDFDataRangeTransport)) { pdfDataRangeTransport = Object.create(pdfDataRangeTransport); pdfDataRangeTransport.length = src.length; pdfDataRangeTransport.initialData = src.initialData; if (!pdfDataRangeTransport.abort) { pdfDataRangeTransport.abort = function () {}; } } src = Object.create(src); src.range = pdfDataRangeTransport; } task.onPassword = passwordCallback || null; task.onProgress = progressCallback || null; var source; if (typeof src === 'string') { source = { url: src }; } else if ((0, _util.isArrayBuffer)(src)) { source = { data: src }; } else if (src instanceof PDFDataRangeTransport) { source = { range: src }; } else { if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { (0, _util.error)('Invalid parameter in getDocument, need either Uint8Array, ' + 'string or a parameter object'); } if (!src.url && !src.data && !src.range) { (0, _util.error)('Invalid parameter object: need either .data, .range or .url'); } source = src; } var params = {}; var rangeTransport = null; var worker = null; for (var key in source) { if (key === 'url' && typeof window !== 'undefined') { params[key] = new URL(source[key], window.location).href; continue; } else if (key === 'range') { rangeTransport = source[key]; continue; } else if (key === 'worker') { worker = source[key]; continue; } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; if (typeof pdfBytes === 'string') { params[key] = (0, _util.stringToBytes)(pdfBytes); } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN (pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { (0, _util.error)('Invalid PDF binary data: either typed array, string or ' + 'array-like object is expected in the data property.'); } continue; } params[key] = source[key]; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.disableNativeImageDecoder = params.disableNativeImageDecoder === true; params.ignoreErrors = params.stopAtErrors !== true; var CMapReaderFactory = params.CMapReaderFactory || _dom_utils.DOMCMapReaderFactory; if (!worker) { var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); worker = workerPort ? new PDFWorker(null, workerPort) : new PDFWorker(); task._worker = worker; } var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { throw new Error('Loading aborted'); } return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { if (task.destroyed) { throw new Error('Loading aborted'); } var messageHandler = new _util.MessageHandler(docId, workerId, worker.port); var transport = new WorkerTransport(messageHandler, task, rangeTransport, CMapReaderFactory); task._transport = transport; messageHandler.send('Ready', null); }); }).catch(task._capability.reject); return task; }
n/a
function getFilenameFromUrl(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?'); var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); return url.substring(url.lastIndexOf('/', end) + 1, end); }
n/a
function isValidUrl(url, allowRelative) { (0, _util.deprecated)('isValidUrl(), please use createValidAbsoluteUrl() instead.'); var baseUrl = allowRelative ? 'http://example.com' : null; return (0, _util.createValidAbsoluteUrl)(url, baseUrl) !== null; }
n/a
function removeNullCharacters(str) { if (typeof str !== 'string') { warn('The argument for removeNullCharacters must be a string.'); return str; } return str.replace(NullCharactersRegExp, ''); }
n/a
function renderTextLayer(renderParameters) { var task = new TextLayerRenderTask(renderParameters.textContent, renderParameters.container, renderParameters.viewport, renderParameters .textDivs, renderParameters.enhanceTextSelection); task._render(renderParameters.timeout); return task; }
n/a
function shadow(obj, prop, value) { Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); return value; }
n/a
function LocalPdfManager(docId, data, password, evaluatorOptions, docBaseUrl) { this._docId = docId; this._password = password; this._docBaseUrl = docBaseUrl; this.evaluatorOptions = evaluatorOptions; var stream = new Stream(data); this.pdfDocument = new PDFDocument(this, stream); this._loadedStreamCapability = createPromiseCapability(); this._loadedStreamCapability.resolve(stream); }
n/a
function NetworkPdfManager(docId, pdfNetworkStream, args, evaluatorOptions, docBaseUrl) { this._docId = docId; this._password = args.password; this._docBaseUrl = docBaseUrl; this.msgHandler = args.msgHandler; this.evaluatorOptions = evaluatorOptions; var params = { msgHandler: args.msgHandler, url: args.url, length: args.length, disableAutoFetch: args.disableAutoFetch, rangeChunkSize: args.rangeChunkSize }; this.streamManager = new ChunkedStreamManager(pdfNetworkStream, params); this.pdfDocument = new PDFDocument(this, this.streamManager.getStream()); }
n/a
function PDFRenderingQueue() { this.pdfViewer = null; this.pdfThumbnailViewer = null; this.onIdle = null; this.highestPriorityPage = null; this.idleTimeout = null; this.printing = false; this.isThumbnailViewEnabled = false; }
n/a
function BasePreferences() { var _this = this; _classCallCheck(this, BasePreferences); if (this.constructor === BasePreferences) { throw new Error('Cannot initialize BasePreferences.'); } this.prefs = null; this._initializedPromise = getDefaultPreferences().then(function (defaults) { Object.defineProperty(_this, 'defaults', { value: Object.freeze(defaults), writable: false, enumerable: true, configurable: false }); _this.prefs = cloneObj(defaults); return _this._readFromStorage(defaults); }).then(function (prefObj) { if (prefObj) { _this.prefs = prefObj; } }); }
n/a
function Cmd(cmd) { this.cmd = cmd; }
n/a
function Dict(xref) { this.map = Object.create(null); this.xref = xref; this.objId = null; this.suppressEncryption = false; this.__nonSerializable__ = nonSerializable; }
n/a
function Name(name) { this.name = name; }
n/a
function Ref(num, gen) { this.num = num; this.gen = gen; }
n/a
function RefSet() { this.dict = Object.create(null); }
n/a
function RefSetCache() { this.dict = Object.create(null); }
n/a
function isCmd(v, cmd) { return v instanceof Cmd && (cmd === undefined || v.cmd === cmd); }
n/a
function isDict(v, type) { return v instanceof Dict && (type === undefined || isName(v.get('Type'), type)); }
n/a
function isEOF(v) { return v === EOF; }
n/a
function isName(v, name) { return v instanceof Name && (name === undefined || v.name === name); }
n/a
function isRef(v) { return v instanceof Ref; }
n/a
function isRefsEqual(v1, v2) { return v1.num === v2.num && v1.gen === v2.gen; }
n/a
function isStream(v) { return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.getBytes !== undefined; }
n/a
function PostScriptLexer(stream) { this.stream = stream; this.nextChar(); this.strBuf = []; }
n/a
function PostScriptParser(lexer) { this.lexer = lexer; this.operators = []; this.token = null; this.prev = null; }
n/a
getGlyphMapForStandardFonts = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getNonStdFontMap = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getSerifFonts = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getStdFontMap = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getSupplementalGlyphMapForArialBlack = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
getSymbolsFonts = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
function Ascii85Stream(str, maybeLength) { this.str = str; this.dict = str.dict; this.input = new Uint8Array(5); if (maybeLength) { maybeLength = 0.8 * maybeLength; } DecodeStream.call(this, maybeLength); }
n/a
function AsciiHexStream(str, maybeLength) { this.str = str; this.dict = str.dict; this.firstDigit = -1; if (maybeLength) { maybeLength = 0.5 * maybeLength; } DecodeStream.call(this, maybeLength); }
n/a
function CCITTFaxStream(str, maybeLength, params) { this.str = str; this.dict = str.dict; params = params || Dict.empty; this.encoding = params.get('K') || 0; this.eoline = params.get('EndOfLine') || false; this.byteAlign = params.get('EncodedByteAlign') || false; this.columns = params.get('Columns') || 1728; this.rows = params.get('Rows') || 0; var eoblock = params.get('EndOfBlock'); if (eoblock === null || eoblock === undefined) { eoblock = true; } this.eoblock = eoblock; this.black = params.get('BlackIs1') || false; this.codingLine = new Uint32Array(this.columns + 1); this.refLine = new Uint32Array(this.columns + 2); this.codingLine[0] = this.columns; this.codingPos = 0; this.row = 0; this.nextLine2D = this.encoding < 0; this.inputBits = 0; this.inputBuf = 0; this.outputBits = 0; var code1; while ((code1 = this.lookBits(12)) === 0) { this.eatBits(1); } if (code1 === 1) { this.eatBits(12); } if (this.encoding > 0) { this.nextLine2D = !this.lookBits(1); this.eatBits(1); } DecodeStream.call(this, maybeLength); }
n/a
function DecodeStream(maybeMinBufferLength) { this.pos = 0; this.bufferLength = 0; this.eof = false; this.buffer = emptyBuffer; this.minBufferLength = 512; if (maybeMinBufferLength) { while (this.minBufferLength < maybeMinBufferLength) { this.minBufferLength *= 2; } } }
n/a
function DecryptStream(str, maybeLength, decrypt) { this.str = str; this.dict = str.dict; this.decrypt = decrypt; this.nextChunk = null; this.initialized = false; DecodeStream.call(this, maybeLength); }
n/a
function FlateStream(str, maybeLength) { this.str = str; this.dict = str.dict; var cmf = str.getByte(); var flg = str.getByte(); if (cmf === -1 || flg === -1) { error('Invalid header in flate stream: ' + cmf + ', ' + flg); } if ((cmf & 0x0f) !== 0x08) { error('Unknown compression method in flate stream: ' + cmf + ', ' + flg); } if (((cmf << 8) + flg) % 31 !== 0) { error('Bad FCHECK in flate stream: ' + cmf + ', ' + flg); } if (flg & 0x20) { error('FDICT bit set in flate stream: ' + cmf + ', ' + flg); } this.codeSize = 0; this.codeBuf = 0; DecodeStream.call(this, maybeLength); }
n/a
function Jbig2Stream(stream, maybeLength, dict, params) { this.stream = stream; this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); }
n/a
function JpegStream(stream, maybeLength, dict, params) { var ch; while ((ch = stream.getByte()) !== -1) { if (ch === 0xFF) { stream.skip(-1); break; } } this.stream = stream; this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); }
n/a
function JpxStream(stream, maybeLength, dict, params) { this.stream = stream; this.maybeLength = maybeLength; this.dict = dict; this.params = params; DecodeStream.call(this, maybeLength); }
n/a
function LZWStream(str, maybeLength, earlyChange) { this.str = str; this.dict = str.dict; this.cachedData = 0; this.bitsCached = 0; var maxLzwDictionarySize = 4096; var lzwState = { earlyChange: earlyChange, codeLength: 9, nextCode: 258, dictionaryValues: new Uint8Array(maxLzwDictionarySize), dictionaryLengths: new Uint16Array(maxLzwDictionarySize), dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize), currentSequence: new Uint8Array(maxLzwDictionarySize), currentSequenceLength: 0 }; for (var i = 0; i < 256; ++i) { lzwState.dictionaryValues[i] = i; lzwState.dictionaryLengths[i] = 1; } this.lzwState = lzwState; DecodeStream.call(this, maybeLength); }
n/a
function NullStream() { Stream.call(this, new Uint8Array(0)); }
n/a
function PredictorStream(str, maybeLength, params) { if (!isDict(params)) { return str; } var predictor = this.predictor = params.get('Predictor') || 1; if (predictor <= 1) { return str; } if (predictor !== 2 && (predictor < 10 || predictor > 15)) { error('Unsupported predictor: ' + predictor); } if (predictor === 2) { this.readBlock = this.readBlockTiff; } else { this.readBlock = this.readBlockPng; } this.str = str; this.dict = str.dict; var colors = this.colors = params.get('Colors') || 1; var bits = this.bits = params.get('BitsPerComponent') || 8; var columns = this.columns = params.get('Columns') || 1; this.pixBytes = colors * bits + 7 >> 3; this.rowBytes = columns * colors * bits + 7 >> 3; DecodeStream.call(this, maybeLength); return this; }
n/a
function RunLengthStream(str, maybeLength) { this.str = str; this.dict = str.dict; DecodeStream.call(this, maybeLength); }
n/a
function Stream(arrayBuffer, start, length, dict) { this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer); this.start = start || 0; this.pos = this.start; this.end = start + length || this.bytes.length; this.dict = dict; }
n/a
function StreamsSequenceStream(streams) { this.streams = streams; DecodeStream.call(this, null); }
n/a
function StringStream(str) { var length = str.length; var bytes = new Uint8Array(length); for (var n = 0; n < length; ++n) { bytes[n] = str.charCodeAt(n); } Stream.call(this, bytes); }
n/a
function SVGGraphics(commonObjs, objs, forceDataSchema) { this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; }
n/a
function renderTextLayer(renderParameters) { var task = new TextLayerRenderTask(renderParameters.textContent, renderParameters.container, renderParameters.viewport, renderParameters .textDivs, renderParameters.enhanceTextSelection); task._render(renderParameters.timeout); return task; }
n/a
function Type1Parser(stream, encrypted, seacAnalysisEnabled) { if (encrypted) { var data = stream.getBytes(); var isBinary = !(isHexDigit(data[0]) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3])); stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4)); } this.seacAnalysisEnabled = !!seacAnalysisEnabled; this.stream = stream; this.nextChar(); }
n/a
getNormalizedUnicodes = function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }
n/a
function getUnicodeForGlyph(name, glyphsUnicodeMap) { var unicode = glyphsUnicodeMap[name]; if (unicode !== undefined) { return unicode; } if (!name) { return -1; } if (name[0] === 'u') { var nameLen = name.length, hexStr; if (nameLen === 7 && name[1] === 'n' && name[2] === 'i') { hexStr = name.substr(3); } else if (nameLen >= 5 && nameLen <= 7) { hexStr = name.substr(1); } else { return -1; } if (hexStr === hexStr.toUpperCase()) { unicode = parseInt(hexStr, 16); if (unicode >= 0) { return unicode; } } } return -1; }
n/a
function getUnicodeRangeFor(value) { for (var i = 0, ii = UnicodeRanges.length; i < ii; i++) { var range = UnicodeRanges[i]; if (value >= range.begin && value < range.end) { return i; } } return -1; }
n/a
function mapSpecialUnicodeValues(code) { if (code >= 0xFFF0 && code <= 0xFFFF) { return 0; } else if (code >= 0xF600 && code <= 0xF8FF) { return getSpecialPUASymbols()[code] || code; } return code; }
n/a
function reverseIfRtl(chars) { var charsLength = chars.length; if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) { return chars; } var s = ''; for (var ii = charsLength - 1; ii >= 0; ii--) { s += chars[ii]; } return s; }
n/a
function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; }
...
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message
));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
...
function MessageHandler(sourceName, targetName, comObj) { this.sourceName = sourceName; this.targetName = targetName; this.comObj = comObj; this.callbackIndex = 1; this.postMessageTransfers = true; var callbacksCapabilities = this.callbacksCapabilities = Object.create(null); var ah = this.actionHandler = Object.create(null); this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) { var data = event.data; if (data.targetName !== this.sourceName) { return; } if (data.isReply) { var callbackId = data.callbackId; if (data.callbackId in callbacksCapabilities) { var callback = callbacksCapabilities[callbackId]; delete callbacksCapabilities[callbackId]; if ('error' in data) { callback.reject(data.error); } else { callback.resolve(data.data); } } else { error('Cannot resolve callback ' + callbackId); } } else if (data.action in ah) { var action = ah[data.action]; if (data.callbackId) { var sourceName = this.sourceName; var targetName = data.sourceName; Promise.resolve().then(function () { return action[0].call(action[1], data.data); }).then(function (result) { comObj.postMessage({ sourceName: sourceName, targetName: targetName, isReply: true, callbackId: data.callbackId, data: result }); }, function (reason) { if (reason instanceof Error) { reason = reason + ''; } comObj.postMessage({ sourceName: sourceName, targetName: targetName, isReply: true, callbackId: data.callbackId, error: reason }); }); } else { action[0].call(action[1], data.data); } } else { error('Unknown action from worker: ' + data.action); } }.bind(this); comObj.addEventListener('message', this._onComObjOnMessage); }
...
if (task.destroyed) {
throw new Error('Loading aborted');
}
return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) {
if (task.destroyed) {
throw new Error('Loading aborted');
}
var messageHandler = new _util.MessageHandler(docId, workerId, worker.port);
var transport = new WorkerTransport(messageHandler, task, rangeTransport, CMapReaderFactory);
task._transport = transport;
messageHandler.send('Ready', null);
});
}).catch(task._capability.reject);
return task;
}
...
function MissingDataException(begin, end) { this.begin = begin; this.end = end; this.message = 'Missing data [' + begin + ', ' + end + ')'; }
n/a
function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; }
...
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message
));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
...
function NotImplementedException(msg) { this.message = msg; }
n/a
function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { this.viewBox = viewBox; this.scale = scale; this.rotation = rotation; this.offsetX = offsetX; this.offsetY = offsetY; var centerX = (viewBox[2] + viewBox[0]) / 2; var centerY = (viewBox[3] + viewBox[1]) / 2; var rotateA, rotateB, rotateC, rotateD; rotation = rotation % 360; rotation = rotation < 0 ? rotation + 360 : rotation; switch (rotation) { case 180: rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; break; case 90: rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; break; case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } if (dontFlip) { rotateC = -rotateC; rotateD = -rotateD; } var offsetCanvasX, offsetCanvasY; var width, height; if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; height = Math.abs(viewBox[2] - viewBox[0]) * scale; } else { offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; width = Math.abs(viewBox[2] - viewBox[0]) * scale; height = Math.abs(viewBox[3] - viewBox[1]) * scale; } this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; this.width = width; this.height = height; this.fontScale = scale; }
...
get view() {
return this.pageInfo.view;
},
getViewport: function PDFPageProxy_getViewport(scale, rotate) {
if (arguments.length < 2) {
rotate = this.rotate;
}
return new _util.PageViewport(this.view, scale, rotate, 0, 0);
},
getAnnotations: function PDFPageProxy_getAnnotations(params) {
var intent = params && params.intent || null;
if (!this.annotationsPromise || this.annotationsIntent !== intent) {
this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent);
this.annotationsIntent = intent;
}
...
function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; }
...
this._passwordCapability = (0, _util.createPromiseCapability)();
if (loadingTask.onPassword) {
var updatePassword = function (password) {
this._passwordCapability.resolve({ password: password });
}.bind(this);
loadingTask.onPassword(updatePassword, exception.code);
} else {
this._passwordCapability.reject(new _util.PasswordException(exception.message, exception
.code));
}
return this._passwordCapability.promise;
}, this);
messageHandler.on('PasswordException', function transportPasswordException(exception) {
loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code));
}, this);
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
...
function StatTimer() { this.started = Object.create(null); this.times = []; this.enabled = true; }
...
return PDFDocumentProxy;
}();
var PDFPageProxy = function PDFPageProxyClosure() {
function PDFPageProxy(pageIndex, pageInfo, transport) {
this.pageIndex = pageIndex;
this.pageInfo = pageInfo;
this.transport = transport;
this.stats = new _util.StatTimer();
this.stats.enabled = (0, _dom_utils.getDefaultSetting)('enableStats');
this.commonObjs = transport.commonObjs;
this.objs = new PDFObjects();
this.cleanupAfterRender = false;
this.pendingCleanup = false;
this.intentStates = Object.create(null);
this.destroyed = false;
...
function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; }
...
messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) {
this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message));
}, this);
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception
.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
...
function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; }
...
messageHandler.on('MissingPDF', function transportMissingPDF(exception) {
this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message));
}, this);
messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) {
this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status));
}, this);
messageHandler.on('UnknownError', function transportUnknownError(exception) {
this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message
, exception.details));
}, this);
messageHandler.on('DataLoaded', function transportPage(data) {
this.downloadInfoCapability.resolve(data);
}, this);
messageHandler.on('PDFManagerReady', function transportPage(data) {
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.transportReady();
...
function Util() {}
n/a
function XRefParseException(msg) { this.message = msg; }
n/a
function arrayByteLength(arr) { if (arr.length !== undefined) { return arr.length; } assert(arr.byteLength !== undefined); return arr.byteLength; }
n/a
function arraysToBytes(arr) { if (arr.length === 1 && arr[0] instanceof Uint8Array) { return arr[0]; } var resultLength = 0; var i, ii = arr.length; var item, itemLength; for (i = 0; i < ii; i++) { item = arr[i]; itemLength = arrayByteLength(item); resultLength += itemLength; } var pos = 0; var data = new Uint8Array(resultLength); for (i = 0; i < ii; i++) { item = arr[i]; if (!(item instanceof Uint8Array)) { if (typeof item === 'string') { item = stringToBytes(item); } else { item = new Uint8Array(item); } } itemLength = item.byteLength; data.set(item, pos); pos += itemLength; } return data; }
n/a
function assert(cond, msg) { if (!cond) { error(msg); } }
n/a
function bytesToString(bytes) { assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined , 'Invalid argument for bytesToString'); var length = bytes.length; var MAX_ARGUMENT_COUNT = 8192; if (length < MAX_ARGUMENT_COUNT) { return String.fromCharCode.apply(null, bytes); } var strBuf = []; for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); var chunk = bytes.subarray(i, chunkEnd); strBuf.push(String.fromCharCode.apply(null, chunk)); } return strBuf.join(''); }
n/a
function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } throw new Error('The "Blob" constructor is not supported.'); }
n/a
function createObjectURL(data, contentType) { var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!forceDataSchema) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); } var buffer = 'data:' + contentType + ';base64,'; for (var i = 0, ii = data.length; i < ii; i += 3) { var b1 = data[i] & 0xFF; var b2 = data[i + 1] & 0xFF; var b3 = data[i + 2] & 0xFF; var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; var d4 = i + 2 < ii ? b3 & 0x3F : 64; buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; } return buffer; }
...
var createObjectURL = function createObjectURLClosure() {
var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
return function createObjectURL(data, contentType) {
var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (!forceDataSchema) {
var blob = createBlob(data, contentType);
return URL.createObjectURL(blob);
}
var buffer = 'data:' + contentType + ';base64,';
for (var i = 0, ii = data.length; i < ii; i += 3) {
var b1 = data[i] & 0xFF;
var b2 = data[i + 1] & 0xFF;
var b3 = data[i + 2] & 0xFF;
var d1 = b1 >> 2,
...
function createPromiseCapability() { var capability = {}; capability.promise = new Promise(function (resolve, reject) { capability.resolve = resolve; capability.reject = reject; }); return capability; }
n/a
function createValidAbsoluteUrl(url, baseUrl) { if (!url) { return null; } try { var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); if (isValidProtocol(absoluteUrl)) { return absoluteUrl; } } catch (ex) {} return null; }
n/a
function deprecated(details) { console.log('Deprecated API usage: ' + details); }
n/a
function error(msg) { if (verbosity >= VERBOSITY_LEVELS.errors) { console.log('Error: ' + msg); console.log(backtrace()); } throw new Error(msg); }
n/a
function getLookupTableFactory(initializer) { var lookup; return function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }; }
n/a
function getVerbosityLevel() { return verbosity; }
n/a
function info(msg) { if (verbosity >= VERBOSITY_LEVELS.infos) { console.log('Info: ' + msg); } }
n/a
function isArray(v) { return v instanceof Array; }
n/a
function isArrayBuffer(v) { return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined; }
n/a
function isBool(v) { return typeof v === 'boolean'; }
n/a
function isEmptyObj(obj) { for (var key in obj) { return false; } return true; }
n/a
function isEvalSupported() { try { new Function(''); return true; } catch (e) { return false; } }
n/a
function isInt(v) { return typeof v === 'number' && (v | 0) === v; }
n/a
function isLittleEndian() { var buffer8 = new Uint8Array(4); buffer8[0] = 1; var view32 = new Uint32Array(buffer8.buffer, 0, 1); return view32[0] === 1; }
n/a
function isNodeJS() { if (typeof __pdfjsdev_webpack__ === 'undefined') { return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]'; } return false; }
n/a
function isNum(v) { return typeof v === 'number'; }
n/a
function isSameOrigin(baseUrl, otherUrl) { try { var base = new URL(baseUrl); if (!base.origin || base.origin === 'null') { return false; } } catch (e) { return false; } var other = new URL(otherUrl, base); return base.origin === other.origin; }
n/a
function isSpace(ch) { return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; }
n/a
function isString(v) { return typeof v === 'string'; }
n/a
function loadJpegStream(id, imageUrl, objs) { var img = new Image(); img.onload = function loadJpegStream_onloadClosure() { objs.resolve(id, img); }; img.onerror = function loadJpegStream_onerrorClosure() { objs.resolve(id, null); warn('Error during JPEG image loading'); }; img.src = imageUrl; }
n/a
function log2(x) { var n = 1, i = 0; while (x > n) { n <<= 1; i++; } return i; }
n/a
function readInt8(data, start) { return data[start] << 24 >> 24; }
n/a
function readUint16(data, offset) { return data[offset] << 8 | data[offset + 1]; }
n/a
function readUint32(data, offset) { return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; }
n/a
function removeNullCharacters(str) { if (typeof str !== 'string') { warn('The argument for removeNullCharacters must be a string.'); return str; } return str.replace(NullCharactersRegExp, ''); }
n/a
function setVerbosityLevel(level) { verbosity = level; }
n/a
function shadow(obj, prop, value) { Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); return value; }
n/a
function string32(value) { return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); }
n/a
function stringToBytes(str) { assert(typeof str === 'string', 'Invalid argument for stringToBytes'); var length = str.length; var bytes = new Uint8Array(length); for (var i = 0; i < length; ++i) { bytes[i] = str.charCodeAt(i) & 0xFF; } return bytes; }
n/a
function stringToPDFString(str) { var i, n = str.length, strBuf = []; if (str[0] === '\xFE' && str[1] === '\xFF') { for (i = 2; i < n; i += 2) { strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); } } else { for (i = 0; i < n; ++i) { var code = PDFStringTranslateTable[str.charCodeAt(i)]; strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); } } return strBuf.join(''); }
n/a
function stringToUTF8String(str) { return decodeURIComponent(escape(str)); }
n/a
function utf8StringToString(str) { return unescape(encodeURIComponent(str)); }
n/a
function warn(msg) { if (verbosity >= VERBOSITY_LEVELS.warnings) { console.log('Warning: ' + msg); } }
...
var msg = 'Unhandled rejection: ' + unhandled;
if (unhandled.stack) {
msg += '\n' + unhandled.stack;
}
try {
throw new Error(msg);
} catch (_) {
console.warn(msg);
}
this.unhandledRejections.splice(i);
i--;
}
}
if (this.unhandledRejections.length) {
this.scheduleRejectionCheck();
...
function ViewHistory(fingerprint, cacheSize) { this.fingerprint = fingerprint; this.cacheSize = cacheSize || DEFAULT_VIEW_HISTORY_CACHE_SIZE; this.isInitializedPromiseResolved = false; this.initializedPromise = this._readFromStorage().then(function (databaseStr) { this.isInitializedPromiseResolved = true; var database = JSON.parse(databaseStr || '{}'); if (!('files' in database)) { database.files = []; } if (database.files.length >= this.cacheSize) { database.files.shift(); } var index; for (var i = 0, length = database.files.length; i < length; i++) { var branch = database.files[i]; if (branch.fingerprint === this.fingerprint) { index = i; break; } } if (typeof index !== 'number') { index = database.files.push({ fingerprint: this.fingerprint }) - 1; } this.file = database.files[index]; this.database = database; }.bind(this)); }
n/a
function WorkerTask(name) { this.name = name; this.terminated = false; this._capability = createPromiseCapability(); }
n/a
function setPDFNetworkStreamClass(cls) { PDFNetworkStream = cls; }
...
this._requests = [];
if (this._manager.isPendingRequest(this._requestId)) {
this._manager.abortRequest(this._requestId);
}
this._close();
}
};
coreWorker.setPDFNetworkStreamClass(PDFNetworkStream);
exports.PDFNetworkStream = PDFNetworkStream;
exports.NetworkManager = NetworkManager;
/***/ }),
/* 40 */
/***/ (function(module, exports, __w_pdfjs_require__) {
...