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.
Prebuilt binaries and installation instructions (Homebrew, Docker, packages):
Install pdfcpu as a Go module:
go get github.com/pdfcpu/pdfcpu
API documentation:
Validate against PDF 2.0 (ISO-32000-2):
pdfcpu validate input.pdf
Merge two PDFs:
pdfcpu merge out.pdf in1.pdf in2.pdf
See API documentation for usage examples.
Common operations and examples:
Complete list of supported commands:
pdfcpu aims to provide comprehensive PDF processing capabilities implemented in Go.
It focuses on correctness, robustness and independence from external dependencies.
pdfcpu [command] --helpExamples:
https://github.com/pdfcpu/pdfcpu/tree/master/pkg/api/test
Contributions are welcome.
pdfcpu cmd -vv ...) and a sample PDF when reporting issuesCrashes 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:
-vv)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.
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)
$ claude mcp add pdfcpu \
-- python -m otcore.mcp_server <graph>