目前,我正在尝试打印使用具有数百万个数据点的C#/ .NET和GDI +创建的数据图。当文档进入打印机时,打印机说它已成功打印文档并打印0页。该文件永远不会打印出来。以下是我的一些代码:
private void btnPrint_Click(object sender, EventArgs e)
{
if (_config == null)
{
lblStatus.Text = "Error, config is null";
return;
}
_pd = new PrintDocument();
//PaperSize paperSize = new PaperSize("CustomTest", 1000, 100);
//_pd.DefaultPageSettings.PaperSize = paperSize;
_pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0);
// Add event handler
_pd.PrintPage += new PrintPageEventHandler(PrintPage);
_pd.BeginPrint += new PrintEventHandler(BeginPrinting);
// Construct print dialog
PrintDialog pDialog = new PrintDialog();
pDialog.AllowSomePages = true;
pDialog.ShowHelp = true;
pDialog.Document = _pd;
// Ask the user for input
DialogResult result = pDialog.ShowDialog();
// Print if user desires
if (result == DialogResult.OK)
{
_pd.Print();
}
}
有没有人有任何建议? TIA。
答案 0 :(得分:1)
事实证明,公司的打印后台处理程序正在阻碍。解决方案是绕过公司打印系统并通过IP地址添加打印机直接打印到打印机。这是PCL6驱动程序无法正常工作。