("Print contract registered with customization, use the Print button to print.", NotifyType.StatusMessage) PrintHelper.PreparePrintContent(new PageToPrint()) Initialize print content for this scenario Initialize common helper class and register for printing protected override void OnNavigatedTo(NavigationEventArgs e) When the user goes to a page that supports printing, it initiates the registration within the OnNavigatedTo method. PrintMan.PrintTaskRequested += PrintTaskRequested PrintManager printMan = PrintManager.GetForCurrentView() PrintDocument.GetPreviewPage += GetPrintPreviewPage PrintDocument.Paginate += CreatePrintPreviewPages PrintDocumentSource = printDocument.DocumentSource public virtual void RegisterForPrinting() In the UWP print sample, registration is performed by the RegisterForPrinting method. During registration, create instances of PrintManager and PrintDocument and register handlers for their printing events. The PrintDocument class is used to handle much of the interaction between the app and the PrintManager, but it exposes several callbacks of its own. You can make it easier to write your printing code by adding the following using or Imports statements to your page. The PrintDocument type is in the Windows.UI.Xaml.Printing namespace along with other types that support preparing XAML content for printing. The PrintManager type is in the namespace along with types to support other Windows printing functionality. For an example of how to do this, see the PrintHelper class in the UWP print sample.įirst, declare the PrintManager and PrintDocument. If you need to support printing from more than one page in your app, you can put this print code in a common helper class and have your app pages reuse it.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |