如何在A4纸上打印大尺寸的图像c#

问题描述 投票:1回答:1

我想在当前代码中以大尺寸从图片框打印图像,以原始尺寸打印图像,我尝试了以下代码:

private void btnID_Click(object sender, EventArgs e)
        {
            PrintDialog pd = new PrintDialog();
            PrintDocument pdoc = new PrintDocument();
            pdoc.PrintPage += doc_printID;
            pd.Document = pdoc;
            if (pd.ShowDialog() == DialogResult.OK)
                pdoc.Print();


        }

        private void doc_printID(object sender, PrintPageEventArgs e)
        {
            Bitmap bm = new Bitmap(pictureIDIQAMA.Width, pictureIDIQAMA.Height);
            pictureIDIQAMA.DrawToBitmap(bm, new Rectangle(0, 0, pictureIDIQAMA.Width, pictureIDIQAMA.Height));
            e.Graphics.DrawImage(bm, 200,400);
            bm.Dispose();
        }

如何以两倍的原始尺寸打印更大尺寸的图像?

c# .net picturebox
1个回答
1
投票

绘制页面边缘的图像

e.Graphics.DrawImage(bm, args.MarginBounds);

在整个页面上绘制图像

e.Graphics.DrawImage(bm, args.PageBounds);

© www.soinside.com 2019 - 2024. All rights reserved.