Printing Microsoft Project Files

Printing project schedules is often required in real-world project management scenarios. Whether for team meetings, official documentation, or sharing with stakeholders who do not use Microsoft Project, being able to generate a physical copy of a project plan is essential.

Aspose.Tasks for .NET provides the facility to print projects directly to the default printer or any configured custom printer using the Project.Print function. It also offers advanced printing features, such as adjusting timescales, customizing page ranges, and adding legends on each page, giving developers full control over the printed output.

Printing Project Data

The Project class exposes the Print function to print a project. The Print function can be customized using PrintOptions, which allows setting options like TimeScale, StartDate, EndDate, FitContent, LegendOnEachPage, and more.

Additionally, the .NET PrinterSettings class can be used to define printer-specific configurations such as paper size, page range, and target printer. Both PrintOptions and PrinterSettings objects can be combined and passed to Project.Print() to achieve maximum flexibility.

Use this approach when you simply want to send the project directly to the system’s default printer without additional configuration.

1Project project = new Project("New Project.mpp");
2project.Print();

If your environment has multiple printers (e.g., office network printers), you can specify which one to use. This example shows how to target a non-default printer.

1Project project = new Project("New Project.mpp");
2foreach (string printer in PrinterSettings.InstalledPrinters)
3{
4    if (printer.ToUpperInvariant().Contains( "Microsoft Print to PDF".ToUpperInvariant()))
5    {
6        project.Print(printer);
7        break;
8    }
9}

Large Microsoft Project files can span multiple pages. Aspose.Tasks ensures proper pagination and scaling so that the content remains readable.

1Project project = new Project("New Project.mpp");
2PrintOptions options = new PrintOptions();
3options.Timescale = Timescale.ThirdsOfMonths;
4if (project.GetPageCount(Timescale.ThirdsOfMonths) <= 280)
5    project.Print(options);

For advanced scenarios, you can combine PrintOptions and PrinterSettings to gain full control over the printing process. This includes adjusting timescales, setting date ranges, customizing page layout, or enabling legends.

 1Project project = new Project("New Project.mpp");
 2
 3PrintOptions options = new PrintOptions();
 4options.Timescale = Timescale.Months;
 5
 6// Print first two pages
 7PrinterSettings printerSettings = new PrinterSettings();
 8printerSettings.PrintRange = PrintRange.SomePages;
 9printerSettings.FromPage = 1;
10printerSettings.ToPage = 2;
11
12System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
13pageSettings.PaperSize = new PaperSize("Custom Size", 1000, 700);
14project.Print(printerSettings, options);

Aspose.Tasks for .NET simplifies the process of printing Microsoft Project files. From a quick print to the default printer to advanced scenarios with customized settings, the API provides all the tools required to generate high-quality printed output. This flexibility allows project managers and developers to ensure project data is always accessible in the format best suited for their teams and stakeholders.

Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.