Hi I have a requirement where I will receive a PDF file from server in BLOB and needs to open it in new tab instead of directly downloading it. So, I have done the below mentioned coding in my angular 8 but the problem is after opening in new tab from there when I am downloading from the browser file name is not coming what I actually sent from the server. But if I download the file directly instead of openning in new tab the file name is coming as desired.
Code to open the file in new tab:
const blob = new Blob([data], { type: "application/pdf" });
const url = window.URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.target = '_blank';
anchor.click();
Thanks in Advance.