使用标准大小或最小大小将Excel保存为PDF
Contents
[
Hide
]
默认情况下,Aspose.Cells会将Excel保存为标准大小的PDF。但是,您还可以使用PdfSaveOptions.optimization_type属性将其保存为最小大小。它接受以下值
- PdfOptimizationType.STANDARD
- PdfOptimizationType.MINIMUM_SIZE
使用Aspose.Cells for Python via .NET将Excel保存为标准或最小尺寸的PDF。
下面的示例代码显示了如何使用PdfSaveOptions.optimization_type属性将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
from aspose.cells import PdfSaveOptions, Workbook | |
from aspose.cells.rendering import PdfOptimizationType | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Load excel file into workbook object | |
workbook = Workbook(dataDir + "SampleBook.xlsx") | |
# Save into Pdf with Minimum size | |
opts = PdfSaveOptions() | |
opts.optimization_type = PdfOptimizationType.MINIMUM_SIZE | |
workbook.save(dataDir + "OptimizedOutput_out.pdf", opts) |