mpp to pdf

Convert Microsoft project file to PDF in Java.

Microsoft Project (MPP) files are widely used for project management, but sharing them can be difficult since not everyone has access to MS Project. Converting MPP to PDF ensures that project plans, schedules, and timelines can be easily shared, viewed, and printed without requiring specialized software. PDF files maintain the formatting and structure of the original project, making them ideal for reports, presentations, and documentation.

In this article, we will explore how to convert MPP to PDF using Java REST API, making project management more efficient and accessible.

Java API for MPP to PDF Conversion

Converting MPP to PDF using GroupDocs.Conversion Cloud SDK for Java API is a simple and efficient way to generate universally accessible project documents. This API allows seamless conversion while preserving the original structure, formatting, and content of the Microsoft Project (MPP) file. Beyond MPP to PDF conversion, the API supports a wide range of document formats, including Word, Excel, PowerPoint, images, and more.

Its cloud-based architecture enables the developers to integrate document conversion capabilities into their applications without requiring complex setups, ensuring a scalable and efficient workflow for project management and reporting.

Installation

Please add the following details to pom.xml file of maven build project.

<repository>
    <id>repository.groupdocs.cloud</id>
    <name>repository.groupdocs.cloud</name>
    <url>https://releases.groupdocs.cloud/java/repo/</url>
</repository>
<dependency>
    <groupId>com.groupdocs</groupId>
    <artifactId>groupdocs-conversion-cloud</artifactId>
    <version>24.8</version>
</dependency>

Once the installation is completed, please obtain your personalized API credentials(i.e. Client ID and Client Secret). You may visit this short tutorial explaining the details on how to get the API credentials.

MPP to PDF Conversion in Java

In this section, we are going to explore the details on how we can develop MS Project file to PDF converter using Java code snippet.

This section explains the details on how to convert MS Project file to Excel workbook using Java code snippet.

  1. Firstly, create an instance of Configuration class where we pass client credentials as arguments.
Configuration configuration = new Configuration(clientId, clientSecret);
  1. Secondly, initialize the ConvertApi where we pass Configuration object as an argument.
ConvertApi convertApi = new ConvertApi(configuration);
  1. Create an instance of ConvertSettings class where we define the input file name, output format and the name of resultant document.
ConvertSettings settings = new ConvertSettings();
  1. Create an instance of ConvertDocumentRequest class where we pass ConvertSettings object as an argument.
ConvertDocumentRequest request = new ConvertDocumentRequest(settings);
  1. Lastly, call the ConvertDocumentRequest API to convert the MPP to PDF and save the resultant PDF file to the cloud storage.
List<StoredConvertedResult> response = convertApi.convertDocument(request);
// More examples over https://github.com/groupdocs-conversion-cloud/groupdocs-conversion-cloud-dotnet
// Obtain your API credentials
string clientId = "XXXXXX-XXXXXXXXX-4088-9ca0-55c38f4b7f22";
string clientSecret1 = "XXXXXXXXXXXXXXXXXXXX";
// Create an instance of the Configuration class and initialize it with the Client ID & Client Secret
Configuration configuration = new Configuration(clientId, clientSecret);
// Define the API base URL for MPP to PDF conversion
configuration.setApiBaseUrl("https://api.groupdocs.cloud");
// Initialize an instance of ConvertApi with the Configuration object
ConvertApi convertApi = new ConvertApi(configuration);
ConvertSettings settings = new ConvertSettings();
settings.setStorageName("internal");
settings.setFilePath("Home move plan.mpp");
settings.setFormat("pdf");
settings.setOutputPath("converted.pdf");
// Invoke the ConvertDocument method to perform MPP to PDF conversion
ConvertDocumentRequest request = new ConvertDocumentRequest(settings);
List<StoredConvertedResult> response = convertApi.convertDocument(request);
// Check the response and print success message
if (response != null && response.equals("OK")) {
System.out.println("The MPP to PDF conversion completed successfully!");
}
view raw mpp-to-pdf.java hosted with ❤ by GitHub
mpp to pdf

Image:- Preview of Microsoft Project File to PDF conversion.

The input MS Project file used in the above example can be downloaded from Home move plan.mpp.

Convert MS Project to PDF using cURL Commands

Converting MPP to PDF using GroupDocs.Conversion Cloud API with cURL offers a quick and efficient way to transform project files into a universally accessible format. This approach is beneficial as it eliminates the need for additional software installations, works seamlessly across different platforms, and ensures accurate conversion with preserved formatting. With GroupDocs.Conversion Cloud, users can easily integrate MPP to PDF conversion into their applications, enhancing project documentation and collaboration.

Firstly, we need to generate a JWT access token and then, execute the following cURL command to develop Microsoft project viewer online by export MS Project file to PDF format. After successful conversion, the resultant PDF file is stored in the cloud storage.

curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"default\",  \"FilePath\": \"{sourceMPP}\",  \"Format\": \"pdf\",  \"OutputPath\": \"{convertedFile}\"}"

Please replace sourceMPP with the name of input MS Project file, convertedFile with the name of resultant PDF file and accessToken with a personalized JWT access token.

  • In case we have a requirement to save MPP to PDF conversion output on local drive, then please try using the following cURL command:
curl -v "https://api.groupdocs.cloud/v2.0/conversion" \
-X POST \
-H "accept: application/json" \
-H "authorization: Bearer {accessToken}" \
-H "Content-Type: application/json" \
-d "{  \"StorageName\": \"default\",  \"FilePath\": \"{sourceFile}\",  \"Format\": \"pdf\"}" \
-o "MyConverted.pdf"

Online MPP to PDF Converter

In order to experience the amazing capabilities of MPP manipulation API, you may consider using our free and lightweight MPP to PDF Converter App. This App is built on top of GroupDocs.Conversion Cloud REST API and enables you to explore the unique capabilities within a web browser.

mpp to pdf conversion app

Conclusion

Converting MPP to PDF is essential for seamless project sharing and documentation. With GroupDocs.Conversion Cloud API, you can achieve accurate and efficient conversions using Java or cURL commands. Its powerful features and cloud-based flexibility make it an ideal solution for developers. Try our API today and streamline your document conversion process effortlessly!

We highly recommend visiting the following links to learn more about: