Skip to content

Commit

Permalink
Cleans up each page after use
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettApproachableGeek authored and DavBfr committed May 19, 2022
1 parent c0ea0ed commit b3fdd39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion printing/lib/printing_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class PrintingPlugin extends PrintingPlatform {
..viewport = viewport;

await promiseToFuture<void>(page.render(renderContext).promise);

// Convert the image to PNG
final completer = Completer<void>();
final blob = await canvas.toBlob();
Expand All @@ -333,6 +333,7 @@ class PrintingPlugin extends PrintingPlatform {
canvas.height!,
data.toBytes(),
);
page.cleanup();
}
t.destroy();
}
Expand Down
1 change: 1 addition & 0 deletions printing/lib/src/pdfjs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class PdfJsDoc {
class PdfJsPage {
external PdfJsViewport getViewport(Settings data);
external PdfJsRender render(Settings data);
external bool cleanup();
}

@anonymous
Expand Down

0 comments on commit b3fdd39

Please sign in to comment.