All Demos / DataGrid / Exporting / Print

Blazor DataGrid Example - Print Functionality

Loading Syncfusion Blazor Server Demos…
This demo passes automated axe checks with 0 violations — semantic markup, ARIA, full keyboard operation, visible focus. Section 508 conformant Accessibility report VPAT

This sample demonstrates the Blazor DataGrid printing feature using the Printing and Printed events for customizing the printed output and managing actions before and after the print operation.

The Printing event provides the following customization options:

  • PrintDataSource - Specifies a custom data source for printing instead of the Grid current data source.
  • HeaderTemplate - Defines custom content to display in the printed document header.
  • FooterTemplate - Defines custom content to display in the printed document footer.
  • Cancel - Cancels the print operation programmatically when required.

The Printed event triggers after the print operation is initiated and can be used for post-print processing and restoration of temporary Grid changes.

In this example, the Printing event performs the following actions:

  • Assigns a custom data source through PrintDataSource to print only paid invoices.
  • Hides sensitive columns such as Cost, Profit, and Notes.
  • Generates custom header and footer templates with dynamically calculated summary information.

The Printed event restores the column visibility after the print operation completes.

Click the toolbar Print button to start the print process. The DataGrid prepares the configured print content and opens the browser's print dialog, allowing users to preview and print the data.

For more information about DataGrid printing, refer to the print documentation.

To learn more about the Blazor DataGrid, including features, documentation, and pricing, visit the Blazor DataGrid component page.