How to Submit Selected PDF Pages by Email using Acrobat JavaScript
Question details
The user wants to use Acrobat JavaScript to extract specific pages from a 30+ page PDF form and send only those selected pages via email.

- Product
- Adobe Acrobat PDF
- Device & OS
- not provided
- Scenario
- Automating the email submission of a subset of pages from a large PDF form.
- Observed behavior
- The default submitForm script attaches the entire 30+ page document, instead of creating and sending a smaller document with only the required pages.
Verify whether your form will be used primarily in Adobe Acrobat or Adobe Reader, as creating temporary documents via JavaScript requires specific security permissions and extended usage rights that differ between the two applications.
Use Acrobat JavaScript to Extract Pages and Submit
Write a custom script that creates a temporary document, copies the desired pages into it, and then emails that newly created file.
This method involves using JavaScript to dynamically generate a new PDF containing only the pages you specify before invoking the submit action. It requires Acrobat Pro or Standard because the extractPages function is restricted by default in the free Adobe Reader.
Open your PDF form in Adobe Acrobat and enter 'Prepare Form' mode from the Tools menu.
Add a new button to your document. Right-click the button and select 'Properties'.
Navigate to the 'Actions' tab, select 'Run a JavaScript' from the Select Action dropdown, and click 'Add'.
In the JavaScript Editor, write code that uses the extractPages() method to create a temporary document, and then calls the submitForm() method on that new document to attach it to an email.
Extract and Email Selected PDF Pages Easily with WPS PDF
If writing complex JavaScript code is not feasible, you can quickly extract specific pages from large documents and email them directly using the intuitive, built-in tools of WPS Office.
- 1. Open the PDF File: Launch WPS Office and open your large PDF document.
- 2. Access the Extract Tool: Navigate to the 'Page' tab on the top ribbon and select 'Extract Page'.
- 3. Select Pages to Extract: Specify the exact page range you wish to email and click 'Extract' to instantly create a new, smaller PDF.
- 4. Share via Email: Click the 'Menu' button and choose 'Share' or 'Email' to automatically attach the newly created document to your default email client.

Frequently Asked Questions
Can I use the submitForm JavaScript function in Adobe Reader?
Standard Adobe Reader has restricted security policies. While basic submitForm actions work, complex scripts like extractPages are usually blocked unless the document has been specifically 'reader-extended' using Acrobat Pro.
Is there a way to only send the filled form data instead of the entire PDF file?
Yes, you can modify the submitForm parameters to export only the form fields as an FDF, XFDF, or XML file. This greatly reduces the attachment size and does not require extracting pages.
Why does my PDF form fail to attach to an email when I click the submit button?
This often occurs due to email client incompatibility or security settings blocking JavaScript execution. Ensure your default desktop email client (such as Outlook) is properly configured to accept MAPI requests from your PDF software.
Can I extract specific PDF pages without paying for Adobe Acrobat?
Yes, you can use powerful alternatives like WPS PDF, which includes an intuitive 'Extract Pages' tool. This allows you to split documents and pull out necessary pages visually without needing to write any custom JavaScript code.




