How to Split a PDF and Dynamically Rename Pages with Unique Names
Question details
The user wants to split a multi-page PDF document into individual files and automatically name each extracted file using unique, specific text from the page (such as a person's name) instead of generic sequential numbers.

- Product
- PDF Editors
- Device & OS
- not provided
- Scenario
- Splitting a large batch of PDF pages, such as invoices, pay stubs, or certificates, where each page needs a distinct filename based on its content.
- Observed behavior
- The user aims to automate the extraction and renaming process to avoid manually saving and typing out unique filenames for hundreds of files.
Ensure the text you want to use for the new filenames is searchable text (not an image) and is located in the exact same position or coordinate on every single page of the document.
Use Custom JavaScript for Automated Extraction and Renaming
Run a custom JavaScript code snippet in your advanced PDF editor to extract text from a specific coordinate on the page and use it to save the individual PDF file.
This method relies on specific scripting functions, such as 'getPageNthWord', to fetch the exact text you want to use as the filename. It requires the target text to be placed in a consistent, predictable location across all pages.
Because running extraction scripts on massive documents consumes significant system resources, it is highly advisable to process large documents in smaller batches to prevent the application from crashing.
Open your PDF editor that supports JavaScript execution (such as Adobe Acrobat Pro) and navigate to the Action Wizard or JavaScript console.
Write or paste a custom script utilizing the 'getPageNthWord' function or exact coordinates to target the specific text on the page you wish to use as the file name.
Run the script to automatically extract each page and save it to your specified local directory, dynamically using the fetched text to name each newly created PDF.

Easily Split and Manage PDF Documents with WPS Office
WPS PDF makes it incredibly easy to split large documents into individual pages or specific page ranges. While advanced custom JavaScript may be needed for highly specific dynamic text renaming, WPS PDF provides a lightweight, user-friendly interface to split, extract, and organize your files efficiently without complex coding.
- 1. Open the Document: Launch WPS Office and open your multi-page PDF document in the WPS PDF tool.
- 2. Access the Split Tool: Navigate to the 'Page' tab on the top toolbar and click on the 'Split PDF' button.
- 3. Configure Split Settings: Choose whether you want to split the document by specific page ranges, or extract every single page into an individual file.
- 4. Save the Output: Select your desired output directory and click 'Split' to instantly generate the separate PDF files.

Frequently Asked Questions
Can I use bookmarks to split and rename PDF pages?
Yes, many advanced PDF editors allow you to split a document by top-level bookmarks. The resulting files are automatically named after the bookmark title, providing an easy alternative to writing custom JavaScript if you can generate bookmarks beforehand.
Why is the script extracting incorrect names for my files?
If the script relies on specific coordinates or word counts, any slight variation in the document's formatting, invisible characters, or extra spaces can shift the target text, causing the wrong word to be captured for the filename.
Is there a way to dynamically rename PDFs without coding?
Without coding, you can use specialized third-party PDF automation tools or batch renaming utilities that scan specific zones in a document using OCR. However, these are usually premium, enterprise-level solutions.
What should I do if my large PDF crashes during extraction?
If your script or software crashes, it is likely running out of memory. Try manually splitting your massive document into smaller batches of 100 to 200 pages before running the dynamic renaming script.




