mpp to pdf

How to convert MS Project (MPP) to PDF using .NET REST API.

In today’s fast-paced business world, effective project management is paramount. Microsoft Project is a go-to tool for many project managers, allowing them to plan, execute, and monitor projects efficiently. However, sharing project details with team members and stakeholders isn’t always straightforward. This is where MPP to PDF conversion comes to the rescue. Converting MPP files to PDF format provides a versatile solution, ensuring that everyone can view and collaborate on your projects with ease. So, let’s explore the essential process of converting MPP to PDF using the .NET REST API and uncover the plethora of benefits it offers.

.NET Cloud SDK for MPP to PDF Conversion

Aspose.Tasks Cloud SDK for .NET is our award-winning tool for converting MPP to PDF format. This SDK isn’t just about the MPP to PDF conversion, but it’s a comprehensive project management solution in the cloud. With its wide array of features, it simplifies project planning, scheduling, and monitoring, while also allowing you to seamlessly manage your project data. Let’s dive into the step-by-step process and witness how this SDK can effortlessly handle these tasks.

Search Aspose.Tasks-Cloud in NuGet packages manager and click the Add Package button. This will add the SDK reference in your project. Secondly, obtain your client credentials from cloud dashboard.

In case you do not have an existing account, simply create a free account by following the instructions specified in the quick start article.

Convert MPP to PDF in C#

Let’s follow the instructions given below to perform the MS Project (MPP) to PDF conversion using C# .NET.

TasksApi tasksApi = new TasksApi(clientSecret, clientID);

Create an object of TasksApi class while passing client credentials as input arguments.

GetTaskDocumentWithFormatRequest formatRequest = new GetTaskDocumentWithFormatRequest()
{
    Format = ProjectFileFormat.Pdf,
    Name = inputFile 
    ReturnAsZipArchive = false
};

Create a Request instance where we specify the name of input MPP, resultant format as PDF and the property to not save the output as zip archive.

var output = tasksApi.GetTaskDocumentWithFormat(formatRequest);

Finally, call the API to convert MPP to PDF online and return the output in stream instance.

saveToDisk(finalResponse, resultant);

Our custom method providing the capability to save the resultant PDF on local drive.

The sample MPP file used in the above example can be downloaded from Commercial construction project plan.mpp.

Save MPP as PDF using cURL Commands

For those who prefer a command-line approach, we are going to explore the details on how to perform MPP to PDF conversion using Aspose.Tasks Cloud with cURL commands. As the SDK offers a flexible solution to integrate into your workflows, and with cURL, you can automate the process effectively. This section guides you through the steps to make this conversion efficient and effortless.

The first step in this approach is to generate a JWT access token using the following command:

curl -v "https://api.aspose.cloud/connect/token" \
 -X POST \
 -d "grant_type=client_credentials&client_id=163c02a1-fcaa-4f79-be54-33012487e783&client_secret=c71cfe618cc6c0944f8f96bdef9813ac" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Please execute the following command to export MS Project (MPP) file to PDF format.

curl -X GET "https://api.aspose.cloud/v3.0/tasks/{sourceMPP}/format?format=pdf" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <accessToken>" \
-o {resultantFile}

Replace sourceMPP with the name of input MPP file available in Cloud storage, resultantFile with the name of output PDF and accessToken with JWT access token generated above.

Conclusion

In conclusion, we’ve delved into two effective methods for converting MPP files to PDF format. The first method demonstrated the power and versatility of Aspose.Tasks Cloud SDK for .NET, providing an easy and comprehensive way to perform this conversion. The second approach, using cURL commands in conjunction with Aspose.Tasks Cloud, offers a command-line alternative for those who prefer automation. Whether you opt for the SDK or the cURL commands, you have the tools at your disposal to seamlessly convert MPP files to PDF, enhancing your document management capabilities.

We highly recommend visiting the following blogs: