开发者

How Can i Print Array of Images in Winform App in c#

开发者 https://www.devze.com 2023-02-02 23:47 出处:网络
hi i have a win form app in c# that in this for开发者_JAVA百科m i have 3 image and a label. i want to prite these objects into a pdf file.

hi i have a win form app in c# that in this for开发者_JAVA百科m i have 3 image and a label. i want to prite these objects into a pdf file. please help me


This is how I would do this:

  1. Generate a bitmap from the WinForm control (using Control.DrawToBitmap). You can wrap your images/buttons into the Panel control and generate the bitmap from that panel.
  2. Use any PDF library to generate PDF document based on the bitmap.

For example, that't how to create PDF document from the bitmap using ABCpdf:

WebSupergoo.ABCpdf7.Doc doc = new WebSupergoo.ABCpdf7.Doc();

doc.SetInfo(0, "License", "[your license code || trial license"]);    
doc.Page = doc.AddPage();

doc.AddImageBitmap(myPanel.DrawToBitmap(), false);

doc.PageNumber = 1;
doc.Flatten();

doc.Save("myfile.pdf");

-- Pavel

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号