使用标准大小或最小大小将Excel保存为PDF
Contents
[
Hide
]
默认情况下,Aspose.Cells 会将 Excel 保存为标准大小的 PDF。但是,你也可以使用 PdfSaveOptions.OptimizationType 属性将其保存为最小尺寸的PDF。它接受以下值
使用 Microsoft Excel 将 Excel 保存为标准或最小尺寸的 PDF
以下截图展示了如何使用 Microsoft Excel 将 Excel 保存为标准或最小尺寸的 PDF
使用 Aspose.Cells 将 Excel 保存为标准或最小尺寸的 PDF
以下示例代码展示了如何使用 PdfSaveOptions.OptimizationType 属性将 Excel 保存为标准或最小尺寸的 PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
String dataDir = Utils.getDataDir(SaveExcelToPDF.class); | |
// Load excel file into workbook object | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Save into Pdf with Minimum size | |
PdfSaveOptions opts = new PdfSaveOptions(); | |
opts.setOptimizationType(PdfOptimizationType.MINIMUM_SIZE); | |
workbook.save(dataDir + "output.pdf", opts); |