I'm calling a web service to generate a .pdf, then using createObjectURL and and iframe to print and display it:
var title = Claim- + this.claimNumber + - + new Date() + .pdf;
var blob = new Blob([wsRequest.response], { type: 'application/pdf' });
blob.name = title;
if (browser() === 'IE') {
window.navigator.msSaveOrOpenBlob(blob, title);
} else {
var fileURL = URL.createObjectURL(blob);
var win = window.open();
win.document.write('<iframe name=' + title + ' src=' + fileURL + ' frameborder=0 style=border:0; top:0px; left:0px; bottom:0px; right:0px; width:100%; height:100%; allowfullscreen></iframe>');
win.document.title = title;
For IE, it works great: the .pdf comes up in Acrobat Reader, it displays, I can print it ... and it has a meaningful filename.
For Chrome/embedded .pdf viewer, it also works OK: it comes up in it's own tab, and the tab has a meaningful filename.
If Chrome brings up the image in Acrobat reader, however:
a) I get a new, blank tab (with the meaningful name)
b) Acrobat displays a GUID - the GUID assigned by createObjectURL():
EXAMPLE: blob:http://192.168.116.170:9080/dd554e89-0174-4b9a-bbd1-0934239a4c9
As you can see, neither blob.name = title
or <iframe name= + title + ...>
seem to help.
Q: Is there any way I can assign a meaningful name to a dynamically generated .pdf if Chrome opens it in an external viewer (like Acrobat)?