# How to add attachment to PDF document This article explains how to attach a file to a PDF document with GroupDocs.Merger for Python via .NET. PDF documents look the same on every device, and they can also keep related files together: other PDF documents, Word documents, Excel spreadsheets, PowerPoint presentations, images, audio or video files can be attached to a PDF document, and they move with it wherever it goes. ## How to add attachment to PDF document 1. Create a `Merger` with the path to the PDF document. 2. Call `merger.import_document()` with a [`PdfAttachmentOptions`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger.domain.options/pdfattachmentoptions/) that names the file to attach. 3. Call `merger.save()` with the path of the result. The following example attaches a PowerPoint presentation to a PDF document: {{< tabs "add-attachment-to-pdf-document" >}} {{< tab "add_attachment_to_pdf_document.py" >}} ```python from groupdocs.merger import Merger from groupdocs.merger.domain.options import PdfAttachmentOptions def add_attachment_to_pdf_document(): with Merger("./input.pdf") as merger: # Attach the presentation to the PDF document attachment_options = PdfAttachmentOptions("./attachment.ppt") merger.import_document(attachment_options) merger.save("./output.pdf") if __name__ == "__main__": add_attachment_to_pdf_document() ``` {{< /tab >}} {{< tab "input.pdf" >}} {{< tab-text >}} `input.pdf` is a sample file used in this example. Click [here](https://docs.groupdocs.com/merger/python-net/_sample_files/developer-guide/import-documents/how-to-add-attachment-to-pdf-document/input.pdf) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "attachment.ppt" >}} {{< tab-text >}} `attachment.ppt` is a sample file used in this example. Click [here](https://docs.groupdocs.com/merger/python-net/_sample_files/developer-guide/import-documents/how-to-add-attachment-to-pdf-document/attachment.ppt) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "output.pdf" >}} ```text Binary file (PDF, 456 KB) ``` [Download full output](https://docs.groupdocs.com/merger/python-net/_output_files/developer-guide/import-documents/how-to-add-attachment-to-pdf-document/add_attachment_to_pdf_document/output.pdf) {{< /tab >}} {{< /tabs >}} ### Explanation - **`PdfAttachmentOptions("./attachment.ppt")`**: names the file to attach. To attach content you already hold in memory, pass its bytes and its extension instead: `PdfAttachmentOptions(data, ".ppt")`. - **`merger.import_document(attachment_options)`**: attaches the file to the loaded PDF document. Its pages do not change. ## API reference - [`Merger`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger/merger/) — `import_document`, `save`. - [`PdfAttachmentOptions`](https://reference.groupdocs.com/merger/python-net/groupdocs.merger.domain.options/pdfattachmentoptions/) — the file to attach. ## See also - [Import documents]({{< ref "merger/python-net/developer-guide/import-documents/_index.md" >}}) - [Merge PDF files]({{< ref "merger/python-net/developer-guide/merge/pdf.md" >}})