我有下面的图片框,我用条形码填充,然后尝试打印。

这是代码:

private void button1_Click(object sender, EventArgs e)
{

    printDocument1.OriginAtMargins = true;
    printDocument1.DocumentName = "TEST IMAGE PRINTING";

    printDialog1.Document = printDocument1;
    printDialog1.ShowDialog();
    printDocument1.Print();

}


private void printDocument1_PrintPage_1(object sender, PrintPageEventArgs e)
{
    System.Drawing.Graphics formGraphics = System.Drawing.Graphics.FromImage(picpdf417.Image);
}

最佳答案

您需要实际绘制图像:

private void printDocument1_PrintPage_1(object sender, PrintPageEventArgs e)
{
  e.Graphics.DrawImage(picpdf417.Image, Point.Empty);
}

关于C# PrintDocument 打印空白页。为什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15746729/

10-11 12:23