# gpdf > A pure Go, zero-dependency PDF generation library with first-class CJK support. 10-30x faster than alternatives. ## Overview gpdf is an open-source (MIT license) PDF generation library written in pure Go. It has zero external dependencies — using only the Go standard library. It provides first-class support for Japanese, Chinese, and Korean (CJK) text rendering with TrueType font embedding. ## Key Features - **Zero Dependencies**: Pure Go, stdlib only. No CGO, no external libraries. Single binary deployment. - **First-Class CJK Support**: Native Japanese, Chinese, Korean text rendering. TrueType font embedding. No tofu, no mojibake. - **10-30x Faster**: Benchmarked against gofpdf, gopdf, and Maroto v2. Complex PDFs in under 5ms. Single-page generation ~13µs. - **12-Column Grid Layout**: Bootstrap-style declarative layout system with rows, columns, and responsive spacing. - **Declarative Builder API**: PageBuilder → RowBuilder → ColBuilder fluent API for intuitive document construction. - **Templates**: Ready-to-use invoice, receipt, and estimate templates. - **PDF Features**: TrueType fonts, images (JPEG/PNG), barcodes, QR codes, headers/footers, page numbers, overlay, merge, form flattening. ## Installation ``` go get github.com/gpdf-dev/gpdf ``` ## Quick Example ```go doc := gpdf.New() doc.AddPage(gpdf.A4()). Row(func(r) { r.Col(12).Text("Hello, PDF!") }) doc.Output("hello.pdf") ``` ## Architecture gpdf uses a 3-layer architecture: - **Layer 3 (template)**: Declarative Builder API, 12-col Grid, JSON Schema, Go Templates - **Layer 2 (document)**: Nodes, Box Model, Layout Engine, Renderer - **Layer 1 (pdf)**: PDF Writer, TrueType Fonts (CJK-aware), Streams, Images, Barcode/QR ## Documentation - [Quickstart](https://gpdf.dev/docs/quickstart) - [Installation](https://gpdf.dev/docs/guide/installation) - [Basic Usage](https://gpdf.dev/docs/guide/basic-usage) - [Grid Layout](https://gpdf.dev/docs/guide/grid-layout) - [Styling](https://gpdf.dev/docs/guide/styling) - [Fonts](https://gpdf.dev/docs/guide/fonts) - [API Reference](https://gpdf.dev/docs/api-reference/gpdf-package) - [Examples](https://gpdf.dev/docs/examples/basics) ## Writing gpdf JSON with an AI A single-file canonical spec for having an AI (or a person) write the JSON that `template.FromJSON` accepts: prose, the JSON Schema, and examples that gpdf's test suite validates and renders. Hand the whole file to the model. - [gpdf JSON spec (EN)](https://gpdf.dev/spec/gpdf-json-spec.en.md) - [gpdf JSON spec (JA)](https://gpdf.dev/spec/gpdf-json-spec.ja.md) - [JSON Schema](https://gpdf.dev/schema/gpdf.schema.json) ## Blog Long-form articles, migration guides, and deep dives. Same content in six languages (EN / JA / ZH / KO / ES / PT) under locale-prefixed paths (e.g. `/ja/blog/...`). - [Blog Index (EN)](https://gpdf.dev/blog) - [Blog Index (JA)](https://gpdf.dev/ja/blog) - [Blog Index (ZH)](https://gpdf.dev/zh/blog) - [Atom Feed (EN)](https://gpdf.dev/rss.xml) - [Atom Feed (JA)](https://gpdf.dev/ja/rss.xml) Featured posts: - [gofpdf is archived — migration guide to gpdf](https://gpdf.dev/blog/gofpdf-migration) — maps every gofpdf API to gpdf with five before/after pairs; covers CJK fonts, tables, headers/footers, and output calls. ## Links - Website: https://gpdf.dev - GitHub: https://github.com/gpdf-dev/gpdf - Go Package: https://pkg.go.dev/github.com/gpdf-dev/gpdf - Full LLM context: https://gpdf.dev/llms-full.txt