#templates
Posts tagged "templates"
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 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 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 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 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 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 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.
recipetutorialtemplates