admin管理员组文章数量:1023848
var docprint = window.open("", "", "toolbar=0,location=0,menubar=0,scrollbars=1");
docprint.document.open();
docprint.document.write("<html><head><title>Title here</title></head>");
docprint.document.write("<body>body content here</body></html>");
docprint.document.close();
docprint.focus();
docprint.print();
This is my javascript code for opening a new window and automatically opening the print dialog. When the user selects the option to print to Adobe PDF from the print dialog, a menu es up with the option to define the pdf filename. In Firefox and Chrome, the pdf filename is set as the title of the page, which is fine. However, in Internet Explorer, the pdf filename is set as the parent window's url basename. How can I set the pdf filename programatically in Internet Explorer?
var docprint = window.open("", "", "toolbar=0,location=0,menubar=0,scrollbars=1");
docprint.document.open();
docprint.document.write("<html><head><title>Title here</title></head>");
docprint.document.write("<body>body content here</body></html>");
docprint.document.close();
docprint.focus();
docprint.print();
This is my javascript code for opening a new window and automatically opening the print dialog. When the user selects the option to print to Adobe PDF from the print dialog, a menu es up with the option to define the pdf filename. In Firefox and Chrome, the pdf filename is set as the title of the page, which is fine. However, in Internet Explorer, the pdf filename is set as the parent window's url basename. How can I set the pdf filename programatically in Internet Explorer?
Share Improve this question edited Dec 15, 2014 at 16:45 Jakal asked Dec 15, 2014 at 16:30 JakalJakal 783 silver badges14 bronze badges 01 Answer
Reset to default 3It seems that unfortunately it can't be done from the browser.
It looks like the file name es from the PDF printer, not the browser, as mented by Teemu on this post: Default File Name when printing from Internet Explorer.
There's a thread opened on the Microsoft's forum about how to set the value to be taken as the default file name on the link below:
https://answers.microsoft./en-us/ie/forum/ie8-windows_xp/filenames-when-printing-to-a-pdf-driver/e5541ba9-d545-e011-9577-d485645a8348
But it applies only to static pages you wanna print by hitting Ctrl + P. As you are dynamically creating a document, it will take the parent's URL as the default file name.
var docprint = window.open("", "", "toolbar=0,location=0,menubar=0,scrollbars=1");
docprint.document.open();
docprint.document.write("<html><head><title>Title here</title></head>");
docprint.document.write("<body>body content here</body></html>");
docprint.document.close();
docprint.focus();
docprint.print();
This is my javascript code for opening a new window and automatically opening the print dialog. When the user selects the option to print to Adobe PDF from the print dialog, a menu es up with the option to define the pdf filename. In Firefox and Chrome, the pdf filename is set as the title of the page, which is fine. However, in Internet Explorer, the pdf filename is set as the parent window's url basename. How can I set the pdf filename programatically in Internet Explorer?
var docprint = window.open("", "", "toolbar=0,location=0,menubar=0,scrollbars=1");
docprint.document.open();
docprint.document.write("<html><head><title>Title here</title></head>");
docprint.document.write("<body>body content here</body></html>");
docprint.document.close();
docprint.focus();
docprint.print();
This is my javascript code for opening a new window and automatically opening the print dialog. When the user selects the option to print to Adobe PDF from the print dialog, a menu es up with the option to define the pdf filename. In Firefox and Chrome, the pdf filename is set as the title of the page, which is fine. However, in Internet Explorer, the pdf filename is set as the parent window's url basename. How can I set the pdf filename programatically in Internet Explorer?
Share Improve this question edited Dec 15, 2014 at 16:45 Jakal asked Dec 15, 2014 at 16:30 JakalJakal 783 silver badges14 bronze badges 01 Answer
Reset to default 3It seems that unfortunately it can't be done from the browser.
It looks like the file name es from the PDF printer, not the browser, as mented by Teemu on this post: Default File Name when printing from Internet Explorer.
There's a thread opened on the Microsoft's forum about how to set the value to be taken as the default file name on the link below:
https://answers.microsoft./en-us/ie/forum/ie8-windows_xp/filenames-when-printing-to-a-pdf-driver/e5541ba9-d545-e011-9577-d485645a8348
But it applies only to static pages you wanna print by hitting Ctrl + P. As you are dynamically creating a document, it will take the parent's URL as the default file name.
本文标签: Setting filename of pdf from javascript print method in Internet Explorer not workingStack Overflow
版权声明:本文标题:Setting filename of pdf from javascript print method in Internet Explorer not working - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745569175a2156632.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论