Revert "[api-minor] Allow loading pdf fonts into another document."

This commit is contained in:
Jonas Jenwald 2020-08-01 12:52:39 +02:00 committed by GitHub
parent 173b92a873
commit 05baa4c89f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 158 deletions

View file

@ -152,9 +152,6 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
* parsed font data from the worker-thread. This may be useful for debugging
* purposes (and backwards compatibility), but note that it will lead to
* increased memory usage. The default value is `false`.
* @property {HTMLDocument} [ownerDocument] - Specify an explicit document
* context to create elements with and to load resources, such as fonts,
* into. Defaults to the current document.
* @property {boolean} [disableRange] - Disable range request loading
* of PDF files. When enabled, and if the server supports partial content
* requests, then the PDF will be fetched in chunks.
@ -271,9 +268,6 @@ function getDocument(src) {
if (typeof params.disableFontFace !== "boolean") {
params.disableFontFace = apiCompatibilityParams.disableFontFace || false;
}
if (typeof params.ownerDocument === "undefined") {
params.ownerDocument = globalThis.document;
}
if (typeof params.disableRange !== "boolean") {
params.disableRange = false;
@ -913,10 +907,9 @@ class PDFDocumentProxy {
* @alias PDFPageProxy
*/
class PDFPageProxy {
constructor(pageIndex, pageInfo, transport, ownerDocument, pdfBug = false) {
constructor(pageIndex, pageInfo, transport, pdfBug = false) {
this._pageIndex = pageIndex;
this._pageInfo = pageInfo;
this._ownerDocument = ownerDocument;
this._transport = transport;
this._stats = pdfBug ? new StatTimer() : null;
this._pdfBug = pdfBug;
@ -1043,9 +1036,7 @@ class PDFPageProxy {
intentState.streamReaderCancelTimeout = null;
}
const canvasFactoryInstance =
canvasFactory ||
new DefaultCanvasFactory({ ownerDocument: this._ownerDocument });
const canvasFactoryInstance = canvasFactory || new DefaultCanvasFactory();
const webGLContext = new WebGLContext({
enable: enableWebGL,
});
@ -1953,7 +1944,6 @@ class WorkerTransport {
this.fontLoader = new FontLoader({
docId: loadingTask.docId,
onUnsupportedFeature: this._onUnsupportedFeature.bind(this),
ownerDocument: params.ownerDocument,
});
this._params = params;
this.CMapReaderFactory = new params.CMapReaderFactory({
@ -2410,7 +2400,6 @@ class WorkerTransport {
pageIndex,
pageInfo,
this,
this._params.ownerDocument,
this._params.pdfBug
);
this.pageCache[pageIndex] = page;