Comment pouvons-nous afficher un PDF en utilisant JavaScript à partir d'un base64 dans Google Chrome? En tant qu'application: PDF, base64: pdfbase64binary ne fonctionne plusBase64 encodé en pdf dans Google chrome?
0
A
Répondre
0
Vous pouvez utiliser un Blob URL
pour représenter le fichier.
fetch(<data URI>)
.then(response => response.blob())
.then(blob => {
// do stuff with `Blob URL`
const blobURL = URL.createObjectURL(blob);
});
Voir Creating a Blob from a base64 string in JavaScript, aussi Base64 PDF in new tab shows Blank Page before Refresh.
0
window.open("data:application/octet-stream;base64," + response)