Save WinForm to PDF & print multipage WinForm [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this questio开发者_开发知识库nHow can I save multipage WinForm to PDF & how can I print it?
thanks, Ofir
A good framework is pdfSharp.
You can capture the form (there are few ways of doing it, this is one sample). Than write the image stream a pdf object (you can find many samples for this in the pdfSharp web site).
You can use paint method to capture the entire client area of your Form and then use the Print method to print them.
Graphics myGraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
then use PrintDocument class to print it.
精彩评论