使用Dot Matrix Printer,.NET C#PrintDocument非常慢

时间:2017-07-19 02:23:27

标签: c# .net printing printdocument dot-matrix

我的c#应用程序有问题,因为我需要使用点阵打印机“Olivetti PR2 Plus”使用X和Y位置坐标打印,就像VB6一样。问题是如果字符串的aprox超过20个字符,打印机速度非常慢,我需要快速打印。

我有以下代码用于测试目的并遇到问题。

private void btnPrint_Click(object sender, EventArgs e)
    {
        Document = new PrintDocument();            
        Document.PrintPage += Document_PrintPage;
        Document.PrinterSettings.PrinterName = ((ICollection)PrinterSettings.InstalledPrinters).OfType<string>().Where(p => p.ToUpper().Contains("OLIVETTI")).First().ToString();        
        Document.Print();
    }

private void Document_PrintPage(object sender, PrintPageEventArgs e)
        {
            e.Graphics.DrawString("asdfasdfasdfasdasdffasdfasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 0, new StringFormat());
            e.Graphics.DrawString("asdfasdfasdasdaasdfsdfffasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 10, new StringFormat());
            e.Graphics.DrawString("asdfasdfaasdfsasdfsadfdfasdfasdf", new Font("Consolas", 8), Brushes.Black, 20, 20, new StringFormat());
            e.Graphics.DrawString("asfdasdfsadfasasdfasdfdasdfasdff", new Font("Consolas", 8), Brushes.Black, 20, 30, new StringFormat());
            e.Graphics.DrawString("asfdasdsdafasadfsasdfdasdfasdfff", new Font("Consolas", 8), Brushes.Black, 20, 40, new StringFormat());
            e.Graphics.DrawString("asdfaasdsadfsadffsadfsdassadfdff", new Font("Consolas", 8), Brushes.Black, 20, 50, new StringFormat());
            e.Graphics.DrawString("asfdasdfsdafsadfsadfasasasdfdfdf", new Font("Consolas", 8), Brushes.Black, 20, 60, new StringFormat());
            e.Graphics.DrawString("asdfasadfassadfdfssadfassadfdfdf", new Font("Consolas", 8), Brushes.Black, 20, 70, new StringFormat());
            e.Graphics.DrawString("asfdasadfasadfsdfssadasasdffdfdf", new Font("Consolas", 8), Brushes.Black, 20, 80, new StringFormat());   
        }

我无法在RAW“DOS”模式下打印,因为要打印的数据源具有与纸张格式匹配的特定坐标。 ¿任何提高打印机性能的消化方法?

0 个答案:

没有答案