ノード.js経由でC++を使用してPDFに添付ファイルを埋め込む
Contents
[
Hide
]
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);