Convert Excel Files to PDF on Linux using Java

Convert Excel to PDF Linux

In various cases, you need to convert the Excel spreadsheets to PDF format, for example, to print or share the worksheets. In this article, you’ll learn how to convert Excel files to PDF format on the Linux platform using Java. Furthermore, you’ll come to know about different options to customize the Excel to PDF conversion.

Excel to PDF Converter API for Linux

In order to convert Excel files to PDF format, we will use Aspose.Cells for Java. It is a feature-rich API that lets you create, manipulate, and convert Excel files seamlessly. You can download the API’s JAR or install it using the following Maven configurations.

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

Convert Excel XLS or XLSX to PDF on Linux

The following are the steps to convert an Excel XLS or XLSX file to PDF on Linux.

The following code sample shows how to convert XLSX to PDF.

Specify Compliance Level in Excel to PDF Conversion

PDF format supports various compliance standards such as PDF/A and etc. Aspose.Cells for Java allows specifying the desired PDF compliance level in Excel to PDF conversion. To achieve this, the API provides the PdfSaveOptions class. The following are the steps to specify the compliance level for the output PDF.

The following code sample shows how to convert an Excel XLSX file to PDF format with a particular PDF standard.

Convert Specific Excel Sheets to PDF on Linux

In certain cases, you may need to convert a range of sheets instead of the whole Excel file. For this, you can specify the range of sheets to be converted using PdfSaveOptions.setPageIndex(int) and PdfSaveOptions.setPageCount(int) methods.

The following code sample shows how to convert a range of Excel sheets to PDF.

Conclusion

In this article, you have learned how to convert Excel files to PDF on the Linux platform. Moreover, you have seen how to customize Excel to PDF conversion with various options. You can learn more about Aspose.Cells for Java using the documentation. In case you would have any questions, feel free to let us know via our forum.

See Also