Hello,
i have a problem with the print results of a complex report which contains a composite chart and a generated grid on a single page.
Because the Infragistics Report does not support interaction with printersettings i had to use the UltraPrintDocument (like in post: http://blogs.infragistics.com/forums/p/1237/11676.aspx).
Through the PrintDocument i have access to printersettings. But now the results of the prints on file (PDF, XPS) doesnt look well or are corrupt (doesnt show anything).
Is there any Workaraound, to generate proper PDF, XPS and direct print (on paper) together? Does the report really not support printersettings?
Thanks for your answers.
Greets,
Ali
Hi Matt,
Thanks for your answers. I solved the problems by looking into the code of the PrintManager, thats hidden in the Report class. looks like my old code had some mistakes in the calculation of the scalingfactors and some other strange statements.
The only actions i had to do:
0.Set PrinterSettings of PrintDocument (from PrintDialog)
1.GetPage
2.Scale graphics depending on property landscape
3.Draw to Graphics
nothing more ;)
Best Regards,
Ali,
1) Unfortunately, the only solution is to submit a feature request, since this would require the adding, and testing of new functionality and I can't really come up with a good workaround to this that you're not already aware of, since there is an internal PrintDocument. Basically all this code does is use an Infragistics.Documents.Graphics.Graphics class to draw each ProjectionPage; the Graphics object wraps the graphics object provided by the PrintPageEventArgs, then scales it to the available size per page. If you have access to the source code, you can look at the Infragistics.Documents.Report.PrintManager class' PrintPage method to see exactly how it does this.
2) So what I gather here is that you can either print to a printer, or publish the report to PDF, but you can't do both with the same method? I'm not sure how you're trying to publish something to PDF/XPS after you have a PrintDocument, since at this point you're directly rendering an image of each page to the PrintDocument, thereby losing any of the PDF/XPS/Report objects that you originally had. Perhaps the method I outlined above, with using the Infragistics Graphics class, might help you with this but I can't really say for certain. Since you're losing the Document's engine to write to native PDF/XPS by converting an image, there may be no way to accomplish this short of publishing the report twice, once to a file (that you could even keep in a MemoryStream), and the other through your PrintDocument.
-Matt
Thanks for the reply. The given options in the Report are too few. I could try a feature request, but this would take to long, because i have to finish the project. so i try to describe my situation/problem better.
My original problem was, that its is not possible to customize the print options (only few) in the print method of the report. Normally i would use a PrintDialog and get the PrinterSettings/PageSettings. I had expected that the report can take PrinterSettings/PageSettings as a parameter.
This problem caused me to use the IProectionPageCollection inside the PrintPage-Events of the PrintDocument. That way i can use the PrinterSettings of the PrintDialog.
Here my 2 Situations:
1. The Pdf that was printed with Print-method of Report looked well. Both in Pdf/XPS and Print.
Missing Feature: the possibility to use a PrinterSettings object (for number of sites on one page, duplex print, colored ...).
2. When i use the PrintPage-Event of the PrintDocument to draw the ProjectionPage to the Page i have the PrinterSettings and can print the PrintDocument.
But when i want to print to PDF or XPS the results are not what i expect. And i dont understand why this happens. Could it be that the Draw-method of IProjectionPage has some limitations or bugs? Opening a PDf generated that way cause often errors and the the XPS version is a blank page.
And thats the real problem: I dont want to explain the user why he needs twice the number or buttons for his print-jobs because i cant unite the features of Report and PrintDocument ;) So i need a hint to find the problems with the Draw-method of IProjectionPage or a Report with PrinterSettings-Support.
I will be hard to put that much code in here but if you need some part of my code to help me that i will try.
I can't really what might be causing your issues with the print report, since I'm not quite sure what you're referring to, though I do agree that there should be more options available for directly printing the report. If your problem is that saving the PDF file, through the UltraPrintDocument, don't appear correctly when viewed through a PDF reader, I'd say that would be expected because it's not writing the PDF format at that point.
The only options directly related to printing on the Report object seem to be on the report.Preferences.Printing, which expose the PaperSize, PaperOrientation, and FitToMargins. The Print method on the report takes the name of the printer, which will then be printed through an internal print document. You should submit a feature request to expose more options for printing, specifying which options you would like to be made available.