Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Charts do not show in the printed pages when printing a multipage FlowDocument that contains charts
posted

 

 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");

            }

 

Parents Reply Children