如何从c#打印点阵字体的文本

本文关键字:字体 文本 打印 | 更新日期: 2023-09-27 18:21:53

这段代码工作得很好,但代码以简单字体打印文本,但我想以点阵字体打印,有代码以点阵打印吗?

try
  {
 PrintDocument pd = new PrintDocument();
 pd.DefaultPageSettings.PaperSize = new PaperSize("A4", 827, 1170);
 pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
 pd.Print();
}
catch (Exception ex)
  {
MessageBox.Show("پیج کو پرنٹ کرتےوقت ایرر آگیا", ex.ToString());
}
private void pd_PrintPage(object sender, PrintPageEventArgs e)
   {
    e.Graphics.DrawString(textBox1.Text.ToString(), new Font("BroadWay", 18,   
    FontStyle.Bold), Brushes.Black, 14,95);
    e.Graphics.DrawString(textBox2.Text.ToString(), new Font("BroadWay", 18,   FontStyle.Bold), Brushes.Black, 12, 165);
    e.Graphics.DrawString(textBox3.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 12, 265);
    e.Graphics.DrawString(textBox4.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 346, 96);
    e.Graphics.DrawString(textBox5.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 165);
    e.Graphics.DrawString(textBox6.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 229);
    e.Graphics.DrawString(textBox7.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 285, 287);
    e.Graphics.DrawString(textBox8.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 146, 326);
    e.Graphics.DrawString(textBox9.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 742, 96);
    e.Graphics.DrawString(textBox10.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 144);
    e.Graphics.DrawString(textBox11.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 215);
    e.Graphics.DrawString(textBox12.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 634, 266);
    e.Graphics.DrawString(textBox13.Text.ToString(), new Font("BroadWay", 18, FontStyle.Bold), Brushes.Black, 238, 382);
    e.Graphics.DrawString(textBox14.Text.ToString(), new Font("BroadWay", 12, FontStyle.Regular), Brushes.Black, 388, 421);
    }

代码运行良好,但我现在只想用点阵字体打印它尚未完成。我希望你们中的一个能帮助我我的打印机是LX-300+II冲击式打印机我不知道现在该怎么办!

如何从c#打印点阵字体的文本

我对阿拉伯语(或其他语言)没有任何经验,但只需将字体设置为"Courier New"通常就能解决这个问题。您可能需要将文本编码从unicode转换为ansi。