Blog
Release notes, renderer deep dives, and community stories from the gpdf project.
Nov 12, 2026
How do I show "Page X of Y" in a gpdf footer?
Put document.PageNumberPlaceholder and TotalPagesPlaceholder inside one c.Text string. gpdf v1.0.14+ fills both in and keeps the line aligned.
recipetutorialtemplatesNov 10, 2026
How do I set a custom paper size in gpdf?
Build a document.Size in points — document.Mm(100).Resolve(0, 0) converts — and pass it to WithPageSize. Labels, receipts, JIS B5, and the traps.
recipetutorialtemplatesSep 2, 2026
How do I align a gpdf column to the right edge of a row?
Two things need to happen: a filler Col to push the column to the right edge, and template.AlignRight() on the text inside it. Here's the gpdf code.
recipetutorialtemplatesMay 19, 2026
Page numbers, headers, and footers that just work in Go PDFs
Add headers, footers, and page numbers to Go PDFs with gpdf: two builder methods, the same 12-column grid as the body, and a paginator that fills the totals.
tutorialinternalsMay 18, 2026
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.
comparisonbenchmarkmigrationMay 16, 2026
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.
recipetutorialtemplatesMay 12, 2026
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.
recipetutorialtemplatesMay 11, 2026
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.
recipetutorialcjkMay 7, 2026
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.
tutorialtemplatescomparisonMay 6, 2026
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.
migrationcomparisontutorialMay 5, 2026
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.
recipetutorialMay 4, 2026
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.
recipetutorialtemplatesApr 30, 2026
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.
recipetutorialApr 29, 2026
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.
migrationcomparisontutorialApr 29, 2026
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.
internalstemplatescomparisonApr 28, 2026
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.
recipetutorialApr 28, 2026
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.
recipetutorialApr 23, 2026
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.
recipetutorialApr 21, 2026
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.
tutorialtemplatesApr 19, 2026
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.
recipecjktutorialApr 19, 2026
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.
benchmarkinternalscomparisonApr 17, 2026
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.
recipetroubleshootingcjkApr 17, 2026
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.
recipecjktutorialApr 16, 2026
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.
recipetutorialtemplatesApr 16, 2026
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.
migrationcomparisonbenchmarkApr 16, 2026
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.
tutorialcjktroubleshootingApr 15, 2026
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.
comparisonbenchmarkApr 15, 2026
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.
recipecjktutorialApr 15, 2026
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.
recipecjktutorialApr 14, 2026
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.
migrationcomparisontutorial