Converting Microsoft Project (MPP) files to PDF is common, but the default export is not always readable or concise. With Aspose.Tasks for .NET, you can fine‑tune page size, orientation, timescale, fit, and even produce a single‑page summary for quick reviews. This guide shows a reliable setup and a complete C# sample you can drop into your build.

Key Takeaways

  • Use PdfSaveOptions to control page size, orientation, timescale, and fit.
  • Keep calculations fresh with CalculationMode = Automatic or project.Recalculate() before export.
  • Generate single‑page summaries with RenderToSinglePage = true for executive overviews.
  • Set StartDate/EndDate to focus the timeline and reduce page count.

Step‑by‑Step Guide

1) Load the MPP File

Create a Project and point it at your .mpp. Enable automatic calculation to ensure dates and indicators are current.

2) Configure Layout

Choose page size (e.g., A3), orientation (landscape for wide Gantt), and content fit to avoid truncated rows.

3) Set Timescale & Focus Window

Pick a timescale (Days/Weeks/Months) and optionally narrow the export to a date range with StartDate/EndDate.

4) Save as PDF

Export a standard Gantt PDF, a single‑page summary, and any alternative views you need.

Complete, Compilable Example (C#)

using System;
using Aspose.Tasks;
using Aspose.Tasks.Saving;
using Aspose.Tasks.Visualization;

namespace MppToPdfLayoutScaling
{
    internal static class Program
    {
        // How to run:
        // 1) dotnet new console -n MppToPdfLayoutScaling
        // 2) cd MppToPdfLayoutScaling
        // 3) dotnet add package Aspose.Tasks
        // 4) Replace Program.cs with this file's contents
        // 5) dotnet run -- "path-to-input.mpp"
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Usage: dotnet run -- <path-to-input.mpp>");
                return;
            }

            string input = args[0];

            // Load project and ensure calculations are current
            var project = new Project(input)
            {
                CalculationMode = CalculationMode.Automatic
            };
            project.Recalculate();

            string baseName = System.IO.Path.GetFileNameWithoutExtension(input);

            // Standard Gantt export with custom layout
            var ganttOptions = new PdfSaveOptions
            {
                PresentationFormat = PresentationFormat.GanttChart,
                PageSize = PageSize.A3,       // wider canvas for Gantt
                IsPortrait = false,           // landscape
                Timescale = Timescale.Weeks,  // weekly buckets
                FitContent = true,
                ReduceFooterGap = true,
                StartDate = project.Get(Prj.StartDate).Date,
                EndDate = project.Get(Prj.FinishDate).Date
            };
            project.Save($"{baseName}-gantt.pdf", ganttOptions);
            Console.WriteLine($"Saved: {baseName}-gantt.pdf");

            // Single-page summary (auto scales to fit one page)
            var singlePage = new PdfSaveOptions
            {
                PresentationFormat = PresentationFormat.GanttChart,
                RenderToSinglePage = true,
                IsPortrait = false
            };
            project.Save($"{baseName}-gantt-singlepage.pdf", singlePage);
            Console.WriteLine($"Saved: {baseName}-gantt-singlepage.pdf");

            // Optional: Resource Usage view for time-phased detail
            var usage = new PdfSaveOptions
            {
                PresentationFormat = PresentationFormat.ResourceUsage,
                Timescale = Timescale.Days,
                FitContent = true
            };
            project.Save($"{baseName}-resource-usage.pdf", usage);
            Console.WriteLine($"Saved: {baseName}-resource-usage.pdf");
        }
    }
}

How to run

  1. dotnet new console -n MppToPdfLayoutScaling
  2. cd MppToPdfLayoutScaling
  3. dotnet add package Aspose.Tasks
  4. Replace Program.cs with the code above
  5. dotnet run -- "path-to-input.mpp"

What this code does

  • Loads an MPP and enables automatic calculation.
  • Exports a configurable Gantt PDF with page size/orientation and weekly timescale.
  • Generates a single‑page Gantt summary for quick review.
  • Optionally exports the Resource Usage view with a daily timescale.

Troubleshooting & Tips

  • PDF spans too many pages: use a coarser Timescale (Weeks/Months) or enable RenderToSinglePage for a compact overview.
  • Rows are truncated: set FitContent = true and consider ReduceFooterGap = true.
  • Need only part of the schedule: set StartDate and EndDate on PdfSaveOptions to trim the window.
  • Missing glyphs: ensure required fonts are installed or configure font folders via PdfSaveOptions.FontSettings.

FAQ

Q1. Can I export a specific date range only? Yes. Set StartDate and EndDate on PdfSaveOptions to render just that window.

Q2. How do I reduce the PDF page count for very large projects? Choose a coarser Timescale (Weeks/Months), enable FitContent, and consider RenderToSinglePage for summaries.

Q3. Can I export views other than Gantt? Yes. Set PresentationFormat to ResourceUsage, ResourceSheet, or other supported views.

Q4. Do I need Microsoft Project installed? No. Aspose.Tasks works independently; add the Aspose.Tasks NuGet package to your project.

Q5. Can I customize columns in the exported PDF? Yes. You can define specific columns via view settings; otherwise defaults are used.

Conclusion

Using PdfSaveOptions with appropriate page and timescale settings gives you precise control over MPP → PDF output. Start with an A3 landscape Gantt for readability, add a single‑page summary for stakeholders, and include Resource Usage for time‑phased detail. Test with a few representative projects to settle on defaults that fit your organization’s documents.

More in this category