Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 20, 2026·2 min de lecture

pdfcpu — PDF Processing Toolkit for Go and the Command Line

A comprehensive Go library and CLI for PDF manipulation including merge, split, watermark, encrypt, optimize, and validate operations. Requires no external dependencies like Ghostscript.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
pdfcpu
Commande d'installation directe
npx -y tokrepo@latest install ef46d767-8457-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

pdfcpu is a pure Go library and command-line tool for processing PDF files. It covers the full spectrum of common PDF operations without relying on external tools like Ghostscript or Poppler.

What pdfcpu Does

  • Merges, splits, rotates, and reorders PDF pages
  • Adds text and image watermarks or stamps to pages
  • Encrypts and decrypts PDFs with AES-256 or RC4
  • Validates PDF files against the PDF specification
  • Optimizes file size by removing redundant objects and compressing streams

Architecture Overview

pdfcpu is written entirely in Go with no CGo dependencies. It implements a PDF parser and writer that handles the full PDF object model including cross-reference tables, object streams, and incremental updates. The CLI wraps the library API and supports batch operations across multiple files.

Self-Hosting & Configuration

  • Install via go install or download prebuilt binaries from GitHub Releases
  • Available in Homebrew, AUR, and Docker Hub
  • No configuration file required; all options are passed via CLI flags
  • The Go library can be imported directly into Go projects
  • Supports stdin/stdout piping for integration into shell pipelines

Key Features

  • Pure Go implementation with zero external dependencies
  • Full PDF spec compliance including PDF 2.0 support
  • Batch processing support for operating on multiple files at once
  • Page-level operations: extract, insert, remove, rotate individual pages
  • Form filling and flattening for automated document workflows

Comparison with Similar Tools

  • Ghostscript — C-based and heavyweight; pdfcpu is a single Go binary with no system dependencies
  • qpdf — C++ PDF transformation tool; pdfcpu offers a similar feature set in pure Go
  • PyPDF — Python library; pdfcpu is faster and works as both a CLI and Go library
  • pdftk — Java-based PDF toolkit; pdfcpu has no JVM requirement and is easier to deploy
  • Stirling PDF — web-based PDF suite; pdfcpu is a CLI/library for automation and scripting

FAQ

Q: Does pdfcpu support password-protected PDFs? A: Yes. It can encrypt and decrypt PDFs using AES-128, AES-256, or RC4 encryption.

Q: Can I use pdfcpu as a Go library? A: Yes. The library API mirrors the CLI functionality and is well-documented.

Q: Does it handle scanned PDFs or OCR? A: No. pdfcpu works with the PDF structure, not image content. Use a separate OCR tool first.

Q: Is PDF 2.0 supported? A: Yes. pdfcpu supports reading and writing PDF 2.0 compliant files.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires