10704 : How can I print only selected pages from a GTP.NET gantt?

Question

How can I print only selected pages from a GTP.NET gantt?

There does not seem to be a way of advancing to the first page of a selected page range.

Answer

We will always render all pages (to the printDocument) it is then up to the printDialog to send these pages to the printer.

You can instruct the print dialog to start on page x:

“The FromPage and ToPage properties are used by the PrintDialog when the user selects a print range. The PrintDialog.AllowSomePages property must be set to true to enable the user to specify a print range. In addition, the PrintDialog requires the MinimumPage and MaximumPage to be specified and the FromPage value to be within that range.”

So why are all pages processed if we only want to print page 5?

The number of pages is not known until the printDocument has finished. We need to see how many nodes that fits on each page.

The frameWork is really very flexible. Let me show you this:

   PreviewPrintController y=new System.Drawing.Printing.PreviewPrintController();
   y.UseAntiAlias=true;
   printDocument.PrintController=y;
   printDocument.Print();
   PreviewPageInfo[] aPreviewPageInfoList=y.GetPreviewPageInfo();
   aPreviewPageInfoList[5-1].Image  <— The image(EMF) of page 5…