How to Extract Highlighted PDF Pages to a New Document
Question details
The user wants to know how to use an Acrobat JavaScript toolbar button to automatically extract pages containing highlights and annotations into a new backup PDF document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a summary or backup document by isolating only the annotated pages from a larger PDF file.
- Observed behavior
- The user is seeking clarification on how a specific JavaScript extracts pages with highlights and what to do if the output does not match expectations.
Before running any custom JavaScript in your PDF editor, verify the source of your script and save a backup copy of your original document to prevent unintended data loss.
Use a Custom JavaScript Action in Adobe Acrobat
Execute a custom script to automatically identify and extract pages containing highlights into a new file.
Adobe Acrobat allows users to create custom toolbar buttons that run JavaScript. A script designed to extract annotated pages typically scans the document for highlight objects, logs their page numbers, and copies those specific pages into a newly generated document object.
Navigate to 'Tools' and select 'Action Wizard'. Click on 'New Custom Command' from the toolbar.
Select 'Execute JavaScript', click on 'Options', and paste your specific extraction and embedded icon code into the text editor.
Save the command to add it to your toolbar. Open your target PDF and click the newly created button to run the script and generate your backup document containing only the highlighted pages.

Manually Extract Annotated Pages
If the custom script fails or you prefer a visual method, you can manually identify and extract the highlighted pages.
Extract PDF Pages Effortlessly with WPS Office
Skip complex JavaScript coding and troubleshooting. WPS PDF provides an intuitive, built-in graphical tool to split, extract, and organize specific pages from your documents in just a few clicks.
- 1. Open the PDF File: Launch WPS Office and open the PDF document containing your highlights.
- 2. Navigate to the Page Tool: Click on the 'Page' tab located on the top navigation ribbon.
- 3. Set Up Extraction: Click on 'Extract Page'. A dialog box will appear allowing you to select 'Custom extraction'.
- 4. Extract and Save: Enter the specific page numbers that contain your highlights, then click 'Extract' to instantly create and save your new backup document.

Frequently Asked Questions
Why is my Acrobat JavaScript button not working?
JavaScript execution might be disabled due to security settings. Go to Edit > Preferences > JavaScript and ensure the 'Enable Acrobat JavaScript' option is checked. Also, verify that the script syntax is correct for your specific software version.
Can I extract just the highlighted text instead of the entire page?
Yes. Most advanced PDF editors have a 'Summarize Comments' or 'Export Comments' feature. This allows you to generate a new PDF or text file that lists only the highlighted text and annotations, rather than copying the full page layouts.
Is it possible to automate PDF page extraction without programming?
Yes, modern PDF tools like WPS PDF offer built-in graphical interfaces to split and extract pages natively, completely removing the need for custom JavaScript codes or complex commands.




