DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • How To Convert Common Documents to PNG Image Arrays in Java
  • How To Convert ODF Files to PDF in Java
  • How to Convert a PDF to Text (TXT) Using Java
  • How to Convert PDF to Text in Java

Trending

  • Tired of Spring Overhead? Try Dropwizard for Your Next Java Microservice
  • The Smart Way to Talk to Your Database: Why Hybrid API + NL2SQL Wins
  • Chat With Your Knowledge Base: A Hands-On Java and LangChain4j Guide
  • GitHub Copilot's New AI Coding Agent Saves Developers Time – And Requires Their Oversight
  1. DZone
  2. Coding
  3. Java
  4. How to Convert a PowerPoint to PDF in Java

How to Convert a PowerPoint to PDF in Java

Convert Office PowerPoint Documents (pptx) and Office PowerPoint (97-2003) Documents (ppt) to standard PDF

By 
Brian O'Neill user avatar
Brian O'Neill
DZone Core CORE ·
Sep. 24, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
9.8K Views

Join the DZone community and get the full member experience.

Join For Free

You use PowerPoint to present findings and data or propose new ideas, whether its within your team, to investors, or to clients. With the ability to choose graphics and color schemes that help reflect your tone and brand, it is a wonderful tool in helping educate and persuade your audience. The simplicity and visual appeal of PowerPoint slides has made it the go-to application for presentation design, and it is used as the default presentation software for many organizations.  

Having your PowerPoint converted to PDF format will give you the ability to more easily share information with your audience. This simple act will help your audience remember your organization, and they can use the document as reference when making any decisions.  For example, you might use PowerPoint to create a brochure template that could then be populated with client data using input text; this customized brochure could then be converted to PDF using this API in Java and shared with clients for a personalized experience. However, you might even need it for something as simple as converting your PowerPoint to PDF to print and provide as notes for your audience. All of this will help show your professionalism and preparedness.  

To access all these benefits, and work without fear of formatting errors caused by the conversion, you can use the following Convert APIs to quickly and easily convert any PPTX or PPT to PDF using Java. 

The PPTX format is the most up-to-date in PowerPoint and is compatible with current Office software. To begin the conversion process with the following API, you will first need to install our reference client. 

To install with Maven, add a reference to the repository in pom.xml: 

XML
 




x
11
9


 
1
<repositories> 
2
    <repository> 
3
        <id>jitpack.io</id> 
4
        <url>https://jitpack.io</url> 
5
    </repository> 
6
</repositories> 



Then, add a reference to the dependency in pom.xml:  

XML
 




xxxxxxxxxx
1
13
9
10
9


 
1
<dependencies> 
2
<dependency> 
3
    <groupId>com.github.Cloudmersive</groupId> 
4
    <artifactId>Cloudmersive.APIClient.Java</artifactId> 
5
    <version>v3.54</version> 
6
</dependency> 
7
</dependencies> 



If you’d like to install with Gradle, add this code block in your root build.gradle at the end of repositories:  

Java
 




x


 
1
allprojects {
2
    repositories {
3
        ...
4
        maven { url 'https://jitpack.io' }
5
    }
6
}



Then, add the dependency in build.gradle:  

Java
 




xxxxxxxxxx
1


 
1
dependencies {
2
        implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java:v3.54'
3
}



After these install steps, you can call the function, ConvertDocumentPptxToPdf:  

Java
 
xxxxxxxxxx
1
24
 
1
// Import classes:
2
//import com.cloudmersive.client.invoker.ApiClient;
3
//import com.cloudmersive.client.invoker.ApiException;
4
//import com.cloudmersive.client.invoker.Configuration;
5
//import com.cloudmersive.client.invoker.auth.*;
6
//import com.cloudmersive.client.ConvertDocumentApi;
7

          
8
ApiClient defaultClient = Configuration.getDefaultApiClient();
9

          
10
// Configure API key authorization: Apikey
11
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
12
Apikey.setApiKey("YOUR API KEY");
13
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
14
//Apikey.setApiKeyPrefix("Token");
15

          
16
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
17
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
18
try {
19
    byte[] result = apiInstance.convertDocumentPptxToPdf(inputFile);
20
    System.out.println(result);
21
} catch (ApiException e) {
22
    System.err.println("Exception when calling ConvertDocumentApi#convertDocumentPptxToPdf");
23
    e.printStackTrace();
24
}


Now, you can fully automate the conversion process from PPTX to PDF. However, what happens if you are working with an older version of PowerPoint? If you need to run the function on a PPT file, the process is very similar. We start with the same install steps for our client software, as shown above.

Now, you can call your function for PPT, ConvertDocumentPptToPdf:  

Java
x
24
 
1
// Import classes:
2
//import com.cloudmersive.client.invoker.ApiClient;
3
//import com.cloudmersive.client.invoker.ApiException;
4
//import com.cloudmersive.client.invoker.Configuration;
5
//import com.cloudmersive.client.invoker.auth.*;
6
//import com.cloudmersive.client.ConvertDocumentApi;
7

          
8
ApiClient defaultClient = Configuration.getDefaultApiClient();
9

          
10
// Configure API key authorization: Apikey
11
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
12
Apikey.setApiKey("YOUR API KEY");
13
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
14
//Apikey.setApiKeyPrefix("Token");
15

          
16
ConvertDocumentApi apiInstance = new ConvertDocumentApi();
17
File inputFile = new File("/path/to/inputfile"); // File | Input file to perform the operation on.
18
try {
19
    byte[] result = apiInstance.convertDocumentPptToPdf(inputFile);
20
    System.out.println(result);
21
} catch (ApiException e) {
22
    System.err.println("Exception when calling ConvertDocumentApi#convertDocumentPptToPdf");
23
    e.printStackTrace();
24
}


In order to call this function effectively, retrieve your API Key at no cost from the Cloudmersive website. Our base level access provides up to 800 calls across our library of APIs, and we can provide higher levels of service scalable to your needs and software demands. 

PDF Java (programming language) Convert (command)

Opinions expressed by DZone contributors are their own.

Related

  • How To Convert Common Documents to PNG Image Arrays in Java
  • How To Convert ODF Files to PDF in Java
  • How to Convert a PDF to Text (TXT) Using Java
  • How to Convert PDF to Text in Java

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!