如何在C#中打印大图像?

时间:2012-05-02 20:28:25

标签: c# image printing

目前我正在使用以下代码打印图像:

private void button9_Click(object sender, EventArgs e)
{
    PrintDocument pd = new PrintDocument();
    printpath = "C:\\temp.bmp";
    pd.PrintPage += new PrintPageEventHandler(Print_Page);

    PrintPreviewDialog dlg = new PrintPreviewDialog();
    dlg.Document = pd;
    dlg.ShowDialog();
    pd.Print();
}

private void Print_Page(object o, PrintPageEventArgs e)
{
   Image i = Image.FromFile(printpath);
   Point p = new Point(0, 0);
   e.Graphics.DrawImage(i, p);
}

但如果图像的高度太大,则不适合页面。我想将图像分割成高度为1125像素的碎片,然后在打印预览中的多个页面上显示它们。我该怎么做呢?谢谢!

0 个答案:

没有答案