Skip to main content

Add Attachment to PDF in n8n

Add Attachment to PDF is a PDF4me node action in n8n that embeds one or more files inside a PDF, so a spreadsheet, image, archive, or second PDF travels with the document instead of alongside it. Use it to bundle supporting evidence with a contract, ship raw data next to a report, or package certificates with a compliance filing.

What this node does

PDF4me: Add Attachment To PDF takes a host PDF from Binary Data, a Base64 String, or a URL, then embeds each file you list under Attachments inside it as a separate object. Unlike merging, the attached files keep their own format and filename and can be opened or saved out individually by the recipient. Each attachment can come from a different source, so a binary file from an earlier node and a file fetched from a URL can be embedded in the same run.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate attachment requests securely.

Important Facts You Should Not Miss

Attaching is not merging
An attached file stays a separate object the reader can save back out. Merging flattens page content into one continuous document instead.
Attachments is a repeatable collection
Click Add Attachment once per file. Each entry carries its own content type, name, and source, so you can mix binary, base64, and URL sources in one run.
The file extension matters
Attachment Name is what tells a reader application how to open the extracted file, so always include the correct extension such as .xlsx or .zip.
PDF4me node in n8n set to Action Add Attachment To PDF, Input Data Type Binary Data, Input Binary Field data, Output File Name document_with_attachments.pdf, Document Name document.pdf, and an empty Attachments collection with an Add Attachment button

PDF4me Add Attachment To PDF parameters panel in n8n, with the Attachments collection empty before the first entry is added

Attaching vs Merging vs Zipping

Three ways to deliver several files as one thing, with different consequences for the recipient.

ApproachWhat the recipient getsBest fit
Add Attachment to PDFOne PDF that opens normally, with the extra files available in the attachments panelSupporting material that must stay in its original format, such as a spreadsheet or an archive
Merge PDFsOne continuous document where all pages read in sequenceContent that genuinely belongs together as a single readable document
Zip the files togetherAn archive that must be unpacked before anything can be readBulk transfer where nothing needs to be readable without extracting first

What Parameters Does Add Attachment to PDF Need?

Required: Action, Input Data Type, the field matching that input type, Output File Name, Document Name, and at least one entry under Attachments. Binary Data Output Name and Custom Profiles carry working defaults.

ParameterRequiredWhat it doesExample
ActionRequiredSelects the PDF4me node action to run. Choose Add Attachment To PDF.Add Attachment To PDF
Input Data TypeRequiredFormat of the host PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the host PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the host PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the host PDF. Required when Input Data Type is URL.https://example.com/contract.pdf
Output File NameRequiredFilename for the PDF returned with the files embedded. Include the .pdf extension.document_with_attachments.pdf
Document NameRequiredFilename of the source PDF, used for reference and tracking on the request.document.pdf
AttachmentsRequiredCollection of files to embed. Click Add Attachment once per file, then fill in the per-attachment fields listed below.One entry per embedded file
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data
Custom ProfilesOptionalAdvanced Options field for extra processing settings, supplied in a JSON-like format. Leave blank unless you have a specific profile to apply.{ "preserveMetadata": true }

Fields Inside Each Attachment Entry

Every entry you create with Add Attachment exposes its own set of fields.

ParameterRequiredWhat it doesExample
Attachment Content TypeRequiredHow this particular attachment is supplied. Choose Binary Data, Base64 Content, or File URL. Each entry can differ.Binary Data
Attachment NameRequiredFilename the embedded file will carry inside the PDF. Include the correct extension so readers can open it after extraction.supporting_data.xlsx
Binary Field NameConditionalName of the binary property holding this attachment. Required when Attachment Content Type is Binary Data.data
Base64 ContentConditionalBase64-encoded content of this attachment. Required when Attachment Content Type is Base64 Content.SGVsbG8gV29ybGQ=
File URLConditionalPublicly reachable HTTPS URL to this attachment. Required when Attachment Content Type is File URL.https://example.com/certificate.pdf

Output Fields

A successful run returns one n8n item carrying the PDF with its embedded files.

FieldTypeWhat it contains
Binary (data)BinaryThe PDF with all listed files embedded, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes, including the embedded files.
attachmentCountNumberNumber of attachments successfully embedded. Compare it against your expected count to catch a silently skipped file.
successBooleanTrue when the attachment operation completed, false on failure. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

How Do I Set Up Add Attachment to PDF in n8n?

  1. Add PDF4me to your n8n workflow and choose the Add Attachment To PDF action.
  2. In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
  3. Set Input Data Type to Binary Data (default), Base64 String, or URL and supply the matching host PDF field.
  4. Under Attachments, click Add Attachment once for each file, then set its Attachment Content Type, Attachment Name, and matching source field.
  5. Set Output File Name (must end in .pdf) and Document Name for the source file.
  6. Execute the node and route the returned PDF onward, checking attachmentCount against the number of files you expected.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Add Attachment to PDF.
Invoice with supporting receipts
  1. An invoice PDF is generated from billing data.
  2. Add Attachment to PDF embeds the matching receipts and the approval record.
  3. One file goes to accounts payable with its whole evidence trail inside it.
Report with its source data
  1. A scheduled analytics report is rendered to PDF.
  2. Add Attachment to PDF embeds the underlying CSV export as a named attachment.
  3. Readers get the narrative and can pull the raw numbers out when they want to verify them.
Contract with annexes
  1. A contract is produced from a template on signature request.
  2. Add Attachment to PDF embeds certificates and schedules pulled from URLs.
  3. The counterparty receives a single self-contained document to sign.
Compliance bundle for audit
  1. A Loop Over Items node gathers evidence files for a filing period.
  2. Add Attachment to PDF embeds each one into the cover filing document.
  3. The bundle is archived, and Extract Attachment From PDF can unpack it later on request.

Practical Tips

Always include the file extension in Attachment Name
The extension is what tells a reader application how to open the extracted file. A name without one leaves the recipient guessing.
Check attachmentCount against what you sent
Comparing the returned count to the number of entries you configured is the quickest way to catch a file that failed to embed.
Mention the attachments in the document body
Not every viewer surfaces the attachments panel, so a line of visible text telling the reader that supporting files are embedded prevents them being missed.
Mix sources freely within one run
Each entry has its own content type, so a binary file from an earlier node and a URL-hosted certificate can be embedded together.
Attach when format must survive, merge when it should not
A spreadsheet stays usable as a spreadsheet only if it is attached. Merging would flatten it into page content.
Watch the total size on outbound email
Embedded files count toward the PDF size, so a bundle of large attachments can push the document past a mail gateway limit.

Cheat Sheet

FieldValue
ActionAdd Attachment To PDF
Input Data TypeBinary Data
Input Binary Fielddata
Output File Namedocument_with_attachments.pdf
Document Namedocument.pdf
AttachmentsOne entry per file, added with Add Attachment
Attachment Content TypeBinary Data
Attachment Namesupporting_data.xlsx
Binary Data Output Namedata
CredentialsPDF4me API credential

Common Questions

What is the difference between attaching a file to a PDF and merging PDFs?+
Merging combines page content into one continuous document, so the source files stop existing as separate items. Attaching embeds a file inside the PDF as a discrete object that a reader can open or save back out on its own, keeping the original format intact. Use merge when everything should read as one document, and attach when a spreadsheet, archive, or certificate needs to stay a separate file.
Can I attach more than one file in a single run?+
Yes. Attachments is a collection, so click Add Attachment once per file you want to embed. Each entry gets its own Attachment Content Type, Attachment Name, and source field, which means you can mix a binary file from a previous node with another pulled from a URL in the same request.
What file types can be attached to a PDF?+
Attachments are stored as embedded file objects rather than being converted, a mechanism defined in the ISO 32000 PDF specification, so common document, image, spreadsheet, presentation, archive, and data formats can all be carried. What matters is that Attachment Name includes the correct extension, because that is what tells a reader application how to open the file once extracted.
Will everyone be able to see the attachments?+
Embedded files are exposed through the attachments or bookmarks panel of a full PDF reader. Lightweight in-browser or mobile viewers sometimes do not surface that panel, so if attachments are essential to the recipient, mention in the document body that supporting files are embedded.
How do I get the attachments back out of a PDF later?+
Use the Extract Attachment From PDF action, which is the inverse operation. A common pattern is one n8n workflow that bundles supporting files into an outgoing PDF, and a second that extracts them again when the document comes back.

Same Task on Other Platforms

Get Help