mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
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:
parent
584fef5823
commit
502a429e3e
1 changed files with 3 additions and 8 deletions
|
@ -190,14 +190,9 @@ class PDFPrintService {
|
|||
useRenderedPage() {
|
||||
this.throwIfInactive();
|
||||
const img = document.createElement("img");
|
||||
const scratchCanvas = this.scratchCanvas;
|
||||
if ("toBlob" in scratchCanvas) {
|
||||
scratchCanvas.toBlob(function (blob) {
|
||||
img.src = URL.createObjectURL(blob);
|
||||
});
|
||||
} else {
|
||||
img.src = scratchCanvas.toDataURL();
|
||||
}
|
||||
this.scratchCanvas.toBlob(blob => {
|
||||
img.src = URL.createObjectURL(blob);
|
||||
});
|
||||
|
||||
const wrapper = document.createElement("div");
|
||||
wrapper.className = "printedPage";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue