Microsoft Project data can easily be rendered to PDF without installing any external application. As a Python developer, you can render MPP or MPT files in PDF programmatically on the cloud. This article will be focusing on how to render Project data from MPP to PDF using a REST API.

The following topics shall be covered in this article:

Document Viewer REST API and Python SDK

For rendering MPP or MPT documents, I will be using the Python SDK of GroupDocs.Viewer Cloud API. It allows you to programmatically render and view all sorts of popular documents and image file formats. It also provides .NET, Java, PHP, Ruby, Android, and Node.js SDKs as its document viewer family members for the Cloud API.

You can install GroupDocs.Viewer Cloud to your Python project using the following command in the console:

pip install groupdocs_viewer_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:

Render Project Data using a REST API

You can render Project data file in PDF format by following the simple steps mentioned below:

Upload the Document

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

As the result, the sample.mpp file will be uploaded to Cloud Storage and will be available in the files section of your dashboard.

Render MPP to PDF in Python

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

  • Create a View API instance
  • Provide ViewOptions
  • Create a view request by calling the CreateViewRequest method
  • Get response by calling the create_view method

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

You may provide project management options while rendering to PDF as shown in the code snippet given below:

Download the Updated File

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

Conclusion

In this article, you have learned how to render Project data from MPP to PDF document on the cloud with Document Viewer REST API using Python. You also learned how to programmatically upload the file on the cloud and then download the rendered file from the cloud. You can learn more about GroupDocs.Viewer 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