
PowerPoint is commonly used to present information in a series of separate pages or slides for group presentations within business organizations. In certain cases, you may need to convert PDF to PowerPoint presentations programmatically. In this article, we will learn how to convert PDF to PowerPoint using a REST API in Node.js.
The following topics shall be covered in this article:
- PDF to PowerPoint Conversion REST API and Node.js SDK
- Convert PDF to PowerPoint using REST API in Node.js
- PDF to PPTX Conversion with Watermark using Node.js
- Convert Range of Pages from PDF to PPTX in Node.js
- Convert Specific Pages of PDF to PPTX in Node.js
- PDF to PPTX Conversion without using Cloud Storage
PDF to PowerPoint Conversion REST API and Node.js SDK
For converting PDF to PPTX, we will be using the Node.js SDK of GroupDocs.Conversion Cloud API. Please install it using the following command in the console:
npm install groupdocs-conversion-cloud
Please get your Client ID and Secret from the dashboard before following the mentioned steps. Once you have your ID and secret, add in the code as shown below:
global.clientId = "da0c487d-c1c0-45ae-b7bf-43eaf53c5ad5"; | |
global.clientSecret = "479db2b01dcb93a3d4d20efb16dea971"; | |
global.myStorage = ""; | |
const config = new groupdocs_conversion_cloud.Configuration(clientId, clientSecret); | |
config.apiBaseUrl = "https://api.groupdocs.cloud"; |
Convert PDF to PowerPoint using REST API in Node.js
We can convert PDF files into PowerPoint presentation slides by following the simple steps given below:
- Upload the PDF file to the Cloud
- Convert PDF to PowerPoint in Node.js
- Download the converted file
Upload the Document
Firstly, we will upload the PDF file to the Cloud using the code example given below:
// Open file in IOStream from local/disc. | |
var resourcesFolder = 'C:\\Files\\Conversion\\sample.pdf'; | |
// Read file | |
fs.readFile(resourcesFolder, (err, fileStream) => { | |
// Construct FileApi | |
var fileApi = groupdocs_conversion_cloud.FileApi.fromConfig(config); | |
// Create upload file request | |
var request = new groupdocs_conversion_cloud.UploadFileRequest("sample.pdf", fileStream, myStorage); | |
// Upload file | |
fileApi.uploadFile(request); | |
}); |
As a result, the uploaded PDF file will be available in the files section of the dashboard on the cloud.
Convert PDF to PowerPoint in Node.js
We can convert PDF documents to PPTX presentations programmatically by following the steps given below:
- Firstly, create an instance of the ConvertApi.
- Next, create an instance of the ConvertSettings.
- Then, set the input PDF file path.
- And, assign “pptx” to format.
- Also, provide the output file path.
- After that, create ConvertDocumentRequest with ConvertSettings as argument.
- Finally, call the ConvertApi.convertDocument() method with ConvertDocumentRequest.
The following code example shows how to convert a PDF document to a PPTX presentation using a REST API in Node.js.
// Initialize api | |
let convertApi = groupdocs_conversion_cloud.ConvertApi.fromKeys(clientId, clientSecret); | |
// Define convert settings | |
let settings = new groupdocs_conversion_cloud.ConvertSettings(); | |
settings.filePath = "sample.pdf"; | |
settings.format = "pptx"; | |
settings.outputPath = "sample.pptx"; | |
// Create convert document request | |
let request = new groupdocs_conversion_cloud.ConvertDocumentRequest(settings); | |
// Convert document | |
let result = await convertApi.convertDocument(request); |

Convert PDF to PowerPoint in Node.js
Download PowerPoint Presentation
The above code sample will save the converted PPTX presentation file on the cloud. It can be downloaded using the following code example:
// Construct FileApi | |
var fileApi = groupdocs_conversion_cloud.FileApi.fromConfig(config); | |
// Create donwload file request | |
let request = new groupdocs_conversion_cloud.DownloadFileRequest("sample.pptx", myStorage); | |
// Download file | |
let response = await fileApi.downloadFile(request); | |
// Save in your working directory | |
fs.writeFile("C:\\Files\\Conversion\\sample.pptx", response, "binary", function (err) { }); |
PDF to PPTX Conversion with Watermark using Node.js
We can convert PDF documents to PowerPoint presentations and add watermarks to converted PPTX presentations programmatically by following the steps given below:
- Firstly, create an instance of the ConvertApi.
- Now, create an instance of the ConvertSettings.
- Then, set the input PDF file path.
- And, assign “pptx” to format.
- Also, provide the output file path.
- Now, create an instance of the WatermarkOptions.
- Then, set Watermark text, color, width, height, left, top, etc.
- Now, define the **PresentationConvertOptions** and assign WatermarkOptions.
- After that, create ConvertDocumentRequest with ConvertSettings as argument.
- Finally, call the convertDocument() method with ConvertDocumentRequest.
The following code example shows how to convert a PDF to PPTX and add a watermark to the converted presentation using a REST API in Node.js. Please follow the steps mentioned earlier to upload and download files.
// Api initialization | |
let convertApi = groupdocs_conversion_cloud.ConvertApi.fromKeys(clientId, clientSecret); | |
// Define convert settings | |
let settings = new groupdocs_conversion_cloud.ConvertSettings(); | |
settings.filePath = "sample.pdf"; | |
settings.format = "pptx"; | |
settings.outputPath = "converted_with_watermark.pptx"; | |
// Define watermark options | |
let watermark = new groupdocs_conversion_cloud.WatermarkOptions(); | |
watermark.text = "CONFIDENTIAL"; | |
watermark.bold = true; | |
watermark.fontSize = 30; | |
watermark.color = "Gray"; | |
watermark.background = false; | |
watermark.rotationAngle = 0; | |
watermark.left = 200; | |
watermark.top = 250; | |
// Define convert options | |
let convertOptions = new groupdocs_conversion_cloud.PresentationConvertOptions(); | |
convertOptions.watermarkOptions = watermark; | |
settings.convertOptions = convertOptions | |
// Define convert document request | |
let request = new groupdocs_conversion_cloud.ConvertDocumentRequest(settings); | |
// Convert document | |
let result = await convertApi.convertDocument(request); | |
console.log("Document converted successfully: " + result[0].url); |

PDF to PPTX Conversion with Watermark using Node.js
Convert Range of Pages from PDF to PPTX in Node.js
We can convert a range of pages from PDF documents to PPTX presentations programmatically by following the steps given below:
- Firstly, create an instance of the ConvertApi.
- Next, create an instance of the ConvertSettings.
- Then, set the input PDF file path.
- And, assign “pptx” to format.
- Also, provide the output file path.
- Next, create an instance of the PresentationConvertOptions.
- Then, set a page range to convert from start page number as fromPage and total pages to convert as pagesCount.
- After that, create ConvertDocumentRequest with ConvertSettings as argument.
- Finally, call the ConvertApi.convertDocument() method with ConvertDocumentRequest.
The following code example shows how to convert a range of pages from PDF to PPTX using a REST API in Node.js.
// Initialize api | |
let convertApi = groupdocs_conversion_cloud.ConvertApi.fromKeys(clientId, clientSecret); | |
// Define convert settings | |
let settings = new groupdocs_conversion_cloud.ConvertSettings(); | |
settings.filePath = "sample.pdf"; | |
settings.format = "pptx"; | |
settings.outputPath = "convert_pages_range.pptx"; | |
// Define convert options | |
let convertOptions = new groupdocs_conversion_cloud.PresentationConvertOptions(); | |
convertOptions.fromPage = 1; | |
convertOptions.pagesCount = 2; | |
settings.convertOptions = convertOptions | |
// Create convert document request | |
let request = new groupdocs_conversion_cloud.ConvertDocumentRequest(settings); | |
// Convert document | |
let result = await convertApi.convertDocument(request); | |
console.log("Document converted successfully: " + result[0].url); |
Convert Specific Pages of PDF to PPTX in Node.js
We can convert specific pages of PDF documents to PPTX presentations programmatically by following the steps given below:
- Firstly, create an instance of the ConvertApi.
- Next, create an instance of the ConvertSettings.
- Then, set the input PDF file path.
- And, assign “pptx” to format.
- Also, provide the output file path.
- Next, create an instance of the PresentationConvertOptions.
- Then, provide specific page numbers in a comma-separated array to convert.
- After that, create ConvertDocumentRequest with ConvertSettings as argument.
- Finally, call the ConvertApi.convertDocument() method with ConvertDocumentRequest.
The following code example shows how to convert specific pages from a PDF to PPTX using a REST API in Node.js.
// Initialize api | |
let convertApi = groupdocs_conversion_cloud.ConvertApi.fromKeys(clientId, clientSecret); | |
// Define convert settings | |
let settings = new groupdocs_conversion_cloud.ConvertSettings(); | |
settings.filePath = "sample.pdf"; | |
settings.format = "pptx"; | |
settings.outputPath = "specific_pages.pptx"; | |
// Define convert options | |
let convertOptions = new groupdocs_conversion_cloud.PresentationConvertOptions(); | |
convertOptions.pages = [2,3]; | |
settings.convertOptions = convertOptions | |
// Create convert document request | |
let request = new groupdocs_conversion_cloud.ConvertDocumentRequest(settings); | |
// Convert document | |
let result = await convertApi.convertDocument(request); | |
console.log("Document converted successfully: " + result[0].url); |
PDF to PPTX Conversion without using Cloud Storage
We can convert PDF documents to PPTX presentations without using cloud storage by passing it in the request body and receiving the output file in the API response. Please follow the steps given below to convert a PDF to PPTX without using cloud storage.
- Firstly, create an instance of the ConvertApi.
- Next, read input PDF file from local path.
- After that, create ConvertDocumentDirectRequest with output format and input file as arguments.
- Finally, get results by calling the ConvertApi.convertDocumentDirect() method with ConvertDocumentDirectRequest.
The following code example shows how to convert a PDF document to a PPTX presentation without using cloud storage in Node.js.
// Initialize api | |
let convertApi = groupdocs_conversion_cloud.ConvertApi.fromKeys(clientId, clientSecret); | |
// Read the input file | |
let file = fs.readFileSync('C:\\Files\\Conversion\\sample.pdf'); | |
// Create convert document request | |
let request = new groupdocs_conversion_cloud.ConvertDocumentDirectRequest("pptx", file); | |
// Convert document | |
let result = await convertApi.convertDocumentDirect(request); | |
// Save the output file | |
fs.writeFile("C:\\Files\\Conversion\\sample_direct.pdf", result, "binary", function (err) { }); |
Try Online
Please try the following free online PDF conversion tool, which is developed using the above API. https://products.groupdocs.app/conversion/
Conclusion
In this article, we have learned how to convert a PDF to PowerPoint presentation on the cloud. We have also seen how to convert specific pages or a range of pages from a PDF to PPTX using Node.js. This article also explained how to programmatically upload a PDF file to the cloud and then download the converted PPTX file from the Cloud. Besides, 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.