我正在嘗試使用打印新打開的窗口。window.print()我的問題是,只打印頁面的起始部分(只有當您滾動到窗口左上角時看到的內容)。這是我的代碼:var printWindow = window.open("", "Print", "width=" + nWidth + "px, height=" + nHeight+ "px");printWindow.document.write(sSvgData, sDivData);printWindow.document.close();printWindow.print();我已經嘗試過的解決方案,但對我不起作用:1)將整個html寫入文檔(使用),并將my包含在標題中window.document.write()css<html><head><link rel="stylesheet" href="../css/style.css" type="text/css" media="print"/></head> <body>...style.css:@media print { body, html, div, #wrapper { height: 100%; width: 100%; }}2) 與 1) 相同,但包括內聯樣式,如:<html><style>@media print { body, html, #wrapper { height: 100%; width: 100%;} }</style><body>...
window.print() 不打印整個頁面
qq_遁去的一_1
2022-09-02 10:14:57