crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

Fix Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded. #639

Closed 24min closed 1 year ago

24min commented 2 years ago

privt-js version:1.6.0

//pdf base64 value start with data:application/pdf;base64,
const pdfBase64 = `data:application/pdf;base64,xxxxxxxxx`;

 printJS({
               printable: pdfBase64,
               base64: true,
            })

The above code causes the error Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.

Beacuse atob function canβ€˜t transfer the symbol(,)

So we should remove this symbol.

----------------🎈🎈🎈-----------------

The following file is a pdf base64 string start with data:application/pdf;base64,

base64WithHeader.txt