Other PDF Issues

How to Send a PDF and XML File in the Same Email

Camila MilosovichCamila Milosovich Nov 3, 2026 869 views

Question details

The user wants to email a completed PDF form along with its corresponding XML form data in a single email for archiving and reporting purposes.

How to Send a PDF and XML File in the Same Email
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Automating the submission or archiving of a completed PDF form alongside its extracted XML data via email.
Observed behavior
Standard PDF scripting normally only allows sending either the PDF document itself or the XML form data, failing to send both as separate attachments in one email.
Before you start

Ensure you have access to a professional PDF editor like Adobe Acrobat Pro or WPS Office, as basic PDF readers do not support embedding file attachments or running advanced form scripts.

Solution 1Recommended

Embed the XML Data Inside the PDF Before Emailing

Since standard PDF scripts cannot attach two separate files to an email, the best workaround is to embed the XML file directly into the PDF document itself.

Acrobat's built-in JavaScript API for email is restricted to sending either the active PDF document or the extracted form data. It cannot generate an email with two separate attachments.

To bypass this limitation, you can attach the XML data file as an embedded object within the PDF. When the PDF is emailed, the XML file travels securely inside it, allowing the recipient to extract it upon receipt.

1
Extract the XML Data

Use your PDF editor's form data export feature to save the completed form fields as an XML file on your local drive.

2
Open the Attachments Panel

In Adobe Acrobat Pro or your advanced PDF editor, navigate to the left sidebar and open the 'Attachments' panel (usually indicated by a paperclip icon).

3
Add the XML File as an Attachment

Click the 'Add a new attachment' button and browse for the XML file you just exported. Select it to embed it directly into the PDF document.

4
Email the Combined PDF

Use the standard email function or your existing email script to send the PDF. The single PDF file sent will now contain both the visual form and the embedded XML data.

Embed the XML Data Inside the PDF Before Emailing
Recipient Extraction Requirements: The recipient of the email will need a desktop PDF reader capable of viewing and extracting embedded file attachments to access the XML data for reporting.

Manage PDF Forms and Attachments Easily with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to effortlessly manage PDF forms, embed files as attachments, and share your documents via email without relying on complex scripting.

  1. 1. Open Your PDF Form: Launch WPS Office and open your completed PDF form in the PDF Editor.
  2. 2. Insert the Attachment: Navigate to the 'Insert' tab on the top ribbon and click on the 'Attachment' button.
  3. 3. Select the XML File: Browse your computer for the corresponding XML data file, select it, and pin the attachment icon to your document.
  4. 4. Share via Email: Save your document, then click the 'Menu' button and select 'Email' to open your default mail client with the combined PDF automatically attached.
Easily embed XML and other external files directly into your PDFsFully compatible with standard PDF formats and Adobe Acrobat filesLightweight, fast, and user-friendly PDF editing interfaceBuilt-in email sharing for quick and seamless document distribution
microsoft office alternative - wps office

Frequently Asked Questions

Why can't Acrobat scripts send two separate attachments in one email?

Acrobat's built-in JavaScript API for generating emails (such as app.mailMsg or doc.mailDoc) is intentionally designed to send either the active document or the extracted form data for security and simplicity. It does not support attaching multiple external files to the generated email.

How does the recipient extract the embedded XML file?

The recipient simply needs to open the emailed PDF in a compatible PDF reader, open the 'Attachments' panel (usually represented by a paperclip icon), right-click the embedded XML file, and select 'Save Attachment' to download it to their local drive.

Can I automate the process of embedding the XML file into the PDF?

Yes, if you are using Adobe Acrobat Pro, you can write a document-level JavaScript utilizing the 'DataObjects' API. This script can programmatically extract the XML data, attach it to the PDF as a data object, and then trigger the email action all in one step.