Print a Document in .NET MAUI PDF Viewer (SfPdfViewer)

8 Sep 20251 minute to read

The print feature of SfPdfViewer allows you to effortlessly print PDF documents directly from your application code.

Moreover, when performing a print operation, the default device print dialog opens, providing users with familiar options and settings to customize their printing experience.

To print a PDF programmatically, you can use the PrintDocument method provided by SfPdfViewer.Refer to the following code example.

// Prints the PDF document.
PdfViewer.PrintDocument();

Also, SfPdfViewer provides another way to print through command binding using the PrintDocumentCommand. This makes printing easier, especially when used with buttons.

<!-- Prints the PDF document. -->
<Button Text="Print" Command="{Binding Source={x:Reference PdfViewer},Path=PrintDocumentCommand}"/>

Below is an example of the print preview dialog on the Android platform. The appearance of this dialog may differ across other platforms.

Printing PDF Files in .NET MAUI PDF Viewer

How to adjust the print quality on the Windows platform?

SfPdfViewer allows users to adjust the printing quality on the Windows platform using the PrintSettings.PrintQuality API. The PrintQuality enumeration supports the below quality levels:

  • Low - Optimizes print speed and uses minimal memory during printing.
  • Default - Suitable for standard text and basic graphics, while maintaining the quality of previous versions. This is the default value.
  • Medium - Balances clarity and performance during printing.
  • High - Ensures sharper lines and crisp small annotations in the output.
  • Ultra - Optimizes the detail on large-format print documents like CAD drawings and architectural plans.
// Sets high print quality
PdfViewer.PrintSettings.PrintQuality = PrintQuality.High;

NOTE

The PrintQuality API is only applicable to the Windows platform and does not affect printing on Android, iOS, or macOS.

Limitations

Currently, when printing a document that contains sticky note annotations, the sticky note icon always appears as the default comment icon appearance in the printed document.