Convert PDF to PPT using Java

In this article, we are going to discuss the details on how to convert PDF to PPT using Cloud API. We know that PDF file is among the widely used formats for information sharing as its highly adaptable to various platforms. On the other end, PowerPoint is used for information presentation within organizations and various institutes so in case the source file is shared in PDF format, we can directly convert PDF to PowerPoint format.

PowerPoint Conversion API

Aspose.Slides Cloud SDK for Java is a REST-based API providing the capabilities to create, manipulate and convert PPT to PDF and other supported formats. At the same time, it also provides the feature to load PDF files and save the output in PPT format. So in order to develop a PDF to PPT converter online, we need to first install the SDK from the maven repository. Please enter the following details in pom.xml of the maven build project to install the SDK.

<repositories>
 <repository>
        <id>aspose-cloud</id>
        <name>artifact.aspose-cloud-releases</name>
        <url>http://artifact.aspose.cloud/repo</url>
    </repository>   
</repositories>
<dependencies>
 <dependency>
    <groupId>com.aspose</groupId>
    <artifactId>aspose-slides-cloud</artifactId>
    <version>22.4.0</version>
 </dependency>
</dependencies>

The next step is to create an account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up to obtain client credentials.

Convert PDF to PPT using Java

In this section, we are going to load the PDF document from cloud storage and convert it to PPT format. The resultant file is also saved in the same cloud storage.

  • First, we need to SlidesApi instance while passing Client ID and Client Secret details as arguments
  • Secondly, read the PDF document using the File instance
  • Now convert file content to Byte array using readAllBytes(…) method
  • Finally, we need to call the importFromPdf(..) method to initiate the conversion routine and save the resultant PowerPoint to Cloud Storage.
PDF to PPT
Convert PDF to PPT in Java | How to convert PDF to PowerPoint using Java

Convert PDF to PowerPoint using cURL Commands

Now we are going to explore the option of converting PDF to PowerPoint using cURL commands in the command line terminal. Before we initiate the conversion process, please execute the following command to generate a JWT access token based on client credentials.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=bbf94a2c-6d7e-4020-b4d2-b9809741374e&client_secret=1c9379bb7d701c26cc87e741a29987bb" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now that we have the JWT token, we are going to execute the following cURL command to load PDF from the local drive and convert the adobe PDF to PPT format. The resultant file is saved in cloud storage.

curl -v -X POST "https://api.aspose.cloud/v3.0/slides/Converted.ppt/fromPdf" \
-H "Content-Type: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-d {"pdf":{@test.pdf}} -v

Conclusion

In this article, we have learned the details on how to develop a PDF to PPT converter online. We have explored the option to convert PDF to PPT using Java code snippets as well as the conversion of PDF to PowerPoint presentation using cURL commands. We have noticed that the conversion is performed with fewer code lines without going into inner complexities.

Please note that the Cloud SDK is open-source and its complete source code is available on GitHub. In case you encounter any issues while using the SDK, please feel free to contact us through the Free customer support forum.

Related Articles

We also recommend visiting the following links to learn more about