Blog
Release notes, renderer deep dives, and community stories from the gpdf project.
Page numbers, headers, and footers that just work in Go PDFs
Add headers, footers, and 'Page X of Y' in Go PDFs with gpdf: two builder methods, a two-pass paginator that fills in the totals, no shims required.
gpdf vs wkhtmltopdf vs Chromium-based PDF generation
wkhtmltopdf is archived. Chromium ships a 170 MB browser per request. gpdf renders a page in 13 µs with no browser. Here's the honest 2026 comparison.
How do I nest a Row inside a Col in gpdf?
You can't — ColBuilder has no Row method in gpdf. The 12-column grid is flat by design. Here are the three idioms that replace nested rows.
How do I make a table span multiple pages?
You don't do anything. Feed gpdf a table with more rows than fit, and it paginates the body and repeats the header on every page automatically.
How do I mix two fonts in the same paragraph in gpdf?
To mix fonts in one paragraph in gpdf, call c.RichText and set template.FontFamily on each span — c.Text only styles the whole string at once.
Tables in Go PDFs: column widths, striped rows, page breaks
Tables are the hardest part of a Go PDF. gpdf collapses widths, stripes, and multi-page header repeat into one Table call — here is the whole API and what it costs.
From signintech/gopdf to gpdf: less coordinate math
signintech/gopdf works, but every cell, line, and header is an (x, y) calculation. This guide maps the gopdf API to gpdf — same Go, no coordinate math.
How do I scale an image proportionally to fit a column?
gpdf already does it. c.Image(bytes) fills the column width and preserves aspect ratio. Use FitWidth or FitHeight for explicit bounds, WithFitMode for the non-default behaviors.
How do I create striped (zebra) table rows?
Pass template.TableStripe to a table call. gpdf paints the alternate body rows with the color you give it. No row-loop, no manual cell styling.
How do I add a custom TrueType font to gpdf?
Load TTF bytes, register with gpdf.WithFont, then reference the family name. Works for any TrueType — Inter, Roboto, icon fonts, brand fonts.
unipdf is AGPL or paid. Here's how to migrate to gpdf.
UniDoc's unipdf forces AGPL v3 or a per-developer commercial license. This guide maps the unipdf creator API to gpdf — MIT, zero deps, no license key.
Bootstrap thinking for PDF: gpdf's 12-column grid
gpdf borrows the 12-column grid from Bootstrap, but PDFs aren't web pages. Here's why 12 still works, and what we threw out: breakpoints, gutters, order.
How do I set column widths in a gpdf table?
Pass template.ColumnWidths(...) to c.Table. Values are percentages of the parent column's width. Sum to 100; trailing missing values auto-distribute.
How do I embed a PNG with transparency in gpdf?
Pass the PNG bytes directly to c.Image. gpdf decodes the alpha channel into a PDF SMask so transparent backgrounds render correctly.
How do I use bold and italic together in gpdf?
Bold and italic on the same span work via template.Bold() and template.Italic(). For TrueType fonts you must register all four variants or the BoldItalic lookup silently falls back to the base family.
Generate an invoice PDF in Go in under 50 lines
A complete, runnable invoice PDF in Go — 50 lines with gpdf, zero dependencies, no Chromium, no CGO. Here's the code and what every block does.
How do I use Source Han Sans JP with gpdf?
Register the TTF variant of Source Han Sans JP from Adobe's GitHub release with gpdf.WithFont. Seven weights, SIL OFL, same glyphs as Noto Sans JP.
Why gpdf is 10–30× faster than other Go PDF libraries
gpdf generates a single PDF page in 13 µs and a 100-page report in 683 µs. Not a tuning trick — three architectural choices that compound. Here's the code path.
Why does my PDF show tofu boxes for Japanese?
Empty rectangles instead of Japanese characters mean your PDF couldn't find glyphs for those codepoints. Here are the four causes and the fixes.
How do I use IPAex Gothic in gpdf?
Register ipaexg.ttf with gpdf.WithFont. IPAex Gothic ships a single Regular weight under the IPA Font License — bold emphasis has to be synthesized or paired.
How does the 12-column grid work in gpdf?
gpdf's 12-column grid uses r.Col(span, fn) where span is 1–12. Column width is (span/12) of the row. No breakpoints, no gutters, predictable by design.
go-pdf/fpdf is archived too. Here's the modern Go PDF stack.
jung-kurt/gofpdf archived in 2021. go-pdf/fpdf followed in 2025. Here's the Go PDF stack we actually use in 2026 — gpdf, the trade-offs, and why.
Japanese PDFs in Go: the 2026 definitive guide
How to generate Japanese PDFs in Go in 2026 — fonts, TrueType subsets, mixed kanji/kana/ASCII, and why CGO and Chromium are unnecessary.
Go PDF Library Showdown 2026
The Go PDF library landscape in 2026: every active and archived library, benchmarked on 4 workloads, with license and dependency details.
How do I embed a Japanese font in gpdf?
Register a Japanese TrueType font with gpdf.WithFont at document construction. Three lines, subset embedding happens automatically, no CGO.
How do I use Noto Sans JP with gpdf?
Register the static NotoSansJP-Regular.ttf with gpdf.WithFont. Skip the variable font — gpdf's pure-Go parser does not read fvar tables. Subsetting lands around 30 KB.
gofpdf is archived. Here's how to migrate to gpdf.
jung-kurt/gofpdf was archived in 2021. This guide maps every gofpdf API to gpdf — a pure-Go replacement with native CJK support and zero dependencies.