Export image quality in Gantt Chart Library and Project Management Library for WPF

Trying to export a bitmap image from Gantt Chart list view controls within Gantt Chart Library for WPF or Project Management Library for WPF you may have found that the image quality may be lower when a large image is exported.

The issue you have observed is occuring because to generate the output image the Gantt Chart list view controls use nesting VisualBrush objects bound to the exported DrawingVisuals obtained from the inner NodeListView and GanttChartView controls, which may lead to rasterization. Moreover, when text is appearing in a DrawingVisual that is used within a VisualBrush, the text presenting enhancement algorithms may not be applied anymore.

As a workaround, you could try to use the base NodeListView.GetExportDrawingVisual() and GanttChartView.GetExportDrawingVisual() methods to obtain two primary DrawingVisual objects (one for the internal list view and one for Gantt Chart view): these two basic DrawingVisuals do not contain nested VisualBrush references, although simple VisualBrush objects are used internally by Gantt Chart view for the chart header and content area, and in some conditions they may strill trigger rasterization.

Note that WPF 4 components also have a GetExportBitmapSource method override with resolution parameter to be able to return larger, higher detail images.

Alternatively, assuming that on the target system there is an XPS printer installed, a better workaround (considering output quality) would be for you to change the image export to a print operation using the virtual printer, generating an XPS file instead. You can check out the Printing sample application for an example on how to use a GanttChartTaskListViewDocumentPaginator object (inheriting from DocumentPaginator) to use for printing. You can also read more about printing in WPF in MSDN for more details on how to create a print behavior from scratch using the base DocumentPaginator object and setting up a DrawingVisual as page content yourself (in the sample application the GanttChartTaskListViewDocumentPaginator class does it internally).

Where can I find sample applications?