How to Export MS Project to PDF in C#

This article describes the process on how to export MS Project to PDF in C#. You will get all the details for the configuration of the development environment and step-wise procedure to develop this application along with a running sample code to convert MPP to PDF in C#. The customization of the output PDF is also discussed for controlling the conversion process.

Steps to Convert MS Project to PDF in C#

  1. Install Aspose.Tasks from the NuGet package manager to convert MPP to PDF
  2. Load an existing MS Project file using the Project class object
  3. Declare an object of PdfSaveOptions class
  4. Set desired properties like page size in the save options
  5. Save the MPP file as a PDF using the selected options

These steps provide a crisp method to export MS Project to PDF in C# by sharing all the necessary information for the configuration and then providing details of all the classes, methods and enumerators required to achieve this output. You can either load an existing MS Project file or you may create an MPP file and then save it as a PDF. These steps also discuss the PdfSaveOptions class object that contains several properties that can be set to customize the output PDF like page size of the output PDF is defined for demonstration however you may skip this customization and just use SaveFileFormat.Pdf for saving the PDF with default configurations.

Code to Convert Microsoft Project to PDF in C#

This code uses a Project class constructor that takes the input MPP file name only however you may provide other parameters like a stream instead of the file name, the ParseErrorCallback function in case of any issues while loading the source MPP file or use the LoadOptions class object that supports a variety of attributes for loading the file. Similarly, you may use the PdfSaveOptions class object if required that contains options like setting page size, bar style, default font name, encryption details and so on while writing an MS Project to PDF converter in C#.

This article has taught us to render an MPP file to PDF however if you want to learn the process to convert an MPP file to HTML, refer to the article on how to convert MPP to Excel using C#.

 English