Merge PDF API: Combine PDFs with Page Ranges avatar

Merge PDF API: Combine PDFs with Page Ranges

Pricing

$5.00 / 1,000 merge completeds

Go to Apify Store
Merge PDF API: Combine PDFs with Page Ranges

Merge PDF API: Combine PDFs with Page Ranges

Merge PDF API to combine up to 20 PDFs from URLs or base64 into one file, in order, with page ranges, bookmarks and a manifest (pages, bytes, SHA-256). Built for n8n, Make, Zapier and AI agents. $0.005 per merge.

Pricing

$5.00 / 1,000 merge completeds

Rating

0.0

(0)

Developer

Ferrolark

Ferrolark

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Features

Limited permissions

Share

PDF Merge API: Combine PDFs with Page Ranges

Send a list of PDFs as URLs or base64 and get one merged PDF back. Files are merged in the order given, with optional page ranges per file, one bookmark per source file and a manifest with pages, bytes and SHA-256 for the output and every input.

It runs as a plain API call, so you don't need to install Stirling, add community nodes or sign up for a PDF service. It is built for n8n, Make, Zapier, scripts and AI agents.

Real example

This input:

{
"files": [
{"url": "https://arxiv.org/pdf/1706.03762", "pages": "1-2", "name": "Attention Is All You Need (pages 1-2)"},
{"url": "https://www.irs.gov/pub/irs-pdf/fw9.pdf", "pages": "1", "name": "IRS Form W-9 (page 1)"},
{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf", "name": "W3C dummy PDF"}
],
"outputFileName": "research-pack.pdf",
"title": "Research pack"
}

produced a 4-page, 240,269-byte PDF with three bookmarks.

  • Run time: 4.0 s on Apify at 512 MB, including downloading 2.4 MB of input.
  • Platform usage: $0.0002.
  • Your price: $0.005.

The run's dataset item:

{
"fileName": "research-pack.pdf",
"recordKey": "research-pack.pdf",
"downloadUrl": "https://api.apify.com/v2/key-value-stores/<store-id>/records/research-pack.pdf",
"pages": 4,
"bytes": 240269,
"sha256": "bbff8da01a3b20ae8d601c140270220b6ee0787c86c1edaa2828f2f93fa45a92",
"inputs": [
{
"name": "Attention Is All You Need (pages 1-2)",
"source": "https://arxiv.org/pdf/1706.03762",
"bytes": 2215244,
"sha256": "bdfaa68d8984f0dc02beaca527b76f207d99b666d31d1da728ee0728182df697",
"pagesInFile": 15,
"pagesUsed": [1, 2],
"outputPages": [1, 2],
"encrypted": false,
"signed": false
},
{"name": "IRS Form W-9 (page 1)", "pagesInFile": 6, "pagesUsed": [1], "outputPages": [3, 3], "...": "..."},
{"name": "W3C dummy PDF", "pagesInFile": 1, "pagesUsed": [1], "outputPages": [4, 4], "...": "..."}
],
"warnings": [
"IRS Form W-9 (page 1): has form fields; fields are kept on their pages but may lose document-level form settings."
]
}

The same input gives a byte-identical file (same SHA-256) on every run, so you can deduplicate or verify outputs.

Price and limits

  • $0.005 per successful merge.
    • There is no start fee or per-page fee.
    • Invalid input is not charged: a broken URL, a non-PDF file, a wrong password or a limit exceeded fails the run with "Not charged: …".
  • Limits per run, which may be raised later:
    • 20 input files;
    • 20 MB of input in total;
    • 100 pages in the output.
  • Use a single file with a page range to extract pages, for example "pages": "2-5". It costs the same as a merge.

Input

FieldWhat it does
pdfUrlsSimple list of PDF URLs, merged in order.
filesAdvanced list, merged after pdfUrls. Each item has url or base64, plus optional pages, name and password.
files[].pagesPage ranges, 1-based, in the order written: "1-3,5,8-", "last", "3-1" (reversed). Empty means all pages.
files[].base64The PDF itself, as base64 or a data:application/pdf;base64,… URL. Use it for n8n and Make binaries. Keep the whole input under about 9 MB; use URLs for bigger files.
outputFileNameRecord key of the merged file (default merged.pdf).
addBookmarksOne outline entry per input file (default on). The bookmark text is name, or the file name from the URL.
titlePDF metadata title.
passwordSecret field, used for encrypted inputs that have no password of their own.
createShareableUrlAlso return a signed link that works without a token (default off).

Output and privacy

  • The merged PDF is saved in the run's own key-value store.
  • downloadUrl is the API URL of that record, which needs your Apify token. By default nothing is publicly reachable.
  • Turn on createShareableUrl only if you need a link to hand to someone else. Anyone with that link can download the file.
  • Files are processed only to merge them:
    • no text extraction and no OCR;
    • no logging of file contents;
    • the files are not used for anything else.
  • Run storage follows your Apify data retention settings. Delete the run's storage when you no longer need it.

How it works

  • Merging uses pypdf (BSD license).
  • Pages are copied with their content, fonts, images, links and annotations.
  • Security:
    • Document-level JavaScript is never copied.
    • Automatic page actions (/AA) are removed, and a warning says so.
    • Downloads are limited to public addresses (private and local IPs are refused).
  • Encrypted PDFs are opened with the password you pass, or with an empty password if they only restrict printing or copying. The output is not encrypted.
  • Digitally signed PDFs can be merged, but merging rewrites the file, so the signature will not be valid in the output. The warnings field says so for each signed input.
  • Form fields stay on their pages. Document-level form settings may change, and you get a warning.

Call it from code, n8n or an AI agent

API (synchronous, returns the manifest):

curl -X POST "https://api.apify.com/v2/acts/ferrolark~pdf-merge-api/run-sync-get-dataset-items?maxTotalChargeUsd=0.01" \
-H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
-d '{"pdfUrls": ["https://example.com/a.pdf", "https://example.com/b.pdf"]}'
# then download the file (same token):
curl -H "Authorization: Bearer $APIFY_TOKEN" -o merged.pdf "<downloadUrl from the response>"

n8n: paste this workflow on the canvas (Ctrl+V). Then add one Header Auth credential with the name Authorization and the value Bearer <your Apify token>, and use it in both HTTP nodes.

  • The second node downloads the merged PDF as an n8n binary, ready for Gmail, Drive or S3 nodes.
  • To merge binaries that are already in n8n, send them in files[].base64 instead of url.
{
"name": "PDF Merge API: merge PDFs from URLs",
"nodes": [
{"parameters": {}, "name": "When clicking Test workflow", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [0, 0]},
{"parameters": {"method": "POST", "url": "https://api.apify.com/v2/acts/ferrolark~pdf-merge-api/run-sync-get-dataset-items?maxTotalChargeUsd=0.01", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "{\"files\": [{\"url\": \"https://www.irs.gov/pub/irs-pdf/fw9.pdf\", \"pages\": \"1\"}, {\"url\": \"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf\"}], \"outputFileName\": \"merged.pdf\"}", "options": {"timeout": 120000}}, "name": "Merge PDFs", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [220, 0]},
{"parameters": {"url": "={{ $json.downloadUrl }}", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "options": {"response": {"response": {"responseFormat": "file"}}}}, "name": "Download merged PDF", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [440, 0]}
],
"connections": {
"When clicking Test workflow": {"main": [[{"node": "Merge PDFs", "type": "main", "index": 0}]]},
"Merge PDFs": {"main": [[{"node": "Download merged PDF", "type": "main", "index": 0}]]}
}
}

Make / Zapier:

  1. Use the Apify app's "Run Actor" action with ferrolark/pdf-merge-api.
  2. Fetch the dataset item.
  3. Download downloadUrl with an HTTP module that sends the same Authorization header.

AI agents (MCP): add ferrolark/pdf-merge-api to the Apify MCP server (https://mcp.apify.com?actors=ferrolark/pdf-merge-api). An agent can then merge invoices, reports or contracts it already has links to.

Use cases

  • Build monthly invoice or receipt bundles for accounting from links in a spreadsheet.
  • Combine a cover page, generated report pages and appendices into one deliverable.
  • Extract the signature page or the first pages of long documents ("pages": "1-2").
  • Let an AI agent hand back one PDF instead of five attachments.

Troubleshooting

  • "not a PDF file (no %PDF- header)": the URL returned an HTML page, often a login wall or a viewer page. Use a direct download link.
  • "password-protected": pass password for that file, or the top-level password.
  • "returned HTTP 403": the host blocks automated downloads. Upload the file to your own storage and send a signed URL, or send it as base64.
  • "more than 100 pages": use page ranges or split the job into several runs.
  • Text looks different: the content is copied unchanged, so check the source file. Some PDF viewers render embedded fonts differently.

Limitations

  • No OCR, compression, conversion of other formats to PDF, or PDF/A output.
  • It does not remove passwords you don't have.
  • Signatures are not preserved, because merging creates a new document.
  • Interactive forms that use document-level scripts may not behave the same after merging.

Changelog

  • 1.0 (November 2026): first release. URLs and base64 input, page ranges, bookmarks, encrypted input, signature and form warnings, deterministic output and a SHA-256 manifest.

More Ferrolark tools

  • Brand Name Availability Checker: domains, GitHub, npm, PyPI and more in one report.
  • Domain Intelligence Report: WHOIS, DNS, email security, SSL and hosting for any domain.
  • Launch Asset Pack: favicons, PWA icons, OG image and head tags from one logo.
  • Live Deploy QA: meta tags, canonical, robots, OG image and favicon of your deployed routes, with diffs between deploys.
  • Sitemap Delta: new, removed and broken URLs in any sitemap since the last run.
  • RSS Delta: only new RSS, Atom and JSON Feed items, de-duplicated.
  • PDF Split API: split a PDF by page ranges or every N pages, or extract pages, with a ZIP and manifest.
  • Image Convert: PNG, JPG, WebP, AVIF and HEIC conversion (SVG input too) from URLs or base64.
  • Image Compress & Resize: resize images and compress them to a target size in KB, WebP or AVIF.
  • PDF to Image: PDF pages to PNG, JPG or WebP at the DPI you choose.
  • Image to PDF: JPG, PNG, HEIC and WebP images to one PDF, JPEGs embedded without recompression.
  • PDF Compress: smaller PDFs, lossless or with image downsampling; charged only when smaller.
  • HTML to PDF & URL to PDF: web pages or raw HTML to PDF with headless Chrome.
  • Markdown to PDF: Markdown with tables, code and footnotes to a clean PDF.
  • DOCX to PDF: Word, Excel, PowerPoint and ODT to PDF with LibreOffice.
  • Data Convert: CSV, JSON, NDJSON and Excel XLSX in any direction.

Built by Ferrolark.