Merge and pages
Join files, pick page ranges, rotate and delete pages.
POST /v1/merge joins two or more files, in the order of the fields file1, file2… Any
format convert accepts can be merged, so a Word annex can follow a PDF contract.
Cost: 1 unit per request.
Merge files
curl https://api.nexpdf.dev/v1/merge \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F file1=@contract.pdf \
-F file2=@annex.pdf \
-o packet.pdfPick pages, rotate and delete
For more control, use a build. Each part can take a page range (start and end, counted from 0;
-1 is the last page). rotate and delete_pages act on the joined document, also counted from 0.
curl https://api.nexpdf.dev/v1/build \
-H "Authorization: Bearer $NEXPDF_API_KEY" \
-F contract=@contract.pdf \
-F annex=@annex.docx \
-F 'instructions={
"parts": [
{
"file": "contract"
},
{
"file": "annex",
"pages": {
"start": 0,
"end": 1
}
}
],
"actions": [
{
"type": "rotate",
"degrees": 90,
"pages": [
2
]
},
{
"type": "delete_pages",
"pages": [
0
]
}
]
}' \
-o packet.pdfSplit a document
To take one range out of a document, make a build with one part and its pages. To cut a
document into several files in one request, see Split.