PDF Tools API
Merge PDFs, extract or split pages, rotate pages, stamp a diagonal watermark or add page numbers (Vietnamese text supported), all in one API.
One endpoint, several actions. merge joins up to 20 PDFs in order (multipart file1, file2… or a files_base64 array). extract builds a new PDF from pages such as 1-3,5,8-last (in the order given, so 3,1 reorders). split cuts the document every N pages (every) or by ranges (ranges=1-3;4-6) and returns a ZIP of the parts. rotate turns pages by 90, 180 or 270 degrees. info (the default) returns the page count, title, producer and page size.
watermark draws a semi-transparent diagonal text (text, opacity 0.03–1, default 0.15) across each page, sized to the page; page_numbers writes labels such as Trang {n}/{total} (format, position top / bottom + left / center / right, start). Both use the Be Vietnam Pro font, so “BẢN NHÁP” or “Trang 1/5” render with correct diacritics. Every action except merge accepts pages to work on part of the document.
The answer is the resulting PDF (or ZIP for split, JSON for info). Password-protected PDFs are refused; files are processed in memory within the file size of your plan.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
action | query|body | string | no | info | merge, extract, split, rotate, watermark, page_numbers or info. |
file | body | file | yes | The PDF (multipart, raw body or file_base64). For merge: file1, file2… (up to file10) or files_base64 (array, up to 20). | |
pages | query|body | string | no | Pages, e.g. 1-3,5,8-last. Required for extract; for rotate / watermark / page_numbers it limits the pages (default: all). | |
every | query|body | number | no | 1 | split: pages per part. |
ranges | query|body | string | no | split: explicit parts separated by ;, e.g. 1-3;4-6 (max 200 parts). | |
angle | query|body | number | no | 90 | rotate: 90, 180 or 270 (-90 also accepted). |
text | query|body | string | no | watermark: the text (required, max 100 characters). | |
opacity | query|body | number | no | 0.15 | watermark: 0.03–1. |
format | query|body | string | no | {n} / {total} | page_numbers: label with {n} and {total}. |
position | query|body | string | no | bottom-center | page_numbers: top- or bottom- + left, center, right. |
start | query|body | number | no | 1 | page_numbers: first number. |
Example
curl -X POST "https://apibox.io.vn/v1/pdf-tools" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "0=@./my-file"const form = new FormData();
form.append('0', fileInput.files[0]);
const res = await fetch('https://apibox.io.vn/v1/pdf-tools', {
method: 'POST',
headers: { Authorization: 'Bearer YOUR_API_KEY' },
body: form,
});
console.log(await res.json());import requests
res = requests.post(
"https://apibox.io.vn/v1/pdf-tools",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"0": open("my-file", "rb")},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/pdf-tools');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
CURLOPT_POSTFIELDS => ['0' => new CURLFile('my-file')],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"pages": 1,
"title": "Báo giá",
"author": null,
"producer": "APIBox md-pdf",
"page_size_pt": {
"width": 595,
"height": 842
},
"actions": [
"merge",
"extract",
"split",
"rotate",
"watermark",
"page_numbers",
"info"
]
}
Use cases
- Merge an invoice and its appendix into one PDF
- Stamp “BẢN NHÁP” or “CONFIDENTIAL” on drafts
- Add page numbers to generated reports
- Split a scanned bundle into one PDF per document
FAQ
How do I select pages?
pages=1-3,5,8-last; ranges can go backwards (5-1) and pages are taken in the order written.
Can it open password-protected PDFs?
No. Remove the password first; the API answers invalid_pdf otherwise.
Does it compress PDFs?
No, the pages are copied as they are. Use it to merge, split and mark documents.
Related APIs
Image Metadata & EXIF
Read image dimensions, format, EXIF camera data, capture settings and GPS location from JPEG, PNG, WebP, HEIC, AVIF, GIF and more – upload or URL.
PDFPDF Metadata
Read PDF metadata: page count, title, author, creator, producer, dates, PDF version, encryption, form fields and the size of each page (A4, Letter…).
PDF₫Quote & Receipt PDF
Generate clean PDF quotations, receipts, orders and simple invoices from JSON, with Vietnamese text, VAT, totals in words and a VietQR code for payment.