Use HTMLCanvasElement.toBlob() unconditionally in PDFPrintService

The fallback is very old code, and according to the MDN compatibility data `HTMLCanvasElement.toBlob()` should be available in all browsers that we support now: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#browser_compatibility
This commit is contained in:
Jonas Jenwald 2024-08-23 13:39:32 +02:00
parent 584fef5823
commit 502a429e3e

View file

@ -190,14 +190,9 @@ class PDFPrintService {
useRenderedPage() { useRenderedPage() {
this.throwIfInactive(); this.throwIfInactive();
const img = document.createElement("img"); const img = document.createElement("img");
const scratchCanvas = this.scratchCanvas; this.scratchCanvas.toBlob(blob => {
if ("toBlob" in scratchCanvas) { img.src = URL.createObjectURL(blob);
scratchCanvas.toBlob(function (blob) { });
img.src = URL.createObjectURL(blob);
});
} else {
img.src = scratchCanvas.toDataURL();
}
const wrapper = document.createElement("div"); const wrapper = document.createElement("div");
wrapper.className = "printedPage"; wrapper.className = "printedPage";