What is pdfcpu?
pdfcpu is a PDF processing library and command-line tool written in Go. It supports validation, optimization, encryption, signing, document assembly, content extraction and other common PDF operations. It is licensed under Apache-2.0 and aims to provide comprehensive PDF processing for both individual files and automated batch processing, with minimal external dependencies.
You can use it as a command-line program, for example pdfcpu validate input.pdf or pdfcpu merge merged.pdf in1.pdf in2.pdf, or call the same functions from Go code through its API. The command list includes merge, split, extract, encrypt, decrypt, optimize, stamp, watermark, rotate, resize, form and signatures.
pdfcpu supports PDF versions through PDF 2.0 (ISO 32000-2), although PDF 2.0 validation is described as basic and still improving. Local images used in create and form fill operations are confined to an allowed directory; API callers must set conf.LocalImageRoot to enable them. The maintainer, Horst Rutter, is a member of the PDF Association. The project asks users to report PDFs that open in Adobe Acrobat Reader or macOS Preview but cannot be processed by pdfcpu.
Key capabilities
- Document operations Validate, optimize, split, trim and merge PDFs.
- Content handling Extract and manipulate images, fonts and metadata.
- Security Encrypt and decrypt PDFs, validate signature integrity and remove signatures.
- Page changes Resize and rotate pages, add and remove stamps and watermarks.
- Attachments Manage attachments and portfolios.
- Two interfaces A command-line tool and a Go API.
Where pdfcpu fits
- Document operations Validate, optimize, split, trim and merge PDFs.
- Content handling Extract and manipulate images, fonts and metadata.
- Signatures Validate signature integrity, report signature evidence and remove signatures.
- Page changes Resize and rotate pages, and add or remove stamps and watermarks.
- Page generation Commands such as booklet, ndown and nup for laying out pages.
- Forms and create The create and form fill commands, with local images confined to an allowed directory.
- Two interfaces A command-line tool and a Go library, written in Go.
- API configuration API callers must set conf.LocalImageRoot to allow local images.
Reviews of pdfcpu
Be the first to share your experience with pdfcpu.
Write a review
Loading review form…

