How to print and export DevExpress reports without previewing them on a web page in an ASP.NET Core Angular application
This example prints and exports a report in a browser without previewing it on a web page.
Printing
On the server side, add a controller action to:
- create a report;
- export the report to PDF: you can do so asynchronously using the XtraReport.ExportToPdfAsync method;
- send back to the client.
On the client-side, two options are available:
-
Print a report in a new tab. Create a print button and invoke a new tab by using the client-side
window.Open(url, "_blank")
method to open a new tab and allow clients to print a document. -
Print a report with iFrame. Once a client clicks the print button, invoke the browser's Print dialog in the
HTMLIFrameElement
so that users can proceed with printing the document.
NOTE: We don't recommend printing with an invisible iFrame element because it's not guaranteed to work reliably across all browsers.
See also:
Exporting
Create a server-side controller action to export a report to a format selected by a user. See: Export Reports.