Other PDF Issues

How to Extract and Email One Page from a PDF using Acrobat JavaScript

Bushra ParveenBushra Parveen Nov 5, 2026 869 views

Question details

The user needs to automate the process of extracting a specific single page from a larger PDF and sending it via email using an Acrobat JavaScript snippet.

How to Extract and Email Only One Page from a PDF using Acrobat JavaScript
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Developing a PDF workflow or form where clicking a button should trigger an email containing only the current page, rather than sending the entire multipage document.
Observed behavior
Requires a script that extracts a selected page into a temporary PDF, attaches it to a new email draft, and manages software version limitations between Acrobat Pro and the free Reader.
Before you start

Verify your PDF software version, as standard JavaScript page extraction methods require Adobe Acrobat Pro or Standard and will trigger security restrictions in the free Adobe Reader.

Solution 1Recommended

Extract and Email a Page Using the extractPages Method

Use this standard JavaScript method if you are running Adobe Acrobat Pro or Standard to create a temporary document containing only the targeted page.

This approach leverages the built-in Acrobat JavaScript API to pull a specific page, attach it to your default email client, and then close the temporary file automatically without saving.

1
Open the JavaScript Console

Launch your PDF in Adobe Acrobat Pro or Standard and open the JavaScript console, or access the Action properties of the button where you want to embed the script.

2
Enter the Extraction Script

Input the command 'var newDoc = this.extractPages(0, 0);'. Note that page indexes start at 0, so entering (0, 0) will extract the first page of the document.

3
Add the Mail Command

Add the script 'newDoc.mailDoc({cTo: "me@server.com"});' to the sequence. Replace the placeholder email address with your intended recipient.

4
Close the Temporary Document

Append 'newDoc.closeDoc(true);' to the script to ensure the temporary single-page PDF is closed seamlessly in the background once the email client is triggered.

Extract and Email a Page Using the extractPages Method
Software Limitation: This script will fail silently or throw an error in Adobe Reader because the 'extractPages' method requires premium editing permissions.
Easily Extract PDF Pages with WPS Office

Extract and Email PDF Pages Quickly Without Coding

Skip the complex JavaScript coding and software version troubleshooting. WPS Office provides built-in, user-friendly tools to extract, split, and email specific PDF pages in just a few clicks.

  1. 1. Open Your PDF: Launch WPS Office and open the multipage PDF document you want to share a page from.
  2. 2. Navigate to the Extract Tool: Click on the 'Page' tab located on the top navigation ribbon and select the 'Extract Page' tool.
  3. 3. Select the Target Page: Enter the specific page number you wish to extract or click on the page thumbnail, then confirm to open it as a new file.
  4. 4. Share via Email: Click the 'Menu' button and navigate to 'Share' or use the quick 'Email' button on the toolbar to automatically attach the single page to a new email draft.
No coding or JavaScript knowledge required to share specific pagesFully compatible with standard PDF and Microsoft Office document formatsBuilt-in email sharing directly from the PDF viewer interfaceFree, lightweight, and user-friendly alternative to complex PDF editors
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the extractPages JavaScript work in Adobe Reader?

Adobe restricts advanced document modification features, such as extracting, inserting, or deleting normal pages, in the free Adobe Reader for security and licensing reasons. The 'extractPages' method requires Adobe Acrobat Standard or Pro.

Does the mailDoc() JavaScript function send the email automatically?

No. For security reasons, 'mailDoc()' cannot bypass user interaction to send emails silently in the background. It will only draft the email, attach the PDF, and open your default desktop email client, requiring you to manually click 'Send'.

Can I flatten PDF form fields using JavaScript before emailing the page?

You cannot fully flatten a PDF using standard document scripts due to security restrictions. However, a common workaround is to write a script that iterates through all the form fields and changes their properties to 'read-only' before triggering the email.

How do I extract a range of multiple pages using Acrobat JavaScript?

You can adjust the parameters within the 'extractPages(start, end)' method. For instance, entering 'this.extractPages(0, 2)' will extract the first, second, and third pages (indexes 0 through 2) into a single new temporary document.