[英]JavaScript: Method forEach not supported from Internet Explorer
[英]Setting filename of pdf from javascript print method in Internet Explorer not working
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();
這是我的javascript代碼,用於打開一個新窗口並自動打開打印對話框。 當用戶從打印對話框中選擇要打印到Adobe PDF的選項時,會出現一個菜單,其中包含用於定義pdf文件名的選項。 在Firefox和Chrome中,pdf文件名設置為頁面標題,這很好。 但是,在Internet Explorer中,pdf文件名設置為父窗口的url basename。 如何在Internet Explorer中以編程方式設置pdf文件名?
似乎不幸的是,它無法通過瀏覽器完成。
看起來文件名來自PDF打印機,而不是瀏覽器,Teemu在這篇文章中評論過: 從Internet Explorer打印時的默認文件名 。
在微軟的論壇上有一個關於如何在下面的鏈接上設置值作為默認文件名的線程:
但它僅適用於您想要通過按Ctrl + P打印的靜態頁面。當您動態創建文檔時,它將把父級的URL作為默認文件名。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.