Merge pull request #15173 from Snuffleupagus/deprecated-svg
[api-minor] Deprecate the SVG back-end
This commit is contained in:
commit
5bfba89b0a
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
/* globals __non_webpack_require__ */
|
/* globals __non_webpack_require__ */
|
||||||
|
|
||||||
|
import { deprecated, DOMSVGFactory } from "./display_utils.js";
|
||||||
import {
|
import {
|
||||||
FONT_IDENTITY_MATRIX,
|
FONT_IDENTITY_MATRIX,
|
||||||
IDENTITY_MATRIX,
|
IDENTITY_MATRIX,
|
||||||
@ -24,7 +25,6 @@ import {
|
|||||||
Util,
|
Util,
|
||||||
warn,
|
warn,
|
||||||
} from "../shared/util.js";
|
} from "../shared/util.js";
|
||||||
import { DOMSVGFactory } from "./display_utils.js";
|
|
||||||
import { isNodeJS } from "../shared/is_node.js";
|
import { isNodeJS } from "../shared/is_node.js";
|
||||||
|
|
||||||
/** @type {any} */
|
/** @type {any} */
|
||||||
@ -467,6 +467,9 @@ if (
|
|||||||
|
|
||||||
SVGGraphics = class {
|
SVGGraphics = class {
|
||||||
constructor(commonObjs, objs, forceDataSchema = false) {
|
constructor(commonObjs, objs, forceDataSchema = false) {
|
||||||
|
deprecated(
|
||||||
|
"The SVG back-end is no longer maintained and *may* be removed in the future."
|
||||||
|
);
|
||||||
this.svgFactory = new DOMSVGFactory();
|
this.svgFactory = new DOMSVGFactory();
|
||||||
|
|
||||||
this.current = new SVGExtraState();
|
this.current = new SVGExtraState();
|
||||||
|
15
web/app.js
15
web/app.js
@ -1795,10 +1795,17 @@ const PDFViewerApplication = {
|
|||||||
this.pdfViewer.cleanup();
|
this.pdfViewer.cleanup();
|
||||||
this.pdfThumbnailViewer.cleanup();
|
this.pdfThumbnailViewer.cleanup();
|
||||||
|
|
||||||
// We don't want to remove fonts used by active page SVGs.
|
if (
|
||||||
this.pdfDocument.cleanup(
|
typeof PDFJSDev === "undefined" ||
|
||||||
/* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG
|
PDFJSDev.test("!PRODUCTION || GENERIC")
|
||||||
);
|
) {
|
||||||
|
// We don't want to remove fonts used by active page SVGs.
|
||||||
|
this.pdfDocument.cleanup(
|
||||||
|
/* keepLoadedFonts = */ this.pdfViewer.renderer === RendererType.SVG
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.pdfDocument.cleanup();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
forceRendering() {
|
forceRendering() {
|
||||||
|
@ -344,7 +344,11 @@ class PDFPageView {
|
|||||||
}
|
}
|
||||||
this._resetZoomLayer();
|
this._resetZoomLayer();
|
||||||
}
|
}
|
||||||
if (this.svg) {
|
if (
|
||||||
|
(typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
|
this.svg
|
||||||
|
) {
|
||||||
this.paintedViewportMap.delete(this.svg);
|
this.paintedViewportMap.delete(this.svg);
|
||||||
delete this.svg;
|
delete this.svg;
|
||||||
}
|
}
|
||||||
@ -380,7 +384,11 @@ class PDFPageView {
|
|||||||
docStyle.setProperty("--scale-factor", this.viewport.scale);
|
docStyle.setProperty("--scale-factor", this.viewport.scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.svg) {
|
if (
|
||||||
|
(typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
|
this.svg
|
||||||
|
) {
|
||||||
this.cssTransform({
|
this.cssTransform({
|
||||||
target: this.svg,
|
target: this.svg,
|
||||||
redrawAnnotationLayer: true,
|
redrawAnnotationLayer: true,
|
||||||
@ -733,6 +741,8 @@ class PDFPageView {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const paintTask =
|
const paintTask =
|
||||||
|
(typeof PDFJSDev === "undefined" ||
|
||||||
|
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
|
||||||
this.renderer === RendererType.SVG
|
this.renderer === RendererType.SVG
|
||||||
? this.paintOnSvg(canvasWrapper)
|
? this.paintOnSvg(canvasWrapper)
|
||||||
: this.paintOnCanvas(canvasWrapper);
|
: this.paintOnCanvas(canvasWrapper);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user