An XLSB is an excel binary file format, and 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 formats to PDF, HTML, TIFF, CSV, and other supported file formats. Its powerful and flexible features, this cloud-based API provides a simple and efficient solution for converting Excel spreadsheets to PDF format. 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 a free 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
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>"
In this article, we have discussed the details for developing a powerful and flexible solution for converting Excel spreadsheets to JSON format. The API is equally capable of converting a single spreadsheet as well as multiple spreadsheets at once. So with the help of Aspose.Cells Cloud SDK for Java, develop a reliable and efficient solution for conversion the Excel to PDF. At the same time, take the leverage of REST architecture by converting XLS to PDF using cURL commands.
Nevertheless, we highly encourage you to explore the product documentation and learn about other exciting features offered by the API. Lastly, if you encounter any issue while using the API, please feel free to contact us via the product support forum.
We highly recommend visiting the following links to learn more about: