Convert MPP to PDF using Python

Microsoft Project is a widely used project management tool developed by Microsoft. As a Python developer, you can easily convert Microsoft Project data (.mpp) file to PDF programmatically on the cloud. The conversion of Project data will let you share project schedules among stakeholders. This article will be focusing on how to convert Microsoft Project MPP to PDF using a REST API in Python.

Convert MPP to PDF in Python

The following topics shall be covered in this article:

Document Conversion REST API and Python SDK

For Converting Microsoft Project MPP, I will be using the Python SDK of GroupDocs.Conversion Cloud API. It allows you to seamlessly convert your documents to any format you need. You can easily convert between over 50 types of documents and images, including all Microsoft Office and OpenDocument file formats, PDF documents, HTML, CAD, raster images and many more. It also provides .NETJavaPHPRuby, Android and Node.js SDKs as its document conversion family members for the Cloud API.

You can install GroupDocs.Conversion Cloud to your Python project with pip (package installer for python) from PyPI (Python Package Index) using the following command in the console:

pip install groupdocs_conversion_cloud

Please get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Add your ID and secret in the code as demonstrated below:

Convert Microsoft Project MPP to PDF using a REST API in Python

You can convert Project data from MPP to the PDF file by following the simple steps mentioned below:

Upload the Document

First of all, upload the MPP file to the Cloud using the code example given below:

As a result, the uploaded MPP file will be available in the files section of your dashboard on the cloud.

Convert MPP to PDF in Python

Please follow the steps mentioned below to convert MPP to PDF document programmatically.

  • Create an instance of ConvertApi
  • Create ConvertSettings instance
  • Set the file path
  • Set format to “pdf
  • Provide output file path
  • Define PdfConvertOptions if required
  • Create ConvertDocumentRequest
  • Get results by calling the ConvertApi.convert_document() method

The following code snippet shows how to convert Project data from MPP to the PDF document using a REST API.

You may also convert Microsoft Project MPP files to a variety of other popular formats. Such as MPP to DOCX, MPP to XLSX, MPP to PNG, MPP to JPG, MPP to GIF, and MPP to TIFF.

Download the Updated File

The above code sample will save the converted PDF file on the cloud. You can download it using the following code sample:

Convert MPP to PDF without Cloud Storage

Please follow the steps mentioned below to convert MPP to PDF document directly without using cloud storage.

  • Create an instance of ConvertApi
  • Create ConvertSettings instance
  • Provide the file path
  • Set format to “pdf
  • Provide output file path
  • Define PdfConvertOptions if required
  • Create ConvertDocumentDirectRequest
  • Get results by calling the ConvertApi.convert_document_direct() method

The following code snippet shows how to convert Project data from MPP to the PDF document without using cloud storage. As a result, the converted PDF document will be saved in the local computer’s temp folder. Please follow the steps mentioned earlier to upload a file.

Conclusion

In this article, you have learned how to convert Microsoft Project data from MPP to PDF documents on the cloud with Document Conversion REST API using Python. You also learned how to programmatically upload the MPP file on the cloud and then download the converted file from the cloud. You can learn more about GroupDocs.Conversion Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser. In case of any ambiguity, please feel free to contact us on the forum.

See Also