Printing reports directly without viewing is not supported. This can be achieved by exporting the reports into PDF and the resultant stream is used in the PdfDocument for printing. Initialize the ReportWriter and load the report stream. Set the DataSources to it and then export the report into PDF format by using the ReportWriter’s Save API as given in the following code example.
Load the exported stream into the PdfDocument by using the PdfDocument.LoadFromStreamAsync API. Render each page of the PDF document as BitmapImage and add them to the UI collection (printPreviewPages) by converting the bitmapimage to Image as shown in following code example.
Add the visual collections to the PrintDocument for printing them.
The following screenshot displays the final output.
Figure 1: Direct Printing of report
This page will automatically be redirected to the sign-in page in 10 seconds.