Embed Attachment to PDF with Python.NET
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)