2

I have a form with some comboboxes, a datagrid and an image. My ultimate goal here is: When the user clicks the save button on a menustrip, it will send this data to a printer (preferably to a PDF one) and print the file ready to be mailed to our clients. I tried the code provided by:

http://msdn.microsoft.com/en-us/library/aa287529%28VS.71%29.aspx

But it sent me to OneNote which then showed me an empty file. I also tried Printform and PrintDialog which didn't bring me much luck either. Any suggestions?

edit: I configured it to print to pdf although it now prints only half the form (cuts it in half of width), and if the datagrid is Scrollable it only prints the data that is showing on the screen. Like this: enter image description here

Defius
  • 39
  • 4
  • possible duplicate of [Printing a scroll-able windows form.](http://stackoverflow.com/questions/14103832/printing-a-scroll-able-windows-form), [How can I take a screenshot of a Winforms control/form in C#?](http://stackoverflow.com/questions/1493591/how-can-i-take-a-screenshot-of-a-winforms-control-form-in-c), and [Printing scrollable form](http://stackoverflow.com/questions/15275563/printing-scrollable-form) – Cody Gray - on strike May 05 '14 at 10:14
  • I'll workaround it. will use The posted solution instead of printing it. – Defius May 05 '14 at 10:21
  • 2
    @CodyGray may be this question is duplicate of ur given link but, answer can be different than dupe question. – Shell May 05 '14 at 10:23
  • 1
    Defius, just in case, [pt.so] ;) – brasofilo May 08 '14 at 15:45

1 Answers1

2

You cannot print scrolled data using graphics object. even you cannot create your own design using graphics object. Also, you will get some problem in creating PDF and managing multiple pages. So, don't make it more complicated just use reporting library. You have two choices to print form data into pdf file.

  1. Microsoft Reporinting
  2. Crystal Report

    But, I would like to prefer to use Crystal Report to Print any document. It is more flexible than Microsoft Reporting. You can export that document into PDF, WORD, EXCEL or Direct to Printer.

Shell
  • 6,818
  • 11
  • 39
  • 70