通过Node.js via C++嵌入附件到PDF

Contents
[ ]

在Excel中,你可以插入带有源数据的Ole对象(embedded-attachments-example.xlsx)。双击Ole对象,嵌入的文件将被打开。

一般情况下,在转换为PDF时,Ole对象会以图标或缩略图的形式渲染,而不显示Ole对象的源数据。通过选项PdfSaveOptions.getEmbedAttachments(),可以将Ole对象的源数据作为附件嵌入到PDF中。在PDF中双击图标或缩略图即可打开Ole对象的源文件。

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

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "embedded-attachments-example.xlsx");

// Open the template file
const wb = new AsposeCells.Workbook(filePath);

// Set to embed Ole Object attachment.
const pdfSaveOptions = new AsposeCells.PdfSaveOptions();
pdfSaveOptions.setEmbedAttachments(true);

// Save the pdf file with PdfSaveOptions
wb.save("output.pdf", pdfSaveOptions);

embedded-attachment.png