Convert XLSX to PDF, XPS, TIFF, and HTML with REST Java API

XLSX to PDF conversion

Microsoft Excel files are widely used for office data management and information manipulation on Windows and macOS platforms. Many users also use OpenOffice (ODS), SpreadsheetML(XML), CSV, and other formats for data storage and distribution. However, in order to view these documents, you need to have a specific application. So, for convenience, XLSX files can be converted to PDF format. Or you may convert them to other formats of your choice such as PDF, DOCX, HTML, raster images (JPEG, PNG, BMP, etc), XPS, etc.

Albeit, Microsoft Excel and other applications provide the capabilities to render XLSX, PDF, or image formats, but for that purpose, you again need to install the software. Furthermore, when you need to perform the conversion for a bulk of documents, it gets quite cumbersome to individually convert these documents. Therefore in such situations, a software routine can be employed to do the conversion job. Again, when we talk about hassle-free environment setup with minimal efforts, cloud APIs are the best choice. You do not need to install any particular software and all the conversion can be performed over the cloud. Considering all these aspects, Aspose.Cells Cloud is the best available option to perform MS Excel worksheet creation, manipulation, and conversion.

Aspose.Cells structure

Aspose.Cells Cloud is developed on top of REST APIs and are accessible from any platform. Furthermore, the language-specific cloud SDKs are also available so that you can use your preferred programming language. Similarly, for manipulation or rendering of Excel spreadsheet using Java language, you need to try using Aspose.Cells Cloud SDK for Java. Please note that our APIs are also password secured so that only authorized personnel can store and access them. Before further embark our journey on learning about conversion features, we recommend you to go through the following topics

Aspose.Cells Cloud supports leading industry file formats for both input and output operations. The details are available over the following link Supported File Formats.

Following topics are explained in more details

XLSX conversion to PDF

In order to perform the conversion of the XLSX file to PDF format, we may try using the cURL command over command prompt or use Java code to fulfill this requirement in desktop or web applications.

cURL command

curl -X GET "https://api.aspose.cloud/v3.0/cells/conditional.xlsx?format=PDF&isAutoFit=true&onlySaveTable=false&outPath=resultant.pdf" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>"

In the above command, conditional.xlsx is the input excel worksheet, PDF is the resultant format and resultant.pdf is the name of the output file. After the command execution, the resultant PDF stores over cloud storage. The sample files are available on

Java

In order to render the Excel worksheet to PDF format using Java code, we need to first create an object of CellsApi object by passing clientID and clientSecret information as an argument. Then call a method cellsWorkbookGetWorkbook(…) to render the output in PDF format.

Convert XLSX to XPS

In order to convert the XLSX file to XPS format, we simply need to set the value of the format variable as XPS. Use any XPS viewer to view the resultant file. We recommend using our free XPS viewer App (the preview is shown below). Download the input file from conditional.xlsx.

XPS file preview
Image 1:- Preview of resultant XPS file.

How to convert XLSX to TIFF

Use GetWorkBook method of API to save XLSX files to TIFF image format. All you need to do is provide the input excel worksheet as input and specify the output format value as TIFF.

cURL command

curl -X GET "https://api.aspose.cloud/v3.0/cells/conditional.xlsx?format=TIFF&isAutoFit=true&onlySaveTable=false&outPath=resultant.tiff" \
-H  "accept: multipart/form-data" \
-H  "authorization: Bearer <JWT Token>"

Use the following links to download conditional.xlsx and resultant.tiff.

TIFF file preview
Image 2:- Preview of resultant TIFF file.

Conclusion

Aspose.Cells Cloud is an amazing REST API offering capabilities to create, manipulate. It is fully capable of transforming popular excel formats to PDF, XPS, SVG, TIFF, HTML, and various other formats. All these operations can be performed using few code lines.