Working with PDF files in SFCC
Salesforce commerce cloud
const downloadPdf = async () => {
const response = await fetchPdf();
response.blob().then((blob) => {
const fileURL = window.URL.createObjectURL(blob);
const alink = document.createElement('a');
alink.href = fileURL;
// The line below actually downloads the PDF with the desired file name
alink.download = 'filename.pdf';
alink.click();
});
}
)



