Skip to content

Commit 760c8d6

Browse files
authored
Mark canvasContext as optional
In #20016, the `canvasContext` property of `RenderParameters` was deprecated in favor of the new `canvas` property. The JSDoc was updated to include the new parameter along with the old one. I think the old one should be enclosed in `[]` to mark it as optional (and to allow usage from TypeScript with just the `canvas` parameter provided). I also reordered the properties so that all required properties come first, follow by optional ones.
1 parent fcf69d8 commit 760c8d6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/display/api.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,16 +1182,16 @@ class PDFDocumentProxy {
11821182
* Page render parameters.
11831183
*
11841184
* @typedef {Object} RenderParameters
1185-
* @property {CanvasRenderingContext2D} canvasContext - 2D context of a DOM
1186-
* Canvas object for backwards compatibility; it is recommended to use the
1187-
* `canvas` parameter instead.
1188-
* If the context must absolutely be used to render the page, the canvas must
1189-
* be null.
11901185
* @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default
11911186
* value is the canvas associated with the `canvasContext` parameter if no
11921187
* value is provided explicitly.
11931188
* @property {PageViewport} viewport - Rendering viewport obtained by calling
11941189
* the `PDFPageProxy.getViewport` method.
1190+
* @property {CanvasRenderingContext2D} [canvasContext] - 2D context of a DOM
1191+
* Canvas object for backwards compatibility; it is recommended to use the
1192+
* `canvas` parameter instead.
1193+
* If the context must absolutely be used to render the page, the canvas must
1194+
* be null.
11951195
* @property {string} [intent] - Rendering intent, can be 'display', 'print',
11961196
* or 'any'. The default value is 'display'.
11971197
* @property {number} [annotationMode] Controls which annotations are rendered

0 commit comments

Comments
 (0)