I have problem with converting base64 pdf document into URL.
Here is code:
if (pdfDocumentBase64) {
const binary = atob(pdfDocumentBase64.replace(/s/g, ''));
const len = binary.length;
const buffer = new ArrayBuffer(len);
var view = new Uint8Array(buffer);
for (var i = 0; i < len; i++) {
view[i] = binary.charCodeAt(i);
}
const blob = new Blob([view], { type: "application/pdf" });
url = URL.createObjectURL(blob);
}
console.log(url);
And here is result:
blob:null/34277b46-7323-4007-b87e-b130478c36ff
What I’m doing wrong?