Converting Microsoft Project (MPP) files to PDF lets teams share plans in a consistent, portable format. With Aspose.Tasks for .NET, you can tailor the export: pick the view (Gantt, Resource Usage, Resource Sheet), control page size and orientation, tune timescale and fit, and even generate the Overallocated Resources report for quick risk review. This guide provides a clean, repeatable setup plus a complete C# sample.
Key Takeaways
- Choose the right output: use
PresentationFormatfor Gantt/Resource views orSaveReport(..., ReportType.OverallocatedResources)for a highlight‑first summary. - Control layout: set page size/orientation (
PageSize,IsPortrait) and fit (FitContent,RenderToSinglePage). - Tame page counts: tune
TimescaleandStartDate/EndDate; enableReduceFooterGapfor denser pages. - Keep calculations current: set
CalculationMode = Automaticor callproject.Recalculate()before exporting.
Step‑by‑Step Guide
Step 1: Load the MPP File
Read your .mpp and ensure calculations are up to date so dates, durations, and indicators are correct in the export.
Step 2: Configure Layout Settings
Pick page size/orientation (e.g., A3 landscape for wide Gantt). Use FitContent to avoid truncated rows and ReduceFooterGap to reclaim whitespace.
Step 3: Adjust Scaling and Content Fit
Use Timescale (Days, Weeks, Months) and optional RenderToSinglePage for a compact summary.
Step 4: Add Stakeholder Views
Export alternate views such as Resource Usage for time‑phased detail, and include the Overallocated Resources report to spotlight conflicts.
Complete, Compilable Example (C#)
using System;
using Aspose.Tasks;
using Aspose.Tasks.Saving;
using Aspose.Tasks.Visualization;
namespace MppToPdfCustomized
{
internal static class Program
{
// How to run:
// 1) dotnet new console -n MppToPdfCustomized
// 2) cd MppToPdfCustomized
// 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();
// 1) Gantt PDF: A3 landscape, weekly timescale, fit rows
var ganttOptions = new PdfSaveOptions
{
PresentationFormat = PresentationFormat.GanttChart,
IsPortrait = false,
PageSize = PageSize.A3,
Timescale = Timescale.Weeks,
FitContent = true,
ReduceFooterGap = true,
StartDate = project.Get(Prj.StartDate).Date,
EndDate = project.Get(Prj.FinishDate).Date
};
string baseName = System.IO.Path.GetFileNameWithoutExtension(input);
project.Save($"{baseName}-gantt.pdf", ganttOptions);
Console.WriteLine($"Saved: {baseName}-gantt.pdf");
// 2) Single-page Gantt summary (auto-scaling)
var singlePageOptions = new PdfSaveOptions
{
PresentationFormat = PresentationFormat.GanttChart,
IsPortrait = false,
RenderToSinglePage = true
};
project.Save($"{baseName}-gantt-singlepage.pdf", singlePageOptions);
Console.WriteLine($"Saved: {baseName}-gantt-singlepage.pdf");
// 3) Resource Usage view with daily timescale
var usageOptions = new PdfSaveOptions
{
PresentationFormat = PresentationFormat.ResourceUsage,
Timescale = Timescale.Days,
FitContent = true
};
project.Save($"{baseName}-resource-usage.pdf", usageOptions);
Console.WriteLine($"Saved: {baseName}-resource-usage.pdf");
// 4) Built-in Overallocated Resources report (highlights conflicts)
project.SaveReport($"{baseName}-overallocated-resources.pdf", ReportType.OverallocatedResources);
Console.WriteLine($"Saved: {baseName}-overallocated-resources.pdf");
}
}
}
How to run
dotnet new console -n MppToPdfCustomizedcd MppToPdfCustomizeddotnet add package Aspose.Tasks- Replace
Program.cswith the code above dotnet run -- "path-to-input.mpp"
What this code does
- Loads your MPP and enables automatic calculation.
- Exports configurable Gantt and Resource Usage PDFs, plus a single‑page summary.
- Generates the Overallocated Resources report to spotlight resource conflicts.
Troubleshooting & Tips
- PDF too wide/long: try
Timescale = Timescale.Monthsor enableRenderToSinglePagefor summaries. - Clipped rows: ensure
FitContent = trueand considerReduceFooterGap = true. - No highlights: use
SaveReport(..., ReportType.OverallocatedResources)(reports) or export Resource Usage/Resource Sheet for context; a plain Gantt view will not color overallocations by itself. - Fonts/locale: deploy required fonts to the server; use
PdfSaveOptions.FontSettingsfor custom font folders.
FAQ
Q1. Can I export only a date range of the schedule?
Yes. Set StartDate and EndDate on PdfSaveOptions to render only that window.
Q2. How do I reduce page count for very large projects?
Use coarser Timescale (weeks/months), set FitContent = true, and consider RenderToSinglePage for summaries.
Q3. What if I need a quick list of overallocated resources?
Export the Overallocated Resources report with project.SaveReport(...); it’s optimized for this purpose.
Q4. Do I need Microsoft Project installed? No. Aspose.Tasks renders files independently; just install the Aspose.Tasks NuGet package.
Q5. Can I customize columns in the exported views?
Yes. Use PdfSaveOptions.View/ViewSettings to define specific columns; otherwise defaults are used.
Conclusion
Using PdfSaveOptions and the right view/report selection, you can produce polished PDFs tailored to stakeholders: wide Gantt timelines, single‑page summaries, and resource‑focused exports. Start with sensible page settings, keep calculations current, and tune timescale and date range for clean, readable output.