Adds SVG rendering capabilities to the PDFViewer.

This commit is contained in:
Yury Delendik 2016-11-18 13:03:49 -06:00
parent c9a0955c9c
commit f7d6f3a739
7 changed files with 100 additions and 7 deletions

View file

@ -102,6 +102,7 @@ var getGlobalEventBus = domEventsLib.getGlobalEventBus;
var normalizeWheelEventDelta = uiUtilsLib.normalizeWheelEventDelta;
var animationStarted = uiUtilsLib.animationStarted;
var localized = uiUtilsLib.localized;
var RendererType = uiUtilsLib.RendererType;
var DEFAULT_SCALE_DELTA = 1.1;
var DISABLE_AUTO_FETCH_LOADING_BAR_TIMEOUT = 5000;
@ -383,6 +384,12 @@ var PDFViewerApplication = {
}
PDFJS.externalLinkTarget = value;
}),
Preferences.get('renderer').then(function resolved(value) {
// TODO: Like the `enhanceTextSelection` preference, move the
// initialization and fetching of `Preferences` to occur
// before the various viewer components are initialized.
self.pdfViewer.renderer = value;
}),
Preferences.get('renderInteractiveForms').then(function resolved(value) {
// TODO: Like the `enhanceTextSelection` preference, move the
// initialization and fetching of `Preferences` to occur
@ -1140,7 +1147,11 @@ var PDFViewerApplication = {
}
this.pdfViewer.cleanup();
this.pdfThumbnailViewer.cleanup();
this.pdfDocument.cleanup();
// We don't want to remove fonts used by active page SVGs.
if (this.pdfViewer.renderer !== RendererType.SVG) {
this.pdfDocument.cleanup();
}
},
forceRendering: function pdfViewForceRendering() {