How to download a pdf with specific file name from a blob url


const b64toBlob = (b64Data, extension) => {

  const byteCharacters = atob(b64Data);

  const len = byteCharacters.length;

  const buffer = new Uint8Array(len);

  for (let i = 0; i < len; i += 1) {

    buffer[i] = byteCharacters.charCodeAt(i);

  }

  return new Blob([buffer], { type: `application/${extension}` });

};

 const blob = b64toBlob(base64Content, extension);

const url = URL.createObjectURL(blob);
window.open(url, '_blank');

This is how I open the pdf in a new window, and when I try to save this pdf it’s showing a random filename, I need to save it with a specific filename.

Is there any way to download the pdf with the actual filename.