Manipulation Endpoints
Merge, split, rotate, resize, and manage PDF pages via the REST API.
Overview
The manipulation endpoints let you restructure PDF documents by merging multiple files, splitting pages, extracting or removing specific pages, reorganizing page order, rotating, resizing, and adding watermarks or page numbers. All endpoints return the modified PDF in the response body.
X-Api-Key and X-Api-Secret headers on every request. See Authentication for details.
Merge PDFs
POST /api/pdf/merge
Combines two or more PDF files into a single document. Files are merged in the order they are uploaded.
| Name | Type | Required | Description |
|---|---|---|---|
files | File[] | Yes | Two or more PDF files to merge. Use multiple files fields in the form data. |
outputFileName | String | No | Custom name for the merged output PDF. |
curl -X POST https://pdf.mapsoft.com/api/pdf/merge \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "files=@document1.pdf" \
-F "files=@document2.pdf" \
-F "files=@document3.pdf" \
-F "outputFileName=merged.pdf" \
-o merged.pdf
Split PDF
POST /api/pdf/split
Splits a PDF document into multiple files. You can split by page count, page ranges, or into individual pages. Returns a ZIP archive containing the split files.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to split. |
splitMethod | String | No | How to split: byPages (default), byRange, everyPage. |
pageCount | Integer | No | Number of pages per split file (used with byPages). Default: 1. |
ranges | String | No | Comma-separated page ranges (used with byRange), e.g., 1-3,4-6,7-10. |
outputFileName | String | No | Base name for the output files. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/split \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "splitMethod=byRange" \
-F "ranges=1-3,4-6,7-10" \
-o split-files.zip
Extract Pages
POST /api/pdf/extract-pages
Extracts specific pages from a PDF and returns them as a new PDF document.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to extract pages from. |
pages | String | Yes | Pages to extract. Supports ranges and individual pages: 1,3,5-8,12. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/extract-pages \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "pages=1,3,5-8" \
-o extracted.pdf
Remove Pages
POST /api/pdf/remove-pages
Removes specified pages from a PDF document and returns the modified PDF.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to remove pages from. |
pages | String | Yes | Pages to remove. Supports ranges and individual pages: 2,4,6-8. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/remove-pages \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "pages=2,4,6-8" \
-o trimmed.pdf
Reorganize Pages
POST /api/pdf/reorganize
Reorders the pages of a PDF document according to a specified page sequence.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to reorganize. |
pageOrder | String | Yes | New page order as a comma-separated list, e.g., 3,1,2,5,4. Pages can be repeated or omitted. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/reorganize \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "pageOrder=3,1,2,5,4" \
-o reorganized.pdf
Rotate Pages
POST /api/pdf/rotate-pages
Rotates specified pages in a PDF document by a given angle.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to rotate pages in. |
angle | Integer | Yes | Rotation angle in degrees: 90, 180, or 270. |
pages | String | No | Pages to rotate (e.g., 1,3,5-8). Defaults to all pages. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/rotate-pages \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "angle=90" \
-F "pages=1,3" \
-o rotated.pdf
Resize Page
POST /api/pdf/resize-page
Resizes all or selected pages in a PDF document to a specified paper size.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to resize. |
pageSize | String | Yes | Target page size: A3, A4, A5, Letter, Legal, Tabloid, or custom dimensions. |
width | Float | No | Custom width in points (used when pageSize is custom). |
height | Float | No | Custom height in points (used when pageSize is custom). |
pages | String | No | Pages to resize (e.g., 1-5). Defaults to all pages. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/resize-page \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "pageSize=A4" \
-o resized.pdf
Add Watermark
POST /api/pdf/add-watermark
Adds a text or image watermark to a PDF document.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to watermark. |
text | String | No | Watermark text (e.g., CONFIDENTIAL, DRAFT). Required if no image watermark is provided. |
watermarkImage | File | No | Image file to use as a watermark (PNG, JPG). Required if no text is provided. |
fontSize | Integer | No | Font size for text watermark. Default: 48. |
color | String | No | Text color as hex code (e.g., #FF0000). Default: #808080. |
opacity | Float | No | Watermark opacity from 0.0 (invisible) to 1.0 (opaque). Default: 0.3. |
rotation | Integer | No | Rotation angle in degrees. Default: -45 (diagonal). |
position | String | No | Position: center (default), top-left, top-right, bottom-left, bottom-right. |
pages | String | No | Pages to watermark (e.g., 1,3,5-8). Defaults to all pages. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/add-watermark \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "text=CONFIDENTIAL" \
-F "fontSize=60" \
-F "color=#FF0000" \
-F "opacity=0.25" \
-F "rotation=-45" \
-o watermarked.pdf
Add Page Numbers
POST /api/pdf/add-page-numbers
Adds page numbers to a PDF document in a specified position and format.
| Name | Type | Required | Description |
|---|---|---|---|
file | File | Yes | The PDF file to add page numbers to. |
position | String | No | Position of numbers: bottom-center (default), bottom-left, bottom-right, top-center, top-left, top-right. |
format | String | No | Number format: numeric (default), roman, alphabetic. Or a pattern like Page {n} of {total}. |
startNumber | Integer | No | Starting page number. Default: 1. |
fontSize | Integer | No | Font size for the page numbers. Default: 10. |
pages | String | No | Pages to number (e.g., 2-10). Defaults to all pages. |
outputFileName | String | No | Custom name for the output PDF file. |
password | String | No | Password to open the PDF, if it is password-protected. |
curl -X POST https://pdf.mapsoft.com/api/pdf/add-page-numbers \
-H "X-Api-Key: YOUR_API_KEY" \
-H "X-Api-Secret: YOUR_API_SECRET" \
-F "file=@document.pdf" \
-F "position=bottom-center" \
-F "format=Page {n} of {total}" \
-F "startNumber=1" \
-o numbered.pdf