talira

PDF tooling for Go and the command line

open sourceApache-2.0self-hostablefree

pdfcpu is a PDF processing library and command-line tool written in Go, with minimal external dependencies. It validates, optimizes, splits, trims, merges, encrypts and decrypts PDFs, adds stamps and watermarks, extracts images, fonts and metadata, manages attachments, bookmarks and portfolios, fills and exports forms from JSON or CSV, and creates PDFs from JSON. It supports PDF versions through PDF 2.0 and can validate digital signatures. Its maintainer, Horst Rutter, is a member of the PDF Association.

Ways to install

Package managers

Problems it solves

  • merge, split and reorder PDF pages from a shell script without installing Java or Python
  • check whether a PDF is valid before I accept it in my upload pipeline
  • shrink bloated PDFs by optimizing them in a batch job
  • add a watermark or stamp text and images onto every page of a PDF
  • password-protect a PDF and set its permissions from the command line
  • fill hundreds of PDF forms from a CSV or JSON file
  • export the values of a filled PDF form to JSON
  • process PDFs in my Go program with a pure Go library and no cgo
  • lay out several pages per sheet or make a booklet for printing
  • check whether the digital signatures in a PDF are intact
  • extract images, fonts and metadata from a PDF in a script
  • create a PDF with tables and images from a JSON description

Features

  • validate, optimize, split, trim and merge PDFs
  • extract and manipulate images, fonts and metadata
  • encrypt and decrypt, change passwords, set permissions
  • resize, rotate, crop, zoom and n-up pages
  • add and remove stamps and watermarks
  • validate signature integrity, report signature evidence and remove signatures
  • attachments, portfolios, bookmarks, annotations, keywords and properties
  • form commands: list, lock, unlock, reset, export to JSON, fill from JSON and multifill from JSON or CSV
  • create PDFs from JSON
  • booklets, posters, grids, cut and ndown
View 2 more
  • PDF versions through PDF 2.0 (ISO 32000-2)
  • Go API

Limitations

  • No official Docker image yet: one is planned for v0.17.02

Capabilities

Has a command line toolplan not known
Has official SDKsplan not known

Alternatives

The same job

These do what pdfcpu does.

  1. qpdf A content-preserving PDF document transformer
  2. Stirling-PDF Your PDFs. Your servers.
  3. pdftk (PDFtk Server and pdftk-java) A command-line tool for working with PDFs
  4. MuPDF The ultimate library for managing PDF documents
  5. pdf-lib Create and modify PDF documents in any JavaScript environment.
  6. lopdf A Rust library for PDF document manipulation.

Compare pdfcpu with the top 3