In my current application I'm using an UltraPrintPreviewDialog to display the results of the .NET generated output to the user so they can check values before printing. They needed to be able to email a PDF of the same information, so I recreated their current output using the Infragistics.Documents code library.
So, now I have better code that can be printed or sent as a PDF... however, I can't figure out how to get the code to work with the print preview dialog...
Is this possible?
Thanks,
Scot
Davide, thanks for this, helped tons!
Few refine on my code:
1) to enable printing from preview dialogox remove the line e.Cancel = true; in uPrvDlg_Printing, like this:void uPrvDlg_Printing(object sender, PrintingEventArgs e){ currentPrintPageNumber = 0; // e.Cancel = true; this.Report.Print(main.Sex.CurrentPrinter);}
reportGraphics.SaveState();int translatoToSyncWithReportPrintY = -10;int translatoToSyncWithReportPrintX = -10;reportGraphics.Translate(translatoToSyncWithReportPrintX, translatoToSyncWithReportPrintY);
I hope this help.
Bye bye
Thanks Andrew,
I tried to follow your suggestion about do a .Scale before draw the page.... but tested with a A4 size vertical document the preview area is wider look like the orientation of document was horizontal.
Regarding better my code (not all it was posted) I found that I was tested before the use of reportGraphics.Scale(widthRatio, heightRatio) and in effect the two variables (widthRatio, heightRatio) are declared and calculated but not used in my posted-code.
For my report-type this code work, but it is not perfect and dont fit all situations. If I will evolve I will put the new code in this thread.If anyone want to add features or debugging it, he/she are welcome.
I thinking to use this code-idea to permit us to decide how many copies of one Report we want to print! ^-^
Happy new year to all !!!
Davide.
PS: if any want contact me via email please put in evidence in the object that you are a Infragistics Forum user. Thanks.
David,
Absolutely beautiful work. When I started using it I did notice that some of my reports were cut off and I could not figure out why. Just for the reference of other folks that may use this code - add in reportGraphics.Scale(widthRatio, heightRatio) before you draw the page.
Andrew Barnes
Scot,
I'm happy that it works into you code
I'm using this code in my framework to give to the user the ability to preview the document generated with the outstanding UltraDocument class, and I don't have any problems.... but the documents are bills, 1/3 pages long. Probably with bigger document you will can see more problems (performance, memory...).
IMO there are not other ways to preview directly the Report generated from UDocument class, it save only.Clearly always that Infra not release a new and improved UltraDocument... may be with a visual editor (in an post in the old forums, Infragistics's people says that an editor/previewer are not in they R&D plans ).
You welcome
Davide Dolla