Split a PDF into Separate Statements by Account Number
Question details
Create a separate PDF for each statement in a large file using the account number printed on each page.

- Product
- PDF document processing
- Device & OS
- not provided
- Scenario
- A 2,000-page PDF contains mostly one-page statements and some two- or three-page statements.
- Observed behavior
- Each output PDF should contain all pages belonging to one statement, rather than splitting every page into a separate file.
Check a representative sample to see whether account numbers can be selected as text and whether consecutive pages with the same account number always belong to the same statement. If the pages are scanned images, run OCR first; if one account has consecutive distinct statements, identify an additional boundary such as a statement date.
Use a Python script to group consecutive pages by account number
Use this approach when account numbers follow a consistent text pattern and each consecutive run of the same account represents one statement.
The example groups adjacent pages with the same detected account number. It does not distinguish consecutive statements for the same account; those require an additional statement identifier or boundary rule.
Adjust the account-number pattern to match the actual document. Test a small, representative PDF before processing the complete file.
If you cannot select the account number as text, open the PDF in Adobe Acrobat and use Scan & OCR > Recognize Text > In This File. Save the searchable PDF and check that the recognized account numbers are accurate.
Install Python, then open a terminal or command prompt and run: python -m pip install pymupdf
Paste the following into a text file named split_statements.py. Change the pattern if your PDF uses a different account-number label or format: import re import sys from pathlib import Path import fitz if len(sys.argv) != 3: sys.exit('Usage: python split_statements.py input.pdf new_output_folder') source = Path(sys.argv[1]) out_dir = Path(sys.argv[2]) pattern = re.compile(r'\baccount\s*(?:number|no\.?|#)\s*[:#-]?\s*([A-Za-z0-9-]+)', re.I) doc = fitz.open(source) accounts = [] for i, page in enumerate(doc): match = pattern.search(page.get_text()) if not match: sys.exit(f'No account number detected on page {i + 1}; check the text and pattern.') accounts.append(match.group(1).upper()) if not accounts: sys.exit('The PDF has no pages.') out_dir.mkdir(parents=True, exist_ok=False) start = 0 for end in range(1, len(accounts) + 1): if end == len(accounts) or accounts[end] != accounts[start]: part = fitz.open() part.insert_pdf(doc, from_page=start, to_page=end - 1) part.save(out_dir / f'statement_{start + 1:04d}.pdf') part.close() start = end doc.close()
Run python split_statements.py input.pdf output_folder, replacing the arguments with your PDF path and a new folder path. Open several output files, especially multi-page statements and account changes, and compare their page counts and boundaries with the source.

Extract statement page ranges manually in Adobe Acrobat
Use manual extraction when there are few statements to separate or the account-number layout is inconsistent.
Extract Individual Statement Ranges in WPS PDF
Use WPS PDF to split known page ranges into separate statement files. This is a manual alternative; it does not automatically group pages by account number.
- 1. Open the PDF: Launch WPS Office and open the statement PDF in WPS PDF.
- 2. Identify statement boundaries: Review the pages and note the page range for each statement, including any two- or three-page statements.
- 3. Split a statement range: Choose Split PDF from the PDF tools, select the pages for one statement, and choose an output location.
- 4. Save and repeat: Run the split, open the resulting PDF to check its pages, and repeat for the other statement ranges. Tool availability and options can vary by version or plan.

Frequently Asked Questions
Can Acrobat automatically split a PDF by account number?
Acrobat's Organize Pages tool can extract selected pages or save pages as separate files, but it does not automatically group pages by a repeated account number. A custom script or document-processing workflow is needed for that.
What if I cannot select the account number in the PDF?
The PDF may contain scanned images. In Acrobat, use Scan & OCR > Recognize Text > In This File, then check that the recognized account numbers are accurate before running a script.
Will grouping by account number always produce one file per statement?
No. If two consecutive statements belong to the same account, grouping only by account number will combine them. Use another reliable boundary, such as a statement date or identifier, to distinguish them.
How do I keep a three-page statement in one PDF?
In Acrobat's Organize Pages tool, select all three pages and choose Extract without selecting Extract Pages as Separate Files. In WPS PDF, choose the corresponding page range in Split PDF.
Why does the script report that an account number was not found?
The account label or number may not match the example pattern, the page may lack searchable text, or OCR may have misread it. Inspect the reported page, correct the text or OCR, and adjust the pattern in split_statements.py.




