Aspose.Tasks.Examples.CSharp.WorkingWithProjects.Printing.PrintPrintOptionsAndPrinterSettings.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:PrintPrintOptionsAndPrinterSettings
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Read the input Project file
            Project project = new Project(dataDir + "Project2.mpp");

            PrintOptions options = new PrintOptions();
            options.Timescale = Timescale.Months;

            // Print first two pages
            PrinterSettings printerSettings = new PrinterSettings();
            printerSettings.PrintRange = PrintRange.SomePages;
            printerSettings.FromPage = 1;
            printerSettings.ToPage = 2;

            System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
            pageSettings.PaperSize = new PaperSize(dataDir + "Custom Size", 1000, 700);
            project.Print(printerSettings, options);
            // ExEnd:PrintPrintOptionsAndPrinterSettings
        }
    }
PrintPrintOptionsAndPrinterSettings