How to Automate Splitting, Renaming, and Emailing PDF Payslips
Question details
The user needs a workflow to automatically extract, split, rename, and email variable-length payslips from a single large PDF file.

- Product
- PDF Editors / Document Automation
- Device & OS
- not provided
- Scenario
- Processing a monthly master PDF containing payslips for approximately 80 employees, where each payslip can vary between 1 or 2 pages.
- Observed behavior
- Manually splitting, identifying, renaming, and emailing each document is extremely time-consuming and highly prone to human error.
Before setting up an automation workflow, ensure you have a standardized employee roster with their corresponding IDs and current email addresses saved in a spreadsheet.
Create a JavaScript PDF Workflow and Office Email Automation
Use JavaScript within an advanced PDF editor to dynamically parse the document boundaries, followed by an Excel and Outlook macro to handle the emailing.
This method requires setting up a one-time script that scans the PDF for a unique identifier (like an Employee ID) on the first page of each payslip. It uses this identifier to detect when a new payslip begins, handling the variable page counts seamlessly.
Open the master PDF in an advanced PDF editor that supports JavaScript API. Run a custom script to iterate through the text, searching for the consistent phrase or area that denotes a new employee ID.
Configure the script to extract the pages starting from the detected ID until the next ID is found. Save each extracted document into a designated output folder, using the extracted Employee ID as the filename (e.g., '10294_Payslip.pdf').
Set up a VBA macro or a Power Automate flow connecting your spreadsheet to your email client (like Outlook). Have it read the output folder, match the ID in the filename to the employee's email address, attach the file, and send the message.

Manage PDF Payslips and Employee Data Efficiently with WPS Office
WPS Office provides powerful PDF handling and spreadsheet capabilities to streamline your HR workflows. Use WPS PDF to quickly split documents and WPS Spreadsheet to manage employee distribution lists.
- 1. Open Master Document: Launch WPS Office and open your master payslip PDF document in WPS PDF.
- 2. Split the PDF: Navigate to the 'Page' tab and select 'Split PDF' to divide the document into individual files based on specified page ranges or existing bookmarks.
- 3. Organize Email Lists: Open WPS Spreadsheet to easily manage your employee directory, track the distribution process, and prepare your data for email merging.

Frequently Asked Questions
Can I split a PDF automatically if the page count varies per document?
Yes, but standard 'split by N pages' features won't work. You must use bookmark-based splitting or a document-processing script that identifies boundaries based on text triggers, such as an employee ID or name.
What is the best way to email individual PDFs to different recipients?
The most efficient way is to use email automation tools (like Power Automate, or VBA in Excel/Outlook) that cross-reference the saved PDF filename with a spreadsheet directory containing the recipient email addresses.
Do I need to know how to code to automate PDF splitting?
To fully automate dynamic splitting and renaming based on text content natively, some JavaScript or Python scripting is usually required. However, specialized third-party document processing tools offer visual workflows for this.
How do I ensure the extracted PDF text is searchable for automation?
Ensure your original master PDF is generated as a text-based document directly from your payroll software, rather than scanned. If it is a scanned image, apply OCR (Optical Character Recognition) before running extraction scripts.




