We are using a custom print dialog. When printing in Landscape orientation, the PageSize and Orientation are properly set on ReportSettings class, but the right side of the document is cut off. When i look at the values while debugging, I see the following values:
ReportSettings.PageOrientation = Landscape
ReportSettings.PageSize = {1056, 816}
ReportSettings.PageSizeResolved = {816, 816} <-- Likely the problem here?
Here is my below code. We're using the latest 13.2 release.
report.ReportSettings.PageOrientation = dlg.PrintTicket.PageOrientation != null ? (dlg.PrintTicket.PageOrientation == System.Printing.PageOrientation.Landscape ? PageOrientation.Landscape : PageOrientation.Portrait) : PageOrientation.Landscape; report.ReportSettings.PrintQueue = dlg.PrintQueue; report.ReportSettings.PageRange = dlg.PageRange; report.ReportSettings.PageSize = new Size(dlg.PrintableAreaWidth, dlg.PrintableAreaHeight);
The documentation for the ReportSettings.PageSize property say that the size should be picked up from the PrintQueue object, but that doesn't appear to be happening.
Anyone?
Hello Dierk,
Thank you for your post. I have been looking into the scenario that you are having and I could not managed to reproduce it. Would you please, if possible, provide me with a sample application that is showing the issue, in order to be able to research what might be causing it?
Looking forward to hearing from you.
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
Hi Krasimir,
Please find attached a sample project that shows this issue.Click the button, and the custom print dialog should appear. Set the orientation to Landscape, and when you print to a real printer, there is a gap on the right side of the page. If you print to an Xps document and open the file, you should see the document is more of a square, instead of the rectangular shape you would expect with a normal letter sized page.
The code takes a screenshot of the window, then adds it to a Report and prints it out.
Thank you for your reply and the sample application. I have been looking into the question that you are having and you are not actually using the Infragistics Report for printing. You are actually creating an xps file and then you are printing the XPS file using the WPF built-in printing:
XpsDocument doc = new XpsDocument(report.ReportSettings.FileName, FileAccess.Read);
FixedDocumentSequence fixedDocSeq = doc.GetFixedDocumentSequence();
if (fixedDocSeq != null)
{
fixedDocSeq.DocumentPaginator.PageSize = report.ReportSettings.PageSize;
dlg.PrintDocument(fixedDocSeq.DocumentPaginator, "Printing Grid");
}
If you set the orientation of the Report to landscape and then print using the Print method of the Report class, without setting the PageSize, the report button is printed as expected.
I can suggest using the Print method of the Report, which will also show the PrintDialog and you will be able to allow your end users to change the settings for the printing. Also I can suggest not setting the PageSize, which will allow the Report to size itself to the needed size.
I have modified the sample application that you have provided me with, to show how you can print the button in landscape mode with the Report class.
Please let me know if you need any further assistance on the matter.