PDF libraries for Go
- pdfcpu is a pure-Go PDF processor with a library API and a command line: validate, merge, split, rotate, trim, encrypt, decrypt, watermark, stamp, extract images and fonts, fill and export forms. It doesn’t extract text or render pages. Apache 2.0.
- ledongthuc/pdf is a small pure-Go reader (a fork of rsc/pdf) that extracts plain text, styled text runs and rows. BSD-3-Clause.
- go-fitz wraps MuPDF with cgo (or purego): render pages to images and extract text, HTML or SVG from PDF, EPUB, XPS and more. It bundles static MuPDF libraries. AGPL-3.0.
Pick pdfcpu to manipulate files, ledongthuc/pdf for simple text extraction without cgo, and go-fitz when you need rendering or accurate text and the AGPL is acceptable. To create PDFs from scratch, use signintech/gopdf (MIT) or go-pdf/fpdf, the continuation of gofpdf.
- go-fitz go-fitz is a Go wrapper for MuPDF that renders PDF pages to images and extracts text, HTML and SVG. How to install it, render pages to PNG or JPEG.
- ledongthuc/pdf ledongthuc/pdf is a small pure-Go library to extract text from PDF files. How to install it, extract plain text, get text with fonts and positions.
- pdfcpu pdfcpu is a pure-Go PDF processor and command-line tool. How to install it, merge and split PDFs, rotate pages, encrypt and decrypt, read metadata.