How to Create Acrobat Buttons to Extract and Email PDF Pages
Question details
The user wants to create an interactive button within a PDF that automatically extracts a specific page range, saves the new file locally, and attaches it to a new email message.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- Automating document workflows by extracting specific parts of a PDF and emailing them directly from the document interface using a single click.
- Observed behavior
- Standard tools do not offer this as a one-click button, and a custom Acrobat automation script is required. Standard Acrobat Reader lacks the capability to execute such page extraction.
Ensure you have Adobe Acrobat Pro installed, as Adobe Acrobat Reader does not support page extraction. You will also need administrative access to install custom folder-level JavaScript files on the local machine.
Use Acrobat JavaScript Automation to Extract and Email Pages
Create a trusted folder-level script utilizing the doc.extractPages() function to handle the extraction, saving, and email attachment processes securely.
This method requires Adobe Acrobat Pro and a custom JavaScript file that must be installed in the Acrobat JavaScripts folder on every user's computer. It cannot be done entirely through a document-level script attached to a button due to Acrobat's security restrictions on saving files to a local disk.
The script relies on setting up a trusted function that bypasses typical security sandboxing to perform local system operations like saving and calling the default email client.
Find the Acrobat JavaScripts folder on your computer (typically accessible via Preferences > JavaScript) to place your custom trusted script file.
Write a folder-level script using app.trustedFunction that wraps the doc.extractPages() method to extract the desired page range securely.
Add a command within your trusted script to save the newly extracted document to a temporary local path using the saveAs method.
Use the app.mailMsg() or doc.mailDoc() function in your script to open your computer's default email client and attach the newly saved PDF to a blank email.
Open your PDF document, add a form button using the Prepare Form tool, and assign a 'Run a JavaScript' action to trigger your new trusted function.

Easily Extract and Email PDF Pages Using WPS Office
Instead of relying on complex custom scripts and requiring expensive Acrobat Pro licenses for every user, you can use WPS Office's built-in PDF tools to quickly extract the pages you need and share them via email in just a few clicks.
- 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document from which you want to extract pages.
- 2. Use the Extract Pages tool: Navigate to the 'Page' tab on the top ribbon menu and click on the 'Extract Page' option.
- 3. Select your page range: Enter the specific page numbers or select the page range visually, then click 'Extract' to instantly create a new PDF document.
- 4. Share directly via Email: With the newly extracted PDF open, click on the 'Menu' or 'Share' icon in the top right, and select 'Email' to automatically attach the file to a new message in your default email client.

Frequently Asked Questions
Can I extract PDF pages using Adobe Acrobat Reader?
No, Adobe Acrobat Reader does not have the capability to extract PDF pages, even if you try to use custom JavaScript. You must use Adobe Acrobat Pro or a capable PDF editor like WPS Office.
Why can't my PDF button script automatically delete the temporary file?
For security reasons, Acrobat JavaScript does not have the permission to delete files from a user's local hard drive. Any temporary files created during the extraction and saving process will need to be cleaned up manually.
Do I need to install the custom script on every user's computer?
Yes. Because the script requires folder-level trusted functions to save files to the local disk, the .js file must be manually installed in the Acrobat JavaScripts folder on every individual user's machine. It cannot be embedded directly into the document.
Is there a way to extract and email pages without writing scripts?
Yes. You can manually use the 'Extract' tool in Acrobat Pro's 'Organize Pages' menu to save the pages, then attach the new file to an email yourself. Alternatively, software like WPS PDF offers straightforward user interface tools to extract and share pages without needing any scripting knowledge.




