Save base64 string as PDF at client side with JavaScript
You can create an anchor like the one showed below to download the base64 pdf:
<a download=pdfTitle href=pdfData title='Download pdf document' />
where pdfData is your base64 encoded pdf like "data:application/pdf;base64,JVBERi0xLjQKJcOkw7zDtsOfCjIgMCBvYmoKPDwvTGVuZ3RoIDMgMCBSL0ZpbHRlci9GbGF0ZURlY29kZT4+CnN0cmVhbQp4nO1cyY4ktxG911fUWUC3kjsTaBTQ1Ytg32QN4IPgk23JMDQ2LB/0+2YsZAQzmZk1PSPIEB..."
you can use this function to download file from base64.
function downloadPDF(pdf) {const linkSource = `data:application/pdf;base64,${pdf}`;const downloadLink = document.createElement("a");const fileName = "abc.pdf";downloadLink.href = linkSource;downloadLink.download = fileName;downloadLink.click();}
This code will made an anchor tag with href and download file. if you want to use button then you can call click method on your button click.
i hope this will help of you thanks
You should be able to download the file using
window.open("data:application/pdf;base64," + Base64.encode(out));