Convert Excel to PDF

Convert Excel to PDF

PDF documents are widely used as a standard format of exchanging documents between organizations, government sectors, and individuals. Software developers are often asked to devise a way to easily convert Microsoft Excel files into PDF documents. Aspose.Cells for Python via Java API provides the ability to convert Excel files to PDF documents (including PDF/A). Aspose.Cell’s converts spreadsheets to PDF with a high degree of accuracy and fidelity.

Direct Conversion

To save an Excel file directly to PDF, you may use the Workbook.save method and pass SaveFormat.PDF as the second parameter.

The following code snippet demonstrates the use of SaveFormat.PDF and the Workbook.save method to convert Excel to PDF format.

Advanced Conversion

To have more control over the conversion to PDF, the API provides the PdfSaveOptions class. The PdfSaveOptions class can be used to set different attributes for the conversion. Setting different properties of the PdfSaveOptions class will give you control over the Print, Font, Security, and Compression settings for the resultant PDF file. The most notable property is the Compliance that enables you to save the Excel files to PDF/A compliant PDF files.