0

I'm amazed how difficult this seems to be. I 'just' want to print my form (it's an invoice), and ensure it prints the whole form (not just what is displayed on the screen)? I can alter anything I want on the form itself..so how do I set it all up so it prints perfectly to a standard letter sized sheet of paper, and doesn't let the user resize it, etc etc. They should see it just like it will print.. maybe they can zoom in and out, but no re-sizing, etc.

I thought a reportviewer control would be handy in order to handle all the printing and sizing stuff.. but that control doesn't seem to lend itself to a single record display. (maybe have a Header as the entire report! seems crazy)

so unless i'm wrong, maybe someone can just give me all the properties to set, etc, in order to make a regular form statically sized for a standard sheet of paper (8.5 x 11)? And then show me the way to print the entire thing rather then just a 'printscreen'.

I've read a bunch of ideas for using 'printscreen' and using GDI+ (i didn't fully understand how I could use that).. nothing seems to be standing out for me.

da Bich
  • 494
  • 1
  • 4
  • 13
  • It's not an answer, but that's why pdf is used. It gives perfection to generate a printer-specific designed document. I recommend you to use one of pdf writer in .Net library. I'm using Telerik solution http://www.telerik.com/products/winforms/pdfprocessing.aspx and other related stuffs introduced at http://stackoverflow.com/a/7601932/361100 – Youngjae Mar 01 '15 at 05:59
  • You print just like you draw: Using a e.Graphic object in the PrintPage event. You choose and set the resolution (at least 150dpi) and then you add stuff to the page until you are happy. As long as you only print one page order doesn't matter much (ecept for overlapping parts) and you freely mix bitmaps (of the right dpi!) lines etc. with text in any font and pen/brush.. See [here for an example!](http://stackoverflow.com/questions/28560319/generate-staff-card/28580657#28580657) – TaW Mar 01 '15 at 19:12
  • You print just like you draw: Using a e.Graphic object in the PrintPage event. You set the resolution (at least 150dpi) and then you add stuff to the page. As long as you only print one page order doesn't matter much (except for overlapping parts) and you can freely mix bitmaps (of the right dpi!) lines etc. with text in any font and pen/brush.. – TaW Mar 01 '15 at 19:18
  • See [here for an example!](http://stackoverflow.com/questions/28560319/generate-staff-card/28580657#28580657) that builds a printable bitmap. See [here](http://stackoverflow.com/questions/27448856/how-to-print-the-values-of-datagridview-in-c/27453694?s=4|0.8809#27453694) for one using the PrintPage event.. – TaW Mar 01 '15 at 19:19
  • by " you add stuff to the page" you mean programmatically building the entire output? I'm not a fan of that, and would prefer to use a designer UI. (I'd hate to maintain code that builds an entire UI / report type screen). – da Bich Mar 02 '15 at 02:50

1 Answers1

0

I'd recommend the report viewer and rdlc report. You can use it just fine for only one record, and you can include a subreport for the invoices line items. No need to have everything in the header.

Andy
  • 8,432
  • 6
  • 38
  • 76
  • I have no line items (it's just a couple fields on the dataset really). So how do you work it? I can't even figure out how to display just a simple single value field in the report main section.. – da Bich Mar 02 '15 at 02:46
  • @daBich It should be the same as if you were giving a list. Set the data source to your dataset. you may need to wrap the single object (if you're passing a business object) in a list that contains only one item, but it works just fine. – Andy Mar 02 '15 at 15:44
  • wow.. i didn't take the leap of faith and really give it a try till now, and yes, it works fine.. the wizard led me astray ;) – da Bich Mar 03 '15 at 02:52