whatisgithub

What is pdfcpu?

pdfcpu/pdfcpu — explained in plain English

Analysis updated 2026-06-24

8,631GoAudience · developerComplexity · 2/5LicenseSetup · easy

In one sentence

pdfcpu is a Go library and command-line tool for working with PDF files. It can merge, split, encrypt, watermark, extract images and fonts, fill forms, and handle most PDF operations with no external dependencies.

Mindmap

mindmap
  root((repo))
    What it does
      Validates PDFs
      Merges and splits
      Encrypts and decrypts
    Content operations
      Watermark and stamp
      Extract images
      Extract fonts
    Form handling
      Read PDF forms
      Fill PDF forms
    Usage modes
      CLI tool
      Go library
    Design
      No external deps
      All PDF versions
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Merge multiple PDF reports into one file from the command line without installing Adobe software

USE CASE 2

Encrypt a PDF with a password and restrict permissions like printing or copying, programmatically in Go

USE CASE 3

Extract all embedded images from a PDF as separate files for reuse or inspection

USE CASE 4

Fill in a PDF form programmatically with data pulled from a database using the Go library

What is it built with?

Go

How does it compare?

pdfcpu/pdfcpuv2fly/domain-list-communityopenshift/origin
Stars8,6318,6148,650
LanguageGoGoGo
Setup difficultyeasyeasyhard
Complexity2/51/54/5
Audiencedeveloperops devopsops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min
Licensed under Apache 2.0, free to use and distribute for any purpose including commercial, as long as you include the license notice.

So what is it?

pdfcpu is a library for working with PDF files, written in the Go programming language. It can be used both as a command-line tool that you run in a terminal and as a code library that developers import into their own Go programs. It works with all versions of the PDF format, with support for the most recent version (PDF 2.0) still being actively improved. The tool covers a wide range of PDF operations. On the basic end, you can validate a PDF against the standard, merge multiple PDF files into one, split a single PDF into separate files, or trim it down to specific pages. It also handles things that are more involved, like encrypting and decrypting password-protected files, changing permission settings, adding watermarks or stamps to pages, resizing and rotating pages, and cropping page boundaries. Beyond editing existing files, pdfcpu can also extract content from PDFs: you can pull out embedded images, fonts, or metadata as separate files. There is also a form handling feature for reading and filling PDF forms, and a booklets feature for rearranging pages into a printable booklet layout. The full list of supported commands is extensive and documented on the project's website. The design priorities are correctness, stable behavior, and avoiding external dependencies, meaning the library does not rely on third-party PDF toolkits or system-level PDF software. This makes it straightforward to include in a Go project without additional installation steps for end users. For command-line use, each sub-command accepts a help flag for details. For developers using it as a Go library, there is package documentation and a set of example files in the repository. The project is open source under the Apache 2.0 license and welcomes contributions and bug reports, particularly when reports include a sample PDF that demonstrates the issue.

Copy-paste prompts

Prompt 1
Using pdfcpu in Go, write a function that merges all PDF files in a directory into a single output file, sorted by filename
Prompt 2
Show me the pdfcpu CLI commands to encrypt a PDF with an owner password, prevent printing, and allow only reading
Prompt 3
Write a Go program using pdfcpu to extract all images from a PDF and save them as individual files in an output directory
Prompt 4
How do I add a CONFIDENTIAL watermark to every page of a PDF using pdfcpu, centered on the page and at 30 percent opacity?

Frequently asked questions

What is pdfcpu?

pdfcpu is a Go library and command-line tool for working with PDF files. It can merge, split, encrypt, watermark, extract images and fonts, fill forms, and handle most PDF operations with no external dependencies.

What language is pdfcpu written in?

Mainly Go. The stack also includes Go.

What license does pdfcpu use?

Licensed under Apache 2.0, free to use and distribute for any purpose including commercial, as long as you include the license notice.

How hard is pdfcpu to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is pdfcpu for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.