File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 413413 * Async method using Blob and FileReader could be best, but i'm not sure how to fit it into the flow?
414414 */
415415 jsPDFAPI . arrayBufferToBinaryString = function ( buffer ) {
416+ if ( 'TextDecoder' in window ) {
417+ var decoder = new TextDecoder ( 'ascii' ) ;
418+ return decoder . decode ( buffer ) ;
419+ }
420+
416421 if ( this . isArrayBuffer ( buffer ) )
417422 buffer = new Uint8Array ( buffer ) ;
418423
586591 * to TypedArray - or should we just leave and process as string?
587592 */
588593 if ( this . supportsArrayBuffer ( ) ) {
589- dataAsBinaryString = imageData ;
590- imageData = this . binaryStringToUint8Array ( imageData ) ;
594+ // no need to convert if imageData is already uint8array
595+ if ( ! ( imageData instanceof Uint8Array ) ) {
596+ dataAsBinaryString = imageData ;
597+ imageData = this . binaryStringToUint8Array ( imageData ) ;
598+ }
591599 }
592600
593601 info = this [ 'process' + format . toUpperCase ( ) ] (
You can’t perform that action at this time.
0 commit comments