We have a multipage FlowDocument report that we are developing in WPF that uses charts. When we view the FlowDocument we can see the charts, however when we print the flowdocument the charts do not show on the printed material (we tried printing to different printers including pdf documents, xps document, actual printed paper).
We have found that, if we manually page through the FlowDocument (look at each page) and then print, the charts show in the printed material. It's almost as if the charts need to be viewed or displayed before they can be printed.
I would like to get to the point where I do not need to view the FlowDocument and just print the report in batch.
As for printing .... here is the code that I'm using to print the FlowDocument
PrintDialog printDialog = new PrintDialog();
if (printDialog.ShowDialog() == true)
{
FlowDocument mainFlow = m.mainFlow;
// Save all the existing settings.
double pageHeight = mainFlow.PageHeight;
double pageWidth = mainFlow.PageWidth;
// Make the FlowDocument page match the printed page.
mainFlow.PageHeight = printDialog.PrintableAreaHeight;
mainFlow.PageWidth = printDialog.PrintableAreaWidth;
// Reapply the old settings.
mainFlow.PageHeight = pageHeight;
mainFlow.PageWidth = pageWidth;
IDocumentPaginatorSource ps = mainFlow as IDocumentPaginatorSource;
printDialog.PrintDocument(ps.DocumentPaginator, "FlowDoc");
}
Hello,
Would you also post the XAML for a sample FlowDocument which contains an embedded xamChart? I'll be in a better position to reproduce this problem with it.
Thanks,
Until you can send some code from your project where I can see why the chart is not printing, I will share with you some of the things I was going to look at. If there is a reproducible bug with the xamChart not printing when it is part of a FlowDocument which has not yet been rendered to screen, then the work-around would be to have the FlowDocument rendered completely before printing. One way to do this is to use the XpsDocument APIs. With this you can write a WPF Visual to a XpsDocument with the XpsDocumentWriter. Then use the XpsDocumentWriter to print the document with a PrintContext. The great thing about using XPS to print is for when the user prints to XPS, they will get a text savvy XPS file.
Thanks
It seems though I fixed this bug recently, later changes before the service release caused a different problem to interfere with what you are trying to do here. I'll get back to you with a bug number tomorrow. Sorry for the frustration.
-Graham
Any updates on this issue - preferably a bug number and a workaround?
Bug number is 60336, I will get back to you if I can find any work around. Unfortunately the error that was introduced before the service release may be more difficult to work around than the original problem was.
I am interested in a solution to this problem as well.
This bug is resolved in the latest service release, but when you are doing measure/arrange before printing you must also call UpdateLayout to make sure that the layout has been synchronously updated, or there may be pending work to make the chart presentable.
A workaround that might help you in the meantime is to attach control to the live tree and perform measure, arrange, and then updatelayout, and then detach the chart. I don't believe you have to let the chart actually display to get this to work, it should be enough if the chart's loaded event fires.
Let me know if this helps.
Paul,
I'm referring to the next availalable service release.
http://ko.infragistics.com/support/service-releases.aspx#ServiceReleases
I have not seen a recent service release and I have an ongoing support case for this problem. I have not been notified that there is a fix available.
Which specific service release includes the fix and where can we download it from?
Thanks ... Paul