Hi,
Welcome to Microsoft Q&A!
If you want to print page in uwp app, you could refer to the following steps.
1.Write a xaml page that contains a print button. The OnPrintButtonClick event informs the user of the print situation.
<Page..>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<Button Click="OnPrintButtonClick">Print</Button>
<TextBlock Text="It's a good day !"/>
</StackPanel>
</Grid>
</Page>
2.Declare the PrintManager and PrintDocument, register for printing
private PrintManager printMan;
private PrintDocument printDocument;
private IPrintDocumentSource printDocumentSource;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
// Register for PrintTaskRequested event
printMan = PrintManager.GetForCurrentView();
printMan.PrintTaskRequested += PrintTaskRequested;
// Build a PrintDocument and register for callbacks
printDocument = new PrintDocument();
printDocSource = printDocument.DocumentSource;
printDocument.Paginate += CreatePrintPreviewPages;
printDocument.GetPreviewPage += GetPrintPreviewPage;
printDocument.AddPages += AddPrintPages;
}
3.Handle the print process, achieve the PrintTaskRequested, CreatePrintPreviewPages, GetPrintPreviewPage, AddPrintPages event, you could refer to the official document to know detailed code of these event handler.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.