Easily Export .NET MAUI DataGrid to Specific PDF Page
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (182).NET Core  (28).NET MAUI  (231)Angular  (117)ASP.NET  (49)ASP.NET Core  (81)ASP.NET MVC  (87)Azure  (42)Black Friday Deal  (1)Blazor  (242)BoldSign  (14)DocIO  (24)Essential JS 2  (110)Essential Studio  (201)File Formats  (74)Flutter  (138)JavaScript  (227)Microsoft  (122)PDF  (84)Python  (1)React  (107)Streamlit  (1)Succinctly series  (131)Syncfusion  (985)TypeScript  (33)Uno Platform  (3)UWP  (3)Vue  (46)Webinar  (53)Windows Forms  (59)WinUI  (72)WPF  (164)Xamarin  (159)XlsIO  (38)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (11)Business intelligence  (55)Button  (4)C#  (164)Chart  (152)Chart of the week  (61)Cloud  (16)Company  (440)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (74)Development  (692)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (7)Essential Tools  (13)Excel  (43)Extensions  (31)File Manager  (8)Gantt  (22)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (526)Mobile MVC  (9)OLAP server  (2)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (46)Performance  (13)PHP  (2)PivotGrid  (5)Predictive Analytics  (6)Report Server  (3)Reporting  (8)Reporting / Back Office  (9)Rich Text Editor  (12)Road Map  (12)Scheduler  (54)Security  (5)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (32)Solution Services  (4)Spreadsheet  (11)SQL  (15)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (420)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (31)Visual Studio Code  (19)Web  (643)What's new  (353)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Easily Export .NET MAUI DataGrid to Specific PDF Page

Easily Export .NET MAUI DataGrid to Specific PDF Page

TL;DR: Learn to export the Syncfusion .NET MAUI DataGrid content to a specific page in a PDF document. This guide includes code examples and setup instructions for developers.

Syncfusion .NET MAUI DataGrid control displays and manipulates data in a tabular view. Its rich feature set includes different column types, sorting, autofit columns and rows, and styling all elements.

This blog will guide you through the steps to export the .NET MAUI DataGrid to a specific PDF page.

Note: If you’re new to our Syncfusion .NET MAUI DataGrid, please refer to the getting started documentation.

Exporting .NET MAUI DataGrid to a specific PDF page

The Syncfusion.Maui.DataGridExport NuGet package offers all the PDF exporting functionalities, allowing us to utilize PDF packages to export the DataGrid into PDF formats.

So, include the Syncfusion.Maui.DataGridExport package in your app NuGet.

Then, add the Syncfusion .NET MAUI DataGrid control and an Export To PDF button to your xaml page.

    <Button Text="Export To PDF" WidthRequest="200" HeightRequest="50" 
                Clicked="OnExportToPDF" />
    <syncfusion:SfDataGrid x:Name="dataGrid"
                            ItemsSource="{Binding OrderInfoCollection}"
            <syncfusion:DataGridStyle RowBackground="LightBlue" HeaderRowBackground="LightGoldenrodYellow"/>
            <syncfusion:DataGridNumericColumn Format="D"
                                                HeaderText="Order ID"
            <syncfusion:DataGridTextColumn HeaderText="Customer ID"
            <syncfusion:DataGridTextColumn MappingName="Customer"
            <syncfusion:DataGridTextColumn HeaderText="Ship City"
            <syncfusion:DataGridTextColumn HeaderText="Ship Country"

After executing the above code example, the UI will look like the following image.

ExportToPDF button All the pdf exporting methods are available in the DataGridPdfExportingController class. Using the ExportToPdf or ExportToPdfGrid method, we can export the DataGrid content to PDF.

You can add the required number of pages to the PDF document and mention the page number on which you need to render the DataGrid data using the StartPageIndex property.

private void OnExportToPDF(object sender, EventArgs e)
    MemoryStream stream = new MemoryStream();
    DataGridPdfExportingController pdfExport = new DataGridPdfExportingController();
    var pdfDocument = new PdfDocument()
        PageSettings =
            Orientation = PdfPageOrientation.Landscape
    DataGridPdfExportingOption option = new DataGridPdfExportingOption() { StartPageIndex = 1, PdfDocument = pdfDocument};            
    var pdfDoc = pdfExport.ExportToPdf(this.dataGrid, option);
    SaveService saveService = new();
    saveService.SaveAndView("Export Feature.pdf", "application/pdf", stream);

Here, we’ll export the .NET MAUI DataGrid to the second page in a PDF document. Refer to the following output image.

Exporting .NET MAUI DataGrid to a specific page in a PDF
Exporting .NET MAUI DataGrid to a specific page in a PDF

Note: You can also export the DataGrid to a specific point in a PDF document.

GitHub reference

Also, check out the Exporting .NET MAUI DataGrid to a specific page in a PDF document GitHub demo.

Supercharge your cross-platform apps with Syncfusion's robust .NET MAUI controls.


Thanks for reading! In this blog, we have seen how to export the Syncfusion .NET MAUI DataGrid to a specific page in a PDF. We believe that the steps outlined here have been valuable and enlightening.

If you’re interested in delving deeper into our .NET MAUI framework, you can easily access and evaluate it by downloading Essential Studio for .NET MAUI for free. Our esteemed customers can acquire the latest version of Essential Studio from the License and Downloads page.

Should you need any assistance or have further inquiries, contact us via our support forumsupport portal, or feedback portal. We are committed to providing help and support in every possible way.

Test Flight
App Center Badge
Google Play Store Badge
Microsoft Badge
Github Store Badge

Related blogs


Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed

Be the first to get updates

Subscribe RSS feed