Convert Excel to PDF with Java REST API

In this simple topic, you’ll learn how to convert XLS to PDF with Java REST API. We will develop an XLS to PDF converter with Java Low Code API by following the detailed and lucid steps mentioned in the following section. The developed application can be integrated with any Java application supported in Linux, Windows, or macOS environments and conversion can be done for free.

Prerequisite

Steps to Convert XLS to PDF with Java REST API

  1. Set the Client ID and Client Secret for the API to convert XLS to PDF in Java
  2. Create an instance of CellsApi class with client credentials to perform XLS to PDF conversion using Java
  3. Specify the source XLS and output PDF file names and load the source XLS using a name and File object in a HashMap
  4. Create an instance of the PostConvertWorkbookToPDFRequest with input HashMap
  5. Call the Excel to PDF request method to convert XLS to PDF with Java REST API
  6. Save the generated PDF file stream on the local disk

The aforementioned steps transform the file type from Excel to PDF with Java low code API. We will commence the implementation with the initialization by configuring the SDK and creating the CellsAPI class object. We will then access the source XLS file using a FileStream and create an instance of the PostConvertWorkbookToPDFRequest class that is further used for performing the conversion to a PDF file stream using the PostConvertWorkbookToPDF() method.

Code for Excel to PDF Conversion in Java Low Code API

This simple example code lets you convert Excel to PDF with Java cloud API. You are required to give a valid path for the XLS file on the disk with the help of the Aspose.Cells REST API SDK will perform the conversion, and then, after the conversion process is finished with a success response, download the output PDFfile as a string content and then save it locally as a file.

We have verified to transform XLS to PDF with Cloud API in this topic. If you are interested in performing Excel to DOCX conversion, refer to the article on how to Convert Excel to DOCX with Java REST API.

 English