Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsJul 20, 2026·2 min de lectura

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.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
pdfcpu
Comando de instalación directa
npx -y tokrepo@latest install ef46d767-8457-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con 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

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados