Garrett
Committed by David PHAM-VAN

Cleans up each page after use

@@ -313,7 +313,7 @@ class PrintingPlugin extends PrintingPlatform { @@ -313,7 +313,7 @@ class PrintingPlugin extends PrintingPlatform {
313 ..viewport = viewport; 313 ..viewport = viewport;
314 314
315 await promiseToFuture<void>(page.render(renderContext).promise); 315 await promiseToFuture<void>(page.render(renderContext).promise);
316 - 316 +
317 // Convert the image to PNG 317 // Convert the image to PNG
318 final completer = Completer<void>(); 318 final completer = Completer<void>();
319 final blob = await canvas.toBlob(); 319 final blob = await canvas.toBlob();
@@ -333,6 +333,7 @@ class PrintingPlugin extends PrintingPlatform { @@ -333,6 +333,7 @@ class PrintingPlugin extends PrintingPlatform {
333 canvas.height!, 333 canvas.height!,
334 data.toBytes(), 334 data.toBytes(),
335 ); 335 );
  336 + page.cleanup();
336 } 337 }
337 t.destroy(); 338 t.destroy();
338 } 339 }
@@ -58,6 +58,7 @@ class PdfJsDoc { @@ -58,6 +58,7 @@ class PdfJsDoc {
58 class PdfJsPage { 58 class PdfJsPage {
59 external PdfJsViewport getViewport(Settings data); 59 external PdfJsViewport getViewport(Settings data);
60 external PdfJsRender render(Settings data); 60 external PdfJsRender render(Settings data);
  61 + external bool cleanup();
61 } 62 }
62 63
63 @anonymous 64 @anonymous