How to Split a PDF into Files Named from Invoice Numbers
Question details
The user wants to split a multi-page PDF of invoices and automatically name the resulting individual files using the invoice numbers printed on each page.
- Product
- Device & OS
- not provided
- Scenario
- Processing a batch of invoices in a single PDF file and organizing them into individual files for record-keeping.
- Observed behavior
- Standard PDF split tools only divide the document by page count or file size and cannot automatically read page text to generate custom file names.
Ensure your invoice PDF contains clear, extractable text rather than flattened images, as scripts and processing tools rely on readable text to identify invoice numbers.
Use a Custom JavaScript Action
Since standard PDF editors do not natively support dynamic naming based on page content, executing a custom JavaScript action is the most reliable method.
Advanced PDF editors allow you to run custom scripts that iterate through the document, read the text of each page, identify a specific pattern (like an invoice number), extract the page, and save it using that pattern.
Launch a PDF editor that supports custom action scripts and JavaScript execution.
Navigate to the Action Wizard, Tools menu, or JavaScript console within the application.
Write or import a JavaScript code snippet designed to loop through document pages, extract text matching your invoice number format using regular expressions, and execute the page extraction command.
Execute the script on your batch invoice PDF to automatically split the document and save the outputs with the extracted invoice numbers.
Use Specialized Batch Processing Software
Dedicated document management and OCR tools have built-in features to auto-split and name files based on specific text zones.
Split and Manage Your Invoice PDFs with WPS Office
While fully automated dynamic naming requires custom scripts, WPS Office provides a highly intuitive PDF toolkit to quickly split large invoice batches, extract text, and manage your documents seamlessly.
- 1. Open the PDF in WPS Office: Launch WPS Office and open your multi-page invoice PDF document.
- 2. Access the Split Tool: Navigate to the 'Page' tab on the top ribbon and click on 'Split PDF'.
- 3. Configure Split Settings: Set the tool to split the document every 1 page (if each invoice is a single page) and choose your preferred output directory.
- 4. Extract and Rename: Use the built-in text selection or OCR tool to quickly copy the invoice number from each newly split file and rename them accordingly.

Frequently Asked Questions
Can I split a PDF by invoice number without writing code?
Standard PDF editors do not support this natively. To do it without coding, you will need to purchase specialized batch processing software with zonal OCR or use a third-party plugin designed specifically for auto-renaming.
Why isn't the standard split tool extracting my invoice numbers?
Standard split tools only divide pages based on structural elements like page count, file size, or top-level bookmarks. They do not parse or read the actual text content on the page to generate file names.
Does WPS Office support splitting PDFs?
Yes, WPS Office includes a robust PDF editor that allows you to easily split multi-page PDFs by page count or specific custom page ranges.
What if my invoice numbers are in scanned images?
If your PDF is a scanned image rather than a text-based document, you must first perform OCR (Optical Character Recognition) to convert the image into searchable text before any script or tool can extract the invoice numbers.




