Hello,
i am using the ultraprintpreviewdocument to print documents with several pages. Now I want to select a single page from them and print it. Is this possible with a ultraprintpreviewdocument (Version 8.3) or do I have to develop my own printpreviewdocument?
Actually this is not something that the UltraPrintPreviewControl/Dialog have control over. It is up to the PrintDocument implementation to support printing ranges of pages. The UltraGridPrintDocument supports this but currently the UltraSchedulePrintDocument does not. Also, if you're using your own printdocument (derived or just handling the PrintPage, etc. events) then it is up to you to honor this setting.
Using 9.1: Per the previous thread, I am setting the Document.PrinterSettings as well as the Document.DefaultPageSettings.PrinterSettings to the PrinterSettings retrieved from the Windows.System.Forms.PrintDialog. I even listed out the settings in the Immediate window and confirmed that FromPage was 2, ToPage was 2, and PrintRange was SomePages {2}. Yet, the UltraWinPrintPreview control (I'm using the control not the dialog) still prints out all pages. Is that control supposed to honor the SomePages selection?
To test this out further, I modified the PrintPreviewBasicFeatures sample program by adding a handler to the ultraPrintPreviewDialog1's Printing event as follows:
Private Sub ultraPrintPreviewDialog1_Printing(ByVal sender As Object, ByVal e As Infragistics.Win.Printing.PrintingEventArgs) Handles ultraPrintPreviewDialog1.Printing Dim doc As System.Drawing.Printing.PrintDocument = ultraPrintPreviewDialog1.Document With doc.PrinterSettings .FromPage = 2 .ToPage = 2 .PrintRange = Printing.PrintRange.SomePages End With With doc.DefaultPageSettings.PrinterSettings .FromPage = 2 .ToPage = 2 .PrintRange = Printing.PrintRange.SomePages End With End Sub
This event is supposed to be raised before the print occurs - and it does. But all 9 pages are being printed (luckily my printer status dialog can cancel this!) So what is the problem with PrintRange not being handled by the component? Is this a bug? Or is there something else I need to do to get user selection of the pages to be printed to be honored by the control?
I have the same problem. I am setting the Document.PrinterSettings as well as the Document.DefaultPageSettings.PrinterSettings to the PrinterSettings retrieved from the Windows.System.Forms.PrintDialog. I even listed out the settings in the Immediate window and confirmed that FromPage was 2, ToPage was 2, and PrintRange was SomePages {2}. Yet, the UltraWinPrintPreview control (I'm using the control not the dialog) still prints out all pages. Is that control supposed to honor the SomePages selection?
This can be done through the PrinterSettings object. Get to it like this:
ultraPrintPreviewDialog1.Document.DefaultPageSettings.PrinterSettings
and then you can invoke the print command:
ultraPrintPreviewDialog1.Document.Print()