iToverDose/Software· 2 JULY 2026 · 00:04

Simplify PDF workflows with a single API (no libraries or binaries needed)

Merging PDFs, adding watermarks, or converting images to PDFs often requires complex libraries. A lightweight HTTP API can handle these tasks server-side without native dependencies—here’s how to use it.

DEV Community4 min read0 Comments

Server-side PDF manipulation is notorious for dependency hell. Libraries like pdf-lib or pdftk demand native binaries, while tools such as Ghostscript require intricate setup—consuming hours of development time just to merge a few documents or stamp a watermark.

An alternative approach is gaining traction: a lightweight HTTP API that processes PDFs entirely in the cloud. This eliminates the need for local libraries, native builds, or server configurations, allowing developers to integrate PDF operations directly into their applications using standard HTTP requests. Below, we explore how this API simplifies common tasks like merging, splitting, and watermarking PDFs.

Streamline PDF operations with a cloud-based API

The PDF Toolkit API offers six endpoints designed for core PDF operations. These include merging multiple documents, splitting files by page ranges, rotating pages, stamping watermarks, retrieving file metadata, and converting image collections into a single PDF.

Key advantages of using a cloud API over traditional libraries:

  • No local dependencies: Avoid installing or maintaining native PDF binaries, Ghostscript, or other toolchains.
  • Cross-platform compatibility: Works seamlessly across any environment—serverless, edge, or locked-down platforms.
  • Unified interface: Replace multiple libraries with a single API for all PDF-related tasks.
  • Scalable pricing: A generous free tier (100 requests/day) and affordable paid plans make it cost-effective for high-volume use cases.

To get started, sign up for the BASIC plan on RapidAPI to obtain a free API key. This key will be used in all subsequent requests to authenticate and track usage.

Merge multiple PDFs in seconds (cURL and Node.js examples)

Merging documents is a frequent requirement, whether combining invoices, contracts, or reports. The API supports this via a simple POST request, where files are uploaded as multipart form data.

Example: Merge two PDFs using cURL

curl -X POST \
 ' \
 -H 'X-RapidAPI-Key: YOUR_API_KEY' \
 -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \
 -F 'files=@document1.pdf' \
 -F 'files=@document2.pdf' \
 --output combined.pdf

The resulting combined.pdf file will contain the contents of document1.pdf followed by document2.pdf. Each additional file appended via -F is added in sequence.

Example: Merge PDFs using Node.js

import fs from "node:fs";
import FormData from "form-data";
import axios from "axios";

const form = new FormData();
form.append("files", fs.createReadStream("report1.pdf"));
form.append("files", fs.createReadStream("report2.pdf"));

const response = await axios.post(
  "
  form,
  {
    responseType: "arraybuffer",
    headers: {
      ...form.getHeaders(),
      "X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
      "X-RapidAPI-Host": "pdf-toolkit-api2.p.rapidapi.com",
    },
  }
);

fs.writeFileSync("merged_report.pdf", response.data);
console.log("Merged PDF saved as merged_report.pdf");

This snippet reads two PDF files, sends them to the API, and saves the merged result locally. No local PDF libraries are required.

Add watermarks to PDFs effortlessly

Watermarking is essential for marking drafts, confidential documents, or paid invoices. The API allows you to overlay text—such as "DRAFT" or "CONFIDENTIAL"—across every page of a document.

Example: Stamp a watermark using cURL

curl -X POST \
 ' \
 -H 'X-RapidAPI-Key: YOUR_API_KEY' \
 -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \
 -F 'file=@client_report.pdf' \
 -F 'text=CONFIDENTIAL' \
 --output watermarked_report.pdf

The output file, watermarked_report.pdf, will include the specified text on every page. This approach is ideal for batch processing multiple documents without manual editing.

Convert images to PDF with a single request

Need to turn a set of JPGs or PNGs into a single PDF? The API supports this conversion by accepting multiple image files as input.

Example: Bundle images into a PDF using cURL

curl -X POST \
 ' \
 -H 'X-RapidAPI-Key: YOUR_API_KEY' \
 -H 'X-RapidAPI-Host: pdf-toolkit-api2.p.rapidapi.com' \
 -F 'files=@page1.jpg' \
 -F 'files=@page2.png' \
 -F 'files=@page3.jpg' \
 --output images_compiled.pdf

This is particularly useful for converting scanned receipts, screenshots, or photo collections into a structured document.

Why an API beats a library for PDF tasks

While libraries like pdf-lib are viable for lightweight or infrequent PDF operations, they have limitations. Native dependencies can be difficult to install, especially on serverless platforms or restricted environments. Additionally, maintaining multiple libraries for different tasks—merging, splitting, rotating, and watermarking—adds complexity.

The cloud-based API removes these barriers. Developers can integrate all PDF operations through a single endpoint, reducing setup time and eliminating the need to manage binaries. For teams already spending hours troubleshooting Ghostscript or PDF toolchains, this approach offers significant time savings.

The free tier provides ample room for testing and small-scale use, while paid plans are priced affordably for higher volumes. In many cases, the API’s cost is offset by the time saved on setup and maintenance.

Start simplifying your PDF workflow today

The PDF Toolkit API on RapidAPI is available with a free tier—no credit card required to begin. If your workflow also involves image resizing, compression, or format conversion, consider pairing it with the companion Image Toolkit API, which follows the same integration pattern.

Built by developers for developers, the API is designed to handle edge cases and common workflows efficiently. For feature requests or feedback, the creator actively reviews comments and welcomes suggestions for new endpoints or improvements.

As cloud-native development becomes the norm, tools that reduce infrastructure complexity will only grow in value. This API is a prime example—turning a traditionally cumbersome process into a straightforward, scalable service.

AI summary

PDF dosyalarını sunucuda birleştirmek, bölmek, filigran eklemek ya da resimleri PDF’e çevirmek için yerel kütüphanelere gerek kalmayan API çözümü. Örnekler ve ücretsiz kullanım imkânı.

Comments

00
LEAVE A COMMENT
ID #3GM15X

0 / 1200 CHARACTERS

Human check

8 + 9 = ?

Will appear after editor review

Moderation · Spam protection active

No approved comments yet. Be first.