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:
commit
228adbf673
3 changed files with 92 additions and 100 deletions
13
web/app.js
13
web/app.js
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue