File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5105,9 +5105,9 @@ class StampAnnotation extends MarkupAnnotation {
51055105 ctx . drawImage ( bitmap , 0 , 0 ) ;
51065106 }
51075107
5108- const jpegBufferPromise = canvas
5108+ const jpegBytesPromise = canvas
51095109 . convertToBlob ( { type : "image/jpeg" , quality : 1 } )
5110- . then ( blob => blob . arrayBuffer ( ) ) ;
5110+ . then ( blob => blob . bytes ( ) ) ;
51115111
51125112 const xobjectName = Name . get ( "XObject" ) ;
51135113 const imageName = Name . get ( "Image" ) ;
@@ -5144,7 +5144,7 @@ class StampAnnotation extends MarkupAnnotation {
51445144
51455145 smaskStream = new Stream ( alphaBuffer , 0 , 0 , smask ) ;
51465146 }
5147- const imageStream = new Stream ( await jpegBufferPromise , 0 , 0 , image ) ;
5147+ const imageStream = new Stream ( await jpegBytesPromise , 0 , 0 , image ) ;
51485148
51495149 return {
51505150 imageStream,
Original file line number Diff line number Diff line change @@ -1259,6 +1259,17 @@ if (
12591259 } ;
12601260}
12611261
1262+ // See https://developer.mozilla.org/en-US/docs/Web/API/Blob/bytes#browser_compatibility
1263+ if (
1264+ typeof PDFJSDev !== "undefined" &&
1265+ ! PDFJSDev . test ( "SKIP_BABEL" ) &&
1266+ typeof Blob . prototype . bytes !== "function"
1267+ ) {
1268+ Blob . prototype . bytes = async function ( ) {
1269+ return new Uint8Array ( await this . arrayBuffer ( ) ) ;
1270+ } ;
1271+ }
1272+
12621273// See https://developer.mozilla.org/en-US/docs/Web/API/Response/bytes#browser_compatibility
12631274if (
12641275 typeof PDFJSDev !== "undefined" &&
You can’t perform that action at this time.
0 commit comments