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