使用 Node.js 和 C++ 将 Excel 保存为标准或最小尺寸的 PDF

使用 Aspose.Cells for Node.js via C++ 将 Excel 保存为标准或最小尺寸的 PDF

以下示例代码展示了如何使用 PdfSaveOptions.getOptimizationType() 属性,将 Excel 保存为标准或最小尺寸的 PDF。

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "SampleBook.xlsx");
// Load excel file into workbook object
const workbook = new AsposeCells.Workbook(filePath);

// Save into Pdf with Minimum size
const opts = new AsposeCells.PdfSaveOptions();
opts.setOptimizationType(AsposeCells.PdfOptimizationType.MinimumSize);

workbook.save(path.join(dataDir, "OptimizedOutput_out.pdf"), opts);