【发布时间】:2016-10-21 13:15:46
【问题描述】:
我一直在尝试使用 javascript 打印表单 (asp:panel)。但我有 2 个问题。
1) 打印按钮后,我的表单失去了样式。 (它与 aspPanel.InnerHtml 一起提供)
2)我想控制页面大小取决于打印页面。 (如果行不适合页面,则将其传递给其他页面)
我正在发布我的屏幕截图。想法?
function PrintForm()
{
var formpanel = document.getElementById("<%= QuestForm.ClientID%>");
var mainWindow = window.open('', '', 'height=500,width=800');
mainWindow.document.write('<html><head><title>Adapazarı</title>');
mainWindow.document.write('<head/><body>');
mainWindow.document.write(formpanel.innerHTML);
mainWindow.document.write('</body></html>');
mainWindow.document.close();
setTimeout(function () {
mainWindow.print();
}, 500);
return false;
}
【问题讨论】:
标签: javascript html asp.net printing