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

Merge pull request #13172 from Snuffleupagus/cleanup-keepFonts

[api-minor] Add an option, in `PDFDocumentProxy.cleanup`, to allow fonts to remain attached to the DOM
This commit is contained in:
Tim van der Meij 2021-04-05 14:21:34 +02:00 committed by GitHub
commit 228adbf673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 92 additions and 100 deletions

View file

@ -465,7 +465,7 @@ const PDFViewerApplication = {
this.overlayManager = new OverlayManager();
const pdfRenderingQueue = new PDFRenderingQueue();
pdfRenderingQueue.onIdle = this.cleanup.bind(this);
pdfRenderingQueue.onIdle = this._cleanup.bind(this);
this.pdfRenderingQueue = pdfRenderingQueue;
const pdfLinkService = new PDFLinkService({
@ -1782,7 +1782,10 @@ const PDFViewerApplication = {
}
},
cleanup() {
/**
* @private
*/
_cleanup() {
if (!this.pdfDocument) {
return; // run cleanup when document is loaded
}
@ -1790,9 +1793,9 @@ const PDFViewerApplication = {
this.pdfThumbnailViewer.cleanup();
// We don't want to remove fonts used by active page SVGs.
if (this.pdfViewer.renderer !== RendererType.SVG) {
this.pdfDocument.cleanup();
}
this.pdfDocument.cleanup(
/* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG
);
},
forceRendering() {