Embed Attachment to PDF with Node.js via C++
Contents
[
Hide
]
In Excel, you can insert an Ole Object with source data (embedded-attachments-example.xlsx). Double click the Ole Object, and the embedded file will be opened.
Generally, while converting to PDF, the Ole Object will be rendered as an icon or a thumbnail without the Ole Object source data. With option PdfSaveOptions.getEmbedAttachments() you can embed the Ole Object source data as an attachment in PDF. You can double-click the icon or the thumbnail in PDF to open the source file of the Ole Object.
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);