Microsoft Project allows tracking, organizing, and managing projects. It stores project tasks, assignments, and other project-related resources and information in MPP files. We can easily convert project data from MPP files to various image formats such as JPEG, PNG, BMP, and TIFF. It allows sharing of project information in a read-only image format. In this article, we will learn how to export MS Project MPP to images (PNG, JPEG, BMP, TIFF) in Java.
The following topics shall be covered in this article:
- Java API to Export MPP to Images
- Export MPP to JPG
- Convert MPP to PNG
- Convert MPP to BMP
- Save MPP File as Multipage TIFF
Java API to Export MPP to Images
To export project data/information from MPP files, we will be using the Aspose.Tasks for Java API. It is a Java library that allows reading and writing MPP files without requiring Microsoft Project. Furthermore, the API supports converting MPP files to images.
The Project class of the API represents a project and exposes various methods to perform different functions. The save() method of this class allows saving the project in a specified image format. The ImageSaveOptions class of the API allows specifying additional options when rendering project pages to images. All the supported image formats are defined under SaveFileFormat enumeration.
Please either download the JAR of the API or add the following pom.xml configuration in a Maven-based Java application.
<repository> <id>AsposeJavaAPI</id> <name>Aspose Java API</name> <url>http://repository.aspose.com/repo/</url> </repository>
<dependency> <groupId>com.aspose</groupId> <artifactId>aspose-tasks</artifactId> <version>22.5</version> <classifier>jdk18</classifier> </dependency>
Export MPP to JPG using Java
We can export the MPP file to JPG/JPEG image format by following the steps given below:
- Firstly, load the MPP file using the Project class.
- Next, create an instance of the ImageSaveOptions class with the SaveFileFormat.Jpeg as an argument.
- After that, specify the quality of the JPEG image using the JpegQuality property.
- Finally, call the save() method and save the JPEG image.
The following code sample shows how to convert an MPP file to JPEG images using Java.
Convert MPP to PNG using Java
We can also convert an MPP file to PNG images by following the steps given below:
- Load the MPP file using the Project class.
- Create an instance of the ImageSaveOptions class using the SaveFileFormat.Png enumeration.
- Finally, save the PNG image using the save() method.
The following code sample shows how to convert an MPP file to PNG images using Java.
Convert MPP to BMP using Java
Similarly, we can convert MPP to BMP images by following the steps mentioned earlier. However, we just need to set the SaveFileFormat as Bmp in step # 2.
The following code sample shows how to convert an MPP file to BMP images using Java.
Save MPP Files as Multipage TIFF using Java
To save the MPP file as a multipage TIFF image, please follow the steps mentioned earlier. However, we just need to set the SaveFileFormat as Tiff in step # 2.
The following code sample shows how to convert an MPP file to a multipage TIFF image using Java.
Get a Free License
You can get a free temporary license to try Aspose.Tasks for Java without evaluation limitations.
In this article, we have learned how to convert Microsoft Project MPP files to image format using Java. Specifically, we have learned how to convert MPP files to JPEG, PNG, BMP, and TIFF images programmatically. Besides, you can learn more about Aspose.Tasks for Java using the documentation and explore a bunch of additional features for working with MPP files. In case of any ambiguity, please feel free to contact us on our forum.