Convert XLSB to PDF in Java

XLS to PDF
Learn how to convert Excel to PDF Online

An (XLSB) Binary file format is a collection of records and structures that specify Excel workbook content. The content may include unstructured or semi-structured tables of numbers, text, or both numbers and text, formulas, external data connections, charts, and images. On the other end, PDF provides the capability to view content on any platform without compromising fidelity. Therefore owing to this capability, we are going to discuss the details on how to programmatically convert XLSB to PDF using Java SDK.

Excel to PDF Conversion API

Aspose.Cells Cloud SDK for Java is our award-winning solution providing the capabilities to create, edit and convert popular Excel files to PDF, HTML, TIFF, CSV, and various other supported file formats. Now in order to use the SDK, we are going to add the following reference in pom.xml of the maven build type.

<repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <name>Aspose Java API</name>
        <url>https://repository.aspose.cloud/repo/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-cells-cloud</artifactId>
        <version>22.5</version>
    </dependency>
</dependencies>

Now in order to use Cloud SDK, you need to register an account over Aspose Cloud and lookup/create Client ID and Client Secret at Cloud Dashboard.

Convert Excel to PDF in Java

In the following section, we are going to discuss the details on how to convert an XLSB to PDF format and save the output in Cloud storage.

  • Create an instance of CellsApi while providing client credentials as input arguments
  • Specify the name of input XLSB, resultant format, and output file name
  • Upload the input XLSB to cloud storage using uploadFile(…) method
  • Finally, call the method cellsWorkbookGetWorkbook(…) to initiate the conversion operation

The sample files used in the above example can be downloaded from

XLS to PDF
Image 1:- XLSB to PDF conversion preview

XLSB to PDF using cURL Commands

In this section, we are going to use cURL commands to load XLSB from cloud storage and convert it to PDF format. So as a pre-requisite, we need to first 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"

Once the JWT token is generated, please execute the following command to perform the conversion.

curl -v -X GET "https://api.aspose.cloud/v3.0/cells/input.xlsb?format=PDF&isAutoFit=false&onlySaveTable=false&outPath=Converted.pdf&checkExcelRestriction=true" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>"

Conclusion

In this article, we have discussed the details regarding the conversion of Excel to PDF using Java code snippets. Similarly, we have also explored the option to convert XLS to PDF using cURL commands. You may consider exploring product documentation to learn about other exciting features offered by the API.

If you encounter any issues while using the APIs, please feel free to contact us via the product support forum.

Related Articles

We highly recommend visiting the following links to learn more about: