点阵打印机中的C#打印 [英] C# printing in dot matrix printer
本文介绍了点阵打印机中的C#打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是关于c#中的点阵打印:
问题描述: -
报告标题将为粗体,报告标题将重复如果没有可打印的内容,所有pages.page将滚动
到新页面。
我尝试了什么:
This is regarding dot matrix printing in c#:
Problem description :-
Report Title would be bold, Report title will repeat all the pages.page will scroll
to new page if there is no printable content.
What I have tried:
public void ReadFile()
{
documentContents = File.ReadAllText(FilePath);
stringToPrint = documentContents;
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int charactersOnPage = 0;
int linesPerPage = 0;
e.Graphics.MeasureString(stringToPrint, this.Font,
e.MarginBounds.Size, StringFormat.GenericTypographic,
out charactersOnPage, out linesPerPage);
e.Graphics.DrawString(stringToPrint, this.Font, Brushes.Black,
110,10);
stringToPrint = stringToPrint.Substring(charactersOnPage);
e.HasMorePages = (stringToPrint.Length > 0);
if (!e.HasMorePages)
stringToPrint = documentContents;
}
private void btnPreview_Click(object sender, EventArgs e)
{
ReadFile();
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
}
推荐答案
试试以下网址,可能会对你有帮助 -
https://whitefiles.org/b1_s/1_free_guides/fg2cd/pgs/c03c_prntr_cds.htm
http://stanislavs.org/helppc/epson_printer_codes.html
https://en.wikipedia.org/wiki/ESC/P
https://www.codeproject.com/Articles/29709/Line-Printer-Class-in-C
https://www.codeproject.com/Articles/29709/Line-Printer-Class-in-C
Try these following urls, may be help you-
https://whitefiles.org/b1_s/1_free_guides/fg2cd/pgs/c03c_prntr_cds.htm
http://stanislavs.org/helppc/epson_printer_codes.html
https://en.wikipedia.org/wiki/ESC/P
https://www.codeproject.com/Articles/29709/Line-Printer-Class-in-C
https://www.codeproject.com/Articles/29709/Line-Printer-Class-in-C
这篇关于点阵打印机中的C#打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文