From 9cdc7b204521f45b49b990728008c674752693a7 Mon Sep 17 00:00:00 2001 From: Vishwas R Date: Tue, 27 Jun 2023 11:27:43 +0530 Subject: [PATCH] Fix for "Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true" warning in chrome browser --- src/dom/document-cloner.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dom/document-cloner.ts b/src/dom/document-cloner.ts index 08faa29..a246fc7 100644 --- a/src/dom/document-cloner.ts +++ b/src/dom/document-cloner.ts @@ -220,7 +220,7 @@ export class DocumentCloner { clonedCanvas.width = canvas.width; clonedCanvas.height = canvas.height; const ctx = canvas.getContext('2d'); - const clonedCtx = clonedCanvas.getContext('2d'); + const clonedCtx = clonedCanvas.getContext('2d', { willReadFrequently: true }); if (clonedCtx) { if (!this.options.allowTaint && ctx) { clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0);