Search code examples
c#.netprintinginfragisticspreview

Handling number of copies print preview - print preview dialog box


I am using UltraPrintPreviewDialog from Infragistics

 PrintPreviewDialog1.Document.DocumentName = "Report";
 PrintPreviewDialog1.Document.PrinterSettings =<<my printer settings>>;    
 PrintPreviewDialog1.Document.PrinterSettings.Copies = 2;
 PrintPreviewDialog1.ShowDialog();  //this line

When i preview the above code, it doesn't load me 2 copies of print preview, instead it loads only 1 page(the page content is for 1 page, however if i set to 2, it should show me the same page contents twice, so that number of copies can be printed accordingly), also i tried to use this

 for (int i = 1; i <= PrintPreviewDialog1.Document.PrinterSettings.Copies; i++)
{
            PrintPreviewDialog1.Document.Print();
}

It didn't print 2 copies directly from print preview.

How do i print(or print preview and print) the selected number of copies via UltraPrintPreviewDialog?


Solution

  • Well, I think you can't do what you have requested. When you request two copies of your document,
    the UltraPrintPreviewDialog shows the first copy of the same exact print job.
    There is no much reason to show two exact sets of the same pages.

    If, after settings the number of copies, you change your mind and want to print a different number of copies you could interact with the File Settings menu, intercept the display of the Page Setup dialog using the event PageSetupDialogDisplaying and changing the properties of the underlying print document and of the standard windows PageSetupDialog.

    See UltraPrintPreviewDialog