CanvasPrintDocumentPrint Event |
Namespace: Microsoft.Graphics.Canvas.Printing
public event TypedEventHandler<CanvasPrintDocument, CanvasPrintEventArgs> Print
This is raised after the user presses the "Print" button on the print preview dialog. The app should draw each page to be printed, calling CreateDrawingSession for each page. For example:
void OnPrint(CanvasPrintDocument sender, CanvasPrintEventArgs args) { for (uint pageNumber = 1; pageNumber <= this.numberOfPages; ++pageNumber) { using (var ds = args.CreateDrawingSession()) { this.DrawPage(ds, pageNumber, args.PrintTaskOptions.GetPageDescription(pageNumber); } } }
By default, the Dpi is set to match the printer DPI. If an app has a reason to change the DPI then it can do this before the first call to CreateDrawingSession.