Embed Attachment to PDF with Python.NET

Contents
[ ]

In Excel, you can insert an OLE Object with source data (embedded-attachments-example.xlsx). Double-click the OLE Object to open the embedded file.

When converting to PDF, the OLE Object is typically rendered as an icon or thumbnail without source data. Using the PdfSaveOptions.embed_attachments property, you can embed the OLE Object’s source data as an attachment in PDF. Users can double-click the icon/thumbnail in PDF to access the embedded file.

from aspose.cells import Workbook, PdfSaveOptions

# Open the template file
wb = Workbook("embedded-attachments-example.xlsx")

# Set to embed OLE Object attachment.
pdf_save_options = PdfSaveOptions()
pdf_save_options.embed_attachments = True

# Save the PDF file with PdfSaveOptions
wb.save("output.pdf", pdf_save_options)

embedded-attachment.png