XAML to PDF (MAUI)

// PM > Install-Package IronPdf.Extensions.Maui

ChromePdfRenderer renderer = new ChromePdfRenderer();

// Apply HTML header
renderer.RenderingOptions.HtmlHeader = new HtmlHeaderFooter()
{
    HtmlFragment = "<h1>Header</h1>",
};

// Render PDF from Maui Page
PdfDocument pdf = renderer.RenderContentPageToPdf<MainPage, App>().Result;

pdf.SaveAs(@"C:\contentPageToPdf.pdf");
NuGet Download
PM > Install-Package IronPdf
XAML to PDF (MAUI)

XAML to PDF (MAUI)

This example demonstrates how a MAUI page can be converted into a PDF document.

The IronPdf.Extensions.Maui package is an extension of the main IronPdf package. Both the IronPdf.Extensions.Maui and IronPdf packages are needed to render a content page from a MAUI application to a PDF document.

Rendering from a MAUI page will give you access to all the features offered by the RenderingOptions class. The resulting PDF document can then either be exported as a PDF file or viewed with a MAUI PDF viewer.

Below is a sample code demonstrating the conversion process:

  • ChromePdfRenderer: This class is responsible for converting web content to PDF format using the Chrome rendering engine.
  • RenderingOptions: This property allows customization of the PDF document, such as headers and footers, page size, margins, etc.
  • RenderContentPageToPdf: This is a method from the IronPdf.Extensions.Maui package that facilitates rendering a MAUI ContentPage to a PDF document.
  • SaveAs: This method saves the generated PDF document to a specified file path.
Learn to Convert XAML to PDF in MAUI with IronPDF
View on GitHub

Ready to Get Started?

Nuget Downloads 21,916,531Version:2026.11just released