{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreid7l3txb2lsnv6ntmnbqsttozvhn4tmehdctc2glunsndaavpqeta",
    "uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mpmpwi3eghc2"
  },
  "coverImage": {
    "$type": "blob",
    "ref": {
      "$link": "bafkreic3rxkqvdn2kww5rzewfbxci4bglyd2zoxaym6rqqkyc5u3dwgbmq"
    },
    "mimeType": "image/webp",
    "size": 70160
  },
  "path": "/pop_noodle/merge-split-and-watermark-pdfs-from-your-app-with-one-api-no-native-libraries-5hg0",
  "publishedAt": "2026-07-01T23:21:53.000Z",
  "site": "https://dev.to",
  "tags": [
    "pdf",
    "api",
    "node",
    "tutorial",
    "PDF Toolkit API",
    "PDF Toolkit API on RapidAPI",
    "Image Toolkit API",
    "@invoice.pdf",
    "@terms.pdf",
    "@...",
    "@report.pdf",
    "@page1.jpg",
    "@page2.png"
  ],
  "textContent": "If you've ever had to merge a few PDFs, stamp a \"CONFIDENTIAL\" watermark, or turn a stack of images\ninto a single PDF **on the server** , you know the pain: `pdf-lib`, `pdftk`, `ghostscript`, native\nbinaries that won't install on your host, and an afternoon gone.\n\nHere's a lighter option: a small HTTP API that does the common PDF jobs for you. You POST a file, you get\na PDF back. No dependencies, no native build steps, works from any language.\n\nI'll show merge, watermark, and images-to-PDF with copy-paste examples in cURL and Node.\n\n##  The endpoints\n\nThe PDF Toolkit API exposes six routes:\n\nEndpoint | Does\n---|---\n`POST /v1/pdf/merge` | Combine multiple PDFs into one\n`POST /v1/pdf/split` | Split a PDF into pages / ranges\n`POST /v1/pdf/rotate` | Rotate pages\n`POST /v1/pdf/watermark` | Stamp text over every page\n`POST /v1/pdf/info` | Page count, size, metadata\n`POST /v1/images-to-pdf` | Turn JP/PNG images into a PDF\n\nIt's on RapidAPI, so you get a key and a free tier (100 requests/day) to try it. Grab a key by\nsubscribing to the free BASIC plan, then copy your `X-RapidAPI-Key` from the dashboard.\n\n##  1. Merge PDFs (cURL)\n\n\n    curl -X POST \\\n      'https://pdf-toolkit-api2.p.rapidapi.com/v1/pdf/merge' \\\n      -H 'X-RapidAPI-Key: YOUR_KEY' \\\n      -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \\\n      -F 'files=@invoice.pdf' \\\n      -F 'files=@terms.pdf' \\\n      --output merged.pdf\n\n\nThat's it — `merged.pdf` is written to disk. Two `-F files=@...` fields become one document, in order.\n\n##  2. Merge PDFs (Node.js)\n\n\n    import fs from \"node:fs\";\n    import FormData from \"form-data\";\n    import axios from \"axios\";\n\n    const form = new FormData();\n    form.append(\"files\", fs.createReadStream(\"invoice.pdf\"));\n    form.append(\"files\", fs.createReadStream(\"terms.pdf\"));\n\n    const res = await axios.post(\n      \"https://pdf-toolkit-api2.p.rapidapi.com/v1/pdf/merge\",\n      form,\n      {\n        responseType: \"arraybuffer\",\n        headers: {\n          ...form.getHeaders(),\n          \"X-RapidAPI-Key\": process.env.RAPIDAPI_KEY,\n          \"X-RapidAPI-Host\": \"pdf-toolkit-api2.p.rapidapi.com\",\n        },\n      }\n    );\n\n    fs.writeFileSync(\"merged.pdf\", res.data);\n    console.log(\"Wrote merged.pdf\");\n\n\n##  3. Watermark every page\n\nGreat for draft stamps, \"PAID\", or a customer name across an exported report:\n\n\n\n    curl -X POST \\\n      'https://pdf-toolkit-api2.p.rapidapi.com/v1/pdf/watermark' \\\n      -H 'X-RapidAPI-Key: YOUR_KEY' \\\n      -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \\\n      -F 'file=@report.pdf' \\\n      -F 'text=CONFIDENTIAL' \\\n      --output stamped.pdf\n\n\n##  4. Turn images into a PDF\n\nScanned receipts, screenshots, a photo set — one PDF:\n\n\n\n    curl -X POST \\\n      'https://pdf-toolkit-api2.p.rapidapi.com/v1/images-to-pdf' \\\n      -H 'X-RapidAPI-Key: YOUR_KEY' \\\n      -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \\\n      -F 'files=@page1.jpg' \\\n      -F 'files=@page2.png' \\\n      --output out.pdf\n\n\n##  When an API beats a library\n\nTo be fair — if you're already comfortable with `pdf-lib` and you only do one PDF task, a library is\nfine and free. An API earns its keep when:\n\n  * You're on a host where native PDF binaries are a nightmare (serverless, edge, locked-down PaaS).\n  * You want **one** integration for merge + split + rotate + watermark + images, not five libraries.\n  * You'd rather not maintain PDF code at all.\n\n\n\nAt 100 requests/day free and a few dollars a month for real volume, it's usually cheaper than the hour\nyou'd spend fighting `ghostscript`.\n\n##  Try it\n\nFree tier, no credit card to start: **PDF Toolkit API on RapidAPI**.\nIf you need image resizing/converting/compression too, there's a companion\nImage Toolkit API with the same shape.\n\n_Built it because I kept re-writing the same PDF glue code. If you hit a rough edge or want an endpoint\nthat isn't there, drop a comment — I read them._",
  "title": "Merge, split, and watermark PDFs from your app with one API (no native libraries)"
}