Doubt on pdf download

Hello @navaneethck_10 , If you have the buffer, you can pass it to the frontend and convert it into a Blob.

example
// Suppose pdfBuffer is your buffer (ArrayBuffer or Uint8Array)
const downloadPDF = (pdfBuffer) => {
// Convert buffer to Blob
const blob = new Blob([pdfBuffer], { type: “application/pdf” });

// Create a download link
const url = window.URL.createObjectURL(blob);
const a = document.createElement(“a”);
a.href = url;
a.download = “document.pdf”; // file name
document.body.appendChild(a);
a.click();

// Cleanup
a.remove();
window.URL.revokeObjectURL(url);
};

1 Like