Split PDF by Text
Merge & Split → Split PDF by Text
The Split PDF by Text API splits a PDF at pages containing specific text. You send the PDF (docContent Base64, docName), text (search string), splitTextPage (before or after), optional fileNaming, and async. The API returns an array of split PDFs. Use the tester below to try it; more details are in the sections that follow.
Try the Split PDF by Text API
:::note Quick reference
Endpoint: POST /api/v2/SplitByText · Required: api-key, docContent, docName, text, splitTextPage
:::
:::info Try it live Use the form below to send your API key, PDF (Base64), and the text to split on (before or after). The response is an array of split PDFs. No code required—fill the fields and click Send request. :::
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Split PDF by Text?
This endpoint splits a PDF at pages that contain specific text. You provide text (the search string) and splitTextPage (before or after the text). The API returns an array of PDFs, each split at the pages where the text is found. Use it when documents have repeating text markers (e.g. "Chapter 1", "Section A") that define split points.
Key features
- Text-based – text is the exact string to search for; splits occur at pages containing it.
- Position – splitTextPage: before or after the text occurrence.
- Async – Use async for large PDFs.
:::tip Best for Use when splitting by section headers or markers. For page-based splits use Split PDF; for barcode-based use Split PDF by Barcode or Split PDF by Swiss QR. :::
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| docContent | base64 | Yes | PDF file content (Base64). |
| docName | string | Yes | Input PDF file name (e.g. sample.pdf). |
| text | string | Yes | Text to search for splitting. |
| splitTextPage | string | Yes | before or after the text. |
| fileNaming | string | No | File naming convention (e.g. NameAsPerOrder). |
| async | boolean | No | Enable asynchronous processing. |
When to use Split PDF by Text
- Section splits – Split at section headers or markers (e.g. "Chapter 1", "Appendix").
- Document separation – Split a combined PDF where each part starts with the same text.
- Batch extraction – Extract segments between repeated text markers.
:::info Need the full API? For request/response schemas and code samples, see Split PDF by Text in the PDF4me API docs. :::
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- A PDF file in Base64 format containing the text to search for
Response Format
The API returns an array of split PDF documents, each split at the pages containing the specified text.