Embed Attachment to PDF

Contents
[ ]

In Excel, you can insert an Ole Object with source data(embedded-attachments-example.xlsx) . Double click the Ole Object, 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.EmbedAttachments, you can embed the Ole Object source data as attachment in PDF. You can double click the icon or the thumbnail in PDF to open the source file of the Ole Object.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// Open the template file
Workbook wb = new Workbook("embedded-attachments-example.xlsx");
// Set to embed Ole Object attachment.
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setEmbedAttachments(true);
// Save the pdf file with PdfSaveOptions
wb.save("output.pdf", pdfSaveOptions);

embedded-attachment.png