
How to Export a MAUI XAML Page to PDF in .NET
.NET MAUI lets teams ship a single codebase across Windows and macOS, which makes it a popular choice for line-of-business desktop apps such as field service tools, point-of-sale systems, and operations dashboards. These apps already render structured screens in XAML, and users frequently need a copy of what they see as a portable document. IronPDF turns the current MAUI page into a PDF with one method call, so the UI a team already built becomes the report.
Where the need shows up
A field inspector finishes a job on a XAML form. A salesperson builds a quote on screen. A manager reviews a KPI dashboard. Each one ends the same way: someone wants a clean, shareable record for a client or the back office. Rebuilding that screen as a separate report template means two layouts that drift apart over time. Pointing the document straight at the existing page sidesteps that maintenance.
One page, one document
IronPDF renders a MAUI ContentPage to PDF through its Chrome engine, preserving fonts, colors, and layout. It is the same engine used for converting HTML to PDF. The RenderContentPageToPdf method handles the conversion, and the result is a standard PdfDocument ready to save or edit.
using IronPdf;
using IronPdf.Extensions.Maui;
private async void PrintToPdf(object sender, EventArgs e)
{
ChromePdfRenderer renderer = new ChromePdfRenderer();
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter
{
HtmlFragment = "<h1>Inspection Report</h1>"
};
PdfDocument pdf = await renderer.RenderContentPageToPdf<MainPage, App>();
pdf.SaveAs("inspection-report.pdf");
}Imports IronPdf
Imports IronPdf.Extensions.Maui
Private Async Sub PrintToPdf(sender As Object, e As EventArgs)
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter With {
.HtmlFragment = "<h1>Inspection Report</h1>"
}
Dim pdf As PdfDocument = Await renderer.RenderContentPageToPdf(Of MainPage, App)()
pdf.SaveAs("inspection-report.pdf")
End SubImports IronPdf
Imports IronPdf.Extensions.Maui
Private Async Sub PrintToPdf(sender As Object, e As EventArgs)
Dim renderer As New ChromePdfRenderer()
renderer.RenderingOptions.HtmlHeader = New HtmlHeaderFooter With {
.HtmlFragment = "<h1>Inspection Report</h1>"
}
Dim pdf As PdfDocument = Await renderer.RenderContentPageToPdf(Of MainPage, App)()
pdf.SaveAs("inspection-report.pdf")
End SubWiring this to a button in the XAML file is all the UI work required:
<Button
Text="Save as PDF"
Clicked="PrintToPdf"
HorizontalOptions="Center" />
Before you wire it up
A few details determine whether the feature ships cleanly:
- Extension package:
RenderContentPageToPdflives in theIronPdf.Extensions.Mauipackage, which sits on top of the main IronPdf package. Both are required. - Async handling: The method returns a task, so awaiting it keeps the interface responsive while a complex page renders. A loading indicator on the button improves the experience.
- Save location: Use a file picker or a platform-appropriate directory rather than a hardcoded path, since the same code runs on Windows and macOS.
- Platform scope: MAUI PDF generation targets desktop and web. Mobile platforms are not supported.
A button and a method call
That is the whole feature: one button, one call. Teams add invoice exports, inspection reports, and dashboard snapshots to a MAUI desktop app without a separate reporting layer. Because the output is a PdfDocument, further steps such as page numbers and compression are available before saving. Full method details are in the XAML to PDF guide.
Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.
Related Articles


