Merge pull request #16242 from Snuffleupagus/rm-render-canvasFactory

[api-minor] Remove the `canvasFactory` option from `PDFPageProxy.render` (PR 16100 follow-up)
This commit is contained in:
Tim van der Meij 2023-04-02 13:51:01 +02:00 committed by GitHub
commit be0f6ee080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1202,8 +1202,6 @@ class PDFDocumentProxy {
* The default value is `AnnotationMode.ENABLE`. * The default value is `AnnotationMode.ENABLE`.
* @property {Array<any>} [transform] - Additional transform, applied just * @property {Array<any>} [transform] - Additional transform, applied just
* before viewport transform. * before viewport transform.
* @property {Object} [canvasFactory] - The factory instance that will be used
* when creating canvases. The default value is {new DOMCanvasFactory()}.
* @property {CanvasGradient | CanvasPattern | string} [background] - Background * @property {CanvasGradient | CanvasPattern | string} [background] - Background
* to use for the canvas. * to use for the canvas.
* Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS * Any valid `canvas.fillStyle` can be used: a `DOMString` parsed as CSS
@ -1408,7 +1406,6 @@ class PDFPageProxy {
intent = "display", intent = "display",
annotationMode = AnnotationMode.ENABLE, annotationMode = AnnotationMode.ENABLE,
transform = null, transform = null,
canvasFactory = null,
background = null, background = null,
optionalContentConfigPromise = null, optionalContentConfigPromise = null,
annotationCanvasMap = null, annotationCanvasMap = null,
@ -1417,9 +1414,9 @@ class PDFPageProxy {
}) { }) {
if ( if (
(typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) && (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) &&
canvasFactory arguments[0]?.canvasFactory
) { ) {
deprecated( throw new Error(
"render no longer accepts the `canvasFactory`-option, " + "render no longer accepts the `canvasFactory`-option, " +
"please pass it to the `getDocument`-function instead." "please pass it to the `getDocument`-function instead."
); );
@ -1512,7 +1509,7 @@ class PDFPageProxy {
annotationCanvasMap, annotationCanvasMap,
operatorList: intentState.operatorList, operatorList: intentState.operatorList,
pageIndex: this._pageIndex, pageIndex: this._pageIndex,
canvasFactory: canvasFactory || this._transport.canvasFactory, canvasFactory: this._transport.canvasFactory,
filterFactory: this._transport.filterFactory, filterFactory: this._transport.filterFactory,
useRequestAnimationFrame: !intentPrint, useRequestAnimationFrame: !intentPrint,
pdfBug: this._pdfBug, pdfBug: this._pdfBug,