Convert Excel to PDF Java

Excel to PDF conversion might be required in various scenarios for exporting tabular data from worksheets to PDF pages. In this article, you’ll learn how to convert Excel files to PDF using Java in order to automate XLS/XLSX to PDF conversion within your web or desktop applications.

Java Excel to PDF Converter - Free Download

Aspose.Cells for Java is a well-known spreadsheet processing API that lets you create, manipulate, and convert Excel XLS/XLSX and other spreadsheet formats quite easily. With a few lines of code and easy to use methods, you can perform quality Excel to PDF conversion with high fidelity. Aspose.Cells for Java can be downloaded as JAR or installed using the following Maven configurations.


    <name>Aspose Java API</name>



Convert Excel XLS to PDF in Java

The following are the steps to convert an Excel XLS or XLSX file to PDF in Java. The links to API references let you explore more about the classes and methods of the API.

The following code sample shows how to convert an XLSX to PDF in Java.

Java Save Excel XLS as PDF - Set PDF Compliance

PDF format supports various compliance standards such as PDF/A and etc. Being compliant with a particular standard means that the file fulfills the requirements or rules defined in that standard. In order to convert Excel to PDF with a particular compliance standard, you can use the PdfSaveOptions class.

The following are the steps to set a particular compliance standard in Excel to PDF conversion.

The following code sample shows how to convert XLSX to PDF with a particular PDF standard using Java.

Export Excel XLSX to PDF in Java - One Page Per Sheet

By default, the API renders the worksheets according to the page size in the PDF document. In this case, one worksheet can possibly be rendered on multiple pages in the PDF. In order to override this operation, you can configure the API to render all the content of a worksheet on one page using PdfSaveOptions.setOnePagePerSheet(boolean) method.

The following code sample shows how to convert Excel XLSX to PDF with one page per sheet settings in Java.

Java Excel to PDF - Export Range of Sheets to PDF

In certain cases, you may need to convert only a selective range of the Excel sheets instead of the whole workbook. In such a case, you can tell the API about the range of the sheets to be included in the rendering process using PdfSaveOptions.setPageIndex(int) and PdfSaveOptions.setPageCount(int) methods.

The following code sample shows how to render a range of sheets in Excel XLS to PDF using Java.


In this article, you have learned how to convert Excel files to PDF using Java. Furthermore, you have seen how to customize Excel to PDF conversion in various scenarios.

Excel to PDF Java Converter - Read More

Aspose.Cells for Java provides a bunch of exciting and useful features. You can explore those features using the documentation.

See Also