void _PrintDocument_AddPages(object sender, AddPagesEventArgs e) { foreach (var page in _Pages) { _PrintDocument.AddPage(page); } _PrintDocument.AddPagesComplete(); }
private void OnAddPages(object sender, AddPagesEventArgs e) { this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { for (int i = 1; i <= this.pageCount; i++) { this.document.AddPage(this.BuildPage(i)); } this.document.AddPagesComplete(); }); }
void OnAddPages(object sender, AddPagesEventArgs e) { this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { this.document.AddPage(this.pages[1]); this.document.AddPagesComplete(); } ); }
/// <summary> /// Sets actual pages. /// </summary> private void OnAddPages(object sender, AddPagesEventArgs e) { Patient selectedPatient = this.GetSelectedPatient(); if (selectedPatient == null) { this.printDocument.AddPage(new Viewbox { Child = new Button { Content = "Kein Patient ausgewählt", Background = new SolidColorBrush(Colors.Red) } }); } else { this.printDocument.AddPage(new Viewbox { Child = new Button { Content = selectedPatient.Name, Background = new SolidColorBrush(Colors.Green) } }); } this.printDocument.AddPagesComplete(); }
void printDocument_AddPages(object sender, AddPagesEventArgs e) { var contentPresenter = new ContentPresenter { Content = new Image { Source = new BitmapImage(new Uri(_CurrentImage.LargeImageUri)) } }; _PrintDocument.AddPage(contentPresenter); _PrintDocument.AddPagesComplete(); }
void PrintDocumentAddPages(object sender, AddPagesEventArgs e) { for (int i = 0; i < pages.Count; i++) { document.AddPage(pages[i]); } PrintDocument printDoc = (PrintDocument)sender; printDoc.AddPagesComplete(); }
/// <summary> /// This is the event handler for PrintDocument.AddPages. It provides all pages to be printed, in the form of /// UIElements, to an instance of PrintDocument. PrintDocument subsequently converts the UIElements /// into a pages that the Windows print system can deal with. /// </summary> /// <param name="sender">PrintDocument</param> /// <param name="e">Add page event arguments containing a print task options reference</param> protected virtual void AddPrintPages(object sender, AddPagesEventArgs e) { // Loop over all of the preview pages and add each one to add each page to be printied for (int i = 0; i < printPreviewPages.Count; i++) { // We should have all pages ready at this point... printDocument.AddPage(printPreviewPages[i]); } PrintDocument printDoc = (PrintDocument)sender; // Indicate that all of the print pages have been provided printDoc.AddPagesComplete(); }
private void OnPrintDocumentAddPages(object sender, AddPagesEventArgs args) { _printDocument.AddPage(Page1); _printDocument.AddPage(Page2); _printDocument.AddPagesComplete(); }
// 当系统请求将打印内容发送到打印机时 private void printDocument_AddPages(object sender, AddPagesEventArgs e) { for (int i = 0; i < previewPages.Count; i++) { // 添加到打印列表 printDocument.AddPage(previewPages[i]); } // 打印列表中的数据已经全部准备好了 printDocument.AddPagesComplete(); }
private void AddPrintPages(object sender, AddPagesEventArgs e) { // add all already prepared pages to print document for (int i = 0; i < printPages.Count; i++) { printDocument.AddPage(printPages[i]); } // Indicate that all of the print pages have been provided (sender as PrintDocument).AddPagesComplete(); }
protected virtual void AddPrintPages(object sender, AddPagesEventArgs e) { PrintDoc.AddPage(PrintContent); PrintDoc.AddPagesComplete(); }
/// <summary> /// This is the event handler for PrintDocument.AddPages. It provides all pages to be printed, in the form of /// UIElements, to an instance of PrintDocument. PrintDocument subsequently converts the UIElements /// into a pages that the Windows print system can deal with. /// </summary> /// <param name="sender">PrintDocument</param> /// <param name="e">Add page event arguments containing a print task options reference</param> protected override void AddPrintPages(object sender, AddPagesEventArgs e) { // Clear the cache of print pages printPages.Clear(); // Clear the print canvas of print pages PrintCanvas.Children.Clear(); // This variable keeps track of the last RichTextBlockOverflow element that was added to a page which will be printed RichTextBlockOverflow lastRTBOOnPage; // Get the PrintTaskOptions PrintTaskOptions printingOptions = ((PrintTaskOptions)e.PrintTaskOptions); // Get the page description to deterimine how big the page is PrintPageDescription pageDescription = printingOptions.GetPageDescription(0); // We know there is at least one page to be printed. passing null as the first parameter to // AddOnePrintPage tells the function to add the first page. lastRTBOOnPage = AddOnePrintPage(null, pageDescription); // We know there are more pages to be added as long as the last RichTextBoxOverflow added to a print // page has extra content while (lastRTBOOnPage.HasOverflowContent && (lastRTBOOnPage.Visibility == Windows.UI.Xaml.Visibility.Visible)) { lastRTBOOnPage = AddOnePrintPage(lastRTBOOnPage, pageDescription); } // Loop over all of the pages and add each one to add each page to be printed for (int i = 0; i < printPages.Count; i++) { // We should have all pages ready at this point... printDocument.AddPage(printPages[i]); } PrintDocument printDoc = (PrintDocument)sender; // Indicate that all of the print pages have been provided printDoc.AddPagesComplete(); }
// #6 Once Print is hit - add the pages created above to the print document void OnAddPages(object sender, AddPagesEventArgs e) { this.doc.AddPage(page1); doc.AddPagesComplete(); }