MCPcopy Index your code
hub / github.com/pdfcpu/pdfcpu

github.com/pdfcpu/pdfcpu @v1.0.0-test

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0-test ↗ · + Follow
4,571 symbols 18,885 edges 298 files 1,337 documented · 29% 1 cross-repo links updated 5d agov0.13.0 · 2026-06-09★ 8,704137 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

pdfcpu: a PDF processor written in Go with CLI and API support

Test Coverage Status Go Reference Go Report Card License Sponsor

pdfcpu is a PDF processing library written in Go.

It is compatible with all PDF versions. Support for PDF 2.0 (ISO-32000-2) is evolving and continuously improving.


Installation

CLI

Prebuilt binaries and installation instructions (Homebrew, Docker, packages):

Installation instructions

Go API

Install pdfcpu as a Go module:

go get github.com/pdfcpu/pdfcpu

API documentation:

Installation and usage


Usage

CLI

Validate against PDF 2.0 (ISO-32000-2):

pdfcpu validate input.pdf

Merge two PDFs:

pdfcpu merge out.pdf in1.pdf in2.pdf

Go API

See API documentation for usage examples.


Features

  • Validate, optimize, split, trim, and merge PDFs
  • Extract and manipulate images, fonts, and metadata
  • Encrypt and decrypt PDFs
  • Resize and rotate pages
  • Add and remove stamps and watermarks
  • Manage digital signatures (ongoing work)
  • Manage attachments and more...

In Action

Common operations and examples:

         

         

 


Command Set

Complete list of supported commands:

annotations attachments booklet
bookmarks boxes certificates
change owner password change user password collect
config create crop
cut decrypt encrypt
extract fonts form
grid images import
info keywords merge
ndown nup optimize
pagelayout pagemode pages
permissions portfolio poster
properties resize rotate
signatures split stamp
trim validate viewerpref
watermark zoom

Motivation

pdfcpu aims to provide comprehensive PDF processing capabilities implemented in Go.

It focuses on correctness, robustness and independence from external dependencies.


Focus

  • comprehensive PDF processing functionality
  • minimal external dependencies
  • predictable and stable behavior

Documentation

  • Project documentation: https://pdfcpu.io

CLI

  • Command help: pdfcpu [command] --help

Go API

  • Package documentation: https://pkg.go.dev/github.com/pdfcpu/pdfcpu
  • API documentation: https://pkg.go.dev/github.com/pdfcpu/pdfcpu/pkg/api
  • Examples:

  • https://github.com/pdfcpu/pdfcpu/tree/master/pkg/api/test

  • https://github.com/pdfcpu/pdfcpu/tree/master/pkg/samples

Contributing

Contributions are welcome.

  • Report bugs or propose changes via issues
  • Discuss ideas on the discussion board
  • For PRs, please open an issue or discussion first v

Guidelines

  • Base your work on the latest commit
  • Include verbose output (pdfcpu cmd -vv ...) and a sample PDF when reporting issues
  • Please sign your commits

Reporting crashes

Crashes may occur due to the wide variety of PDF producers and formats in use, including older or non-compliant files. In many cases this is related to validation issues or edge cases in the parser.

Even with relaxed validation, some files cannot be processed. These cases are essential for improving pdfcpu by extending validation and handling additional real-world PDFs.

If you encounter a crash, please report it.

Start by validating the file using the CLI:

pdfcpu validate -vv <file.pdf>

Include in your report:

  • the command used
  • verbose output (-vv)
  • a sample PDF (if possible)

If validation crashes for a PDF that opens in Adobe Reader or macOS Preview, it is likely we can extend relaxed validation and provide a fix.

If the file cannot be opened by both Adobe Reader and macOS Preview, we cannot support it.

Please include a sample PDF to reproduce the issue whenever possible.


Contributors

Thanks 💚 to all contributors:

[

Horst Rutter](https://github.com/hhrutter) | [

haldyr](https://github.com/haldyr) | [

Vyacheslav](https://github.com/SimePel) | [

Erik Unger](https://github.com/ungerik) | [

Richard Wilkes](https://github.com/richardwilkes) | [

minenok-tutu](https://github.com/minenok-tutu) | [

Mateusz Burniak](https://github.com/matbur) | | [

Dmitry Harnitski](https://github.com/dharnitski) | [

ryarnyah](https://github.com/ryarnyah) | [

Sam Giffney](https://github.com/s01ipsist) | [

Carlos Eduardo Witte](https://github.com/cewitte) | [

minusworld](https://github.com/minusworld) | [

Witold Konior](https://github.com/jozuenoon) | [

joonas.fi](https://github.com/joonas-fi) | | [

Henrik Reinstädtler](https://github.com/henrixapp) | [

VMorozov-wh](https://github.com/VMorozov-wh) | [

Benoit KUGLER](https://github.com/benoitkugler) | [

Adam Greenhall](https://github.com/adamgreenhall) | [

moritamori](https://github.com/moritamori) | [

JanBaryla](https://github.com/JanBaryla) | [

TheDiscordian](https://github.com/TheDiscordian) | | [

Rafael Garcia Argente](https://github.com/rgargente) | [

truyet](https://github.com/truyet) | [

Christian Nicola](https://github.com/christiannicola) | [

Benjamin Krill](https://github.com/kben) | [

Peter Wyatt](https://github.com/petervwyatt) | [

Kroum Tzanev](https://github.com/kpym) | [

Stefan Huber](https://github.com/signalwerk) | | [

Juan Iscar](https://github.com/juaismar) | [

Eng Zer Jun](https://github.com/Juneezee) | [

Dmitry Ivanov](https://github.com/hant0508)|[

Rene Kaufmann](https://github.com/HeavyHorst)|[

Christian Heusel](https://github.com/christian-heusel) | [

Chris](https://github.com/freshteapot) | [

Lukasz Czaplinski](https://github.com/scoiatael) | [

Joel Silva Schutz](https://github.com/joelschutz)

Extension points exported contracts — how you extend this code

Filter (Interface)
Filter defines an interface for encoding/decoding PDF object streams. [8 implementers]
pkg/filter/filter.go
Object (Interface)
Object defines an interface for all Objects. [2 implementers]
pkg/pdfcpu/types/types.go
Logger (Interface)
Logger defines an interface for logging messages. [1 implementers]
pkg/log/log.go
AnnotationRenderer (Interface)
AnnotationRenderer is the interface for PDF annotations. [1 implementers]
pkg/pdfcpu/model/annotation.go
DecodeLazyObjectStreamObjectFunc (FuncType)
(no doc)
pkg/pdfcpu/types/streamdict.go

Core symbols most depended-on inside this repo

Fatalf
called by 763
pkg/log/log.go
Printf
called by 473
pkg/log/log.go
Width
called by 258
pkg/pdfcpu/types/types.go
Println
called by 236
pkg/log/log.go
DereferenceDict
called by 228
pkg/pdfcpu/model/dereference.go
NewDefaultConfiguration
called by 213
pkg/pdfcpu/model/configuration.go
Find
called by 207
pkg/pdfcpu/types/dict.go
Value
called by 203
pkg/pdfcpu/types/types.go

Shape

Function 3,280
Method 1,036
Struct 181
TypeAlias 68
Interface 4
FuncType 2

Languages

Go100%

Modules by API surface

cmd/pdfcpu/process.go124 symbols
pkg/pdfcpu/model/xreftable.go122 symbols
pkg/pdfcpu/types/types.go100 symbols
pkg/pdfcpu/read.go91 symbols
pkg/pdfcpu/model/annotation.go88 symbols
pkg/cli/cmd.go85 symbols
pkg/cli/cli.go83 symbols
pkg/pdfcpu/stamp.go79 symbols
pkg/pdfcpu/crypto.go70 symbols
cmd/pdfcpu/commands.go68 symbols
pkg/api/test/create_test.go67 symbols
pkg/pdfcpu/primitives/content.go66 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

github.com/clipperhouse/uax29/v2v2.7.0 · 1×
github.com/hhrutter/lzwv1.0.0 · 1×
github.com/hhrutter/pkcs7v0.2.2 · 1×
github.com/hhrutter/tiffv1.0.3 · 1×
github.com/inconshreveable/mousetrapv1.1.0 · 1×
github.com/mattn/go-runewidthv0.0.21 · 1×
golang.org/x/cryptov0.49.0 · 1×
golang.org/x/imagev0.38.0 · 1×
golang.org/x/textv0.35.0 · 1×

For agents

$ claude mcp add pdfcpu \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact