如何将Windows窗体C#面板转换为pdf或高分辨率图像? [英] how to convert windows form C# panel into pdf or high resolution image?

查看:114
本文介绍了如何将Windows窗体C#面板转换为pdf或高分辨率图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bitmap panelImage = new Bitmap(Finish.Width, Finish.Height);
                panelImage.SetResolution(300, 300);

                Graphics g = Graphics.FromImage((Image)panelImage);
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;

                Finish.DrawToBitmap(panelImage, Finish.ClientRectangle);

                g.DrawImage(panelImage, 0, 0, Finish.Width, Finish.Height);
                g.Dispose();
                panelImage.SetResolution(600, 600);
                panelImage.Save("c:\\cmbtosingporeFinish3.tiff", ImageFormat.Tiff);





此代码将c sharp form面板转换为tiff图像。但它没有最高质量。这也没关系,如果我得到一个分辨率最高的图像。



但如果我可以直接将c#panel转换成pdf。它会更优选。



请帮我解决这个问题。



This code converts c sharp form panel into tiff image. but its not in maximum quality. this also okay, if i get an image with maximum resolution.

but if i can convert c# panel into pdf directly. it will be more preferable.

please help me to sort this out.

推荐答案

使用 PDFSharp 来创建PDF文档。你的代码是否正常工作?然后,您可以使用PDFSharp中的XGraphics类将图像添加到PDF文档中。我不知道PDFSharp是否支持TIFF文件。但您可以尝试任何其他格式。
Use PDFSharp to create PDF documents. Does your code work correctly? Then you can add the image to the PDF document by using XGraphics class in PDFSharp. I don't know whether PDFSharp supports TIFF Files. But you can try any other format.


这篇关于如何将Windows窗体C#面板转换为pdf或高分辨率图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆