How to Convert MPP to PDF using Java

This short tutorial contains information about how to convert MPP to PDF using Java. It contains the configuration details, sequence of steps to be performed to write this program, and a sample runnable code to demonstrate this operation. You can convert Microsoft Project to PDF using java with the help of a few API calls only.

Steps to Convert MPP to PDF using Java

  1. Configure the environment to use Aspose.Tasks for Java in the application from the Maven repository
  2. Load the template MS Project file in the Project object
  3. Instantiate the PdfSaveOptions class object
  4. Set the page size property in the PDFSaveOptions object
  5. Convert the MPP file to PDF using the save options

These simple steps cover the complete process to convert MS Project to PDF using Java having the configuration details, stepwise process, and a runnable sample code with a description. The Project class is used for loading the template MPP file, the PDFSaveOptions class is used for setting the output PDF file characteristics and the method is used for converting the file along with the PDFSaveOptions class object. Note that the PDFSaveOptions class object is not compulsory and can be omitted by using the default settings for the output PDF file.

Code to Export MS Project to PDF using Java

This code to save MPP as PDF using Java uses a Project class constructor with the template file name as the only argument however you may use other constructors also like the one with DBSettings that supports reading the project file from the database, or read the project file from a memory stream along with the load options like setting password if the input file is password protected and so on. The cancellation token can also be set to interrupt the loading operation in case of error or unnecessary delay.

We have learnt the process to change MPP to PDF here. If you want to learn the process to convert MPP to XPS, refer to the article on how to convert Microsoft Project file to XPS in Java.