<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-CN">
  <title>gpdf 博客</title>
  <subtitle>gpdf 项目的发布说明、渲染器深度解析和社区故事。</subtitle>
  <link href="https://gpdf.dev/zh/rss.xml" rel="self" type="application/atom+xml" />
  <link href="https://gpdf.dev/zh/blog" rel="alternate" type="text/html" />
  <id>https://gpdf.dev/zh/rss.xml</id>
  <updated>2026-09-02T00:00:00.000Z</updated>
  <generator uri="https://gpdf.dev">gpdf-cloud</generator>
  <entry>
    <title>如何把 gpdf 的 Col 对齐到行的右边缘？</title>
    <link href="https://gpdf.dev/zh/blog/align-column-right-edge" />
    <id>https://gpdf.dev/zh/blog/align-column-right-edge</id>
    <updated>2026-09-02T00:00:00.000Z</updated>
    <published>2026-09-02T00:00:00.000Z</published>
    <summary>需要做两件事：用一个空的填充 Col 把列推到右边缘，再用 template.AlignRight() 让列内文本右对齐。两者是分开的，通常都要。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/zh/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>在 Go PDF 中正确实现页码、页眉和页脚</title>
    <link href="https://gpdf.dev/zh/blog/page-numbers-headers-footers" />
    <id>https://gpdf.dev/zh/blog/page-numbers-headers-footers</id>
    <updated>2026-05-19T00:00:00.000Z</updated>
    <published>2026-05-19T00:00:00.000Z</published>
    <summary>用 gpdf 在 Go PDF 中加入页眉、页脚和『Page X of Y』：两个 builder 方法和两阶段分页器自动填充总页数，无需 hack。</summary>
    <author>
      <name>gpdf team</name>
      <uri>https://gpdf.dev</uri>
    </author>
    <category term="tutorial" />
    <category term="internals" />
  </entry>
  <entry>
    <title>gpdf vs wkhtmltopdf vs Chromium —— 2026 年 PDF 生成方案对比</title>
    <link href="https://gpdf.dev/zh/blog/gpdf-vs-wkhtmltopdf-vs-chromium" />
    <id>https://gpdf.dev/zh/blog/gpdf-vs-wkhtmltopdf-vs-chromium</id>
    <updated>2026-05-18T00:00:00.000Z</updated>
    <published>2026-05-18T00:00:00.000Z</published>
    <summary>wkhtmltopdf 已归档。Chromium 每次请求消耗 170 MB。gpdf 用 13 µs 渲染一页，无需浏览器。2026 年的诚实对比。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="comparison" />
    <category term="benchmark" />
    <category term="migration" />
  </entry>
  <entry>
    <title>如何在 gpdf 的 Col 中嵌套一个 Row？</title>
    <link href="https://gpdf.dev/zh/blog/nest-row-in-col" />
    <id>https://gpdf.dev/zh/blog/nest-row-in-col</id>
    <updated>2026-05-16T00:00:00.000Z</updated>
    <published>2026-05-16T00:00:00.000Z</published>
    <summary>不能。ColBuilder 上没有 Row 方法，gpdf 的 12 列网格刻意保持扁平。这里给出替代嵌套 Row 的三种惯用写法。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/zh/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>如何让表格跨多页输出?</title>
    <link href="https://gpdf.dev/zh/blog/multi-page-table" />
    <id>https://gpdf.dev/zh/blog/multi-page-table</id>
    <updated>2026-05-12T00:00:00.000Z</updated>
    <published>2026-05-12T00:00:00.000Z</published>
    <summary>什么都不用做。给 gpdf 传一个行数超过一页的表格,它会自动把表体分页,并在每一页顶部重复表头。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>如何在 gpdf 中在同一段落里混用两种字体</title>
    <link href="https://gpdf.dev/zh/blog/mix-two-fonts-in-paragraph" />
    <id>https://gpdf.dev/zh/blog/mix-two-fonts-in-paragraph</id>
    <updated>2026-05-11T00:00:00.000Z</updated>
    <published>2026-05-11T00:00:00.000Z</published>
    <summary>在 gpdf 中要在一个段落里混用多种字体，用 c.RichText 并给每个 span 设置 template.FontFamily。c.Text 只能给整个字符串套一种字体。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="cjk" />
  </entry>
  <entry>
    <title>Go PDF 表格：列宽、斑马纹、分页头</title>
    <link href="https://gpdf.dev/zh/blog/tables-in-go-pdfs" />
    <id>https://gpdf.dev/zh/blog/tables-in-go-pdfs</id>
    <updated>2026-05-07T00:00:00.000Z</updated>
    <published>2026-05-07T00:00:00.000Z</published>
    <summary>Go 里画 PDF 表格容易翻车。gpdf 把列宽、斑马纹、跨页表头重复压缩到一次 Table 调用。完整 API 与权衡。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="tutorial" />
    <category term="templates" />
    <category term="comparison" />
  </entry>
  <entry>
    <title>从 signintech/gopdf 迁移到 gpdf：少写坐标计算</title>
    <link href="https://gpdf.dev/zh/blog/signintech-gopdf-migration" />
    <id>https://gpdf.dev/zh/blog/signintech-gopdf-migration</id>
    <updated>2026-05-06T00:00:00.000Z</updated>
    <published>2026-05-06T00:00:00.000Z</published>
    <summary>signintech/gopdf 能用，但每个单元格、每条线、每个页眉都是 (x, y) 计算。本文逐项映射 gopdf API 到 gpdf — 同样是 Go，不再写坐标。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="migration" />
    <category term="comparison" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>如何在 gpdf 中按比例缩放图片以适配列宽？</title>
    <link href="https://gpdf.dev/zh/blog/scale-image-fit-column" />
    <id>https://gpdf.dev/zh/blog/scale-image-fit-column</id>
    <updated>2026-05-05T00:00:00.000Z</updated>
    <published>2026-05-05T00:00:00.000Z</published>
    <summary>把字节传给 c.Image 即可。gpdf 默认按列宽等比缩放。需要明确尺寸时再用 FitWidth / FitHeight。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>如何在 gpdf 表格中添加斑马条纹行?</title>
    <link href="https://gpdf.dev/zh/blog/zebra-striped-table-rows" />
    <id>https://gpdf.dev/zh/blog/zebra-striped-table-rows</id>
    <updated>2026-05-04T00:00:00.000Z</updated>
    <published>2026-05-04T00:00:00.000Z</published>
    <summary>传入 template.TableStripe 即可,gpdf 会自动给隔行涂上你指定的背景色,不用写循环、也不用逐格设置样式。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>如何在 gpdf 中添加自定义 TrueType 字体？</title>
    <link href="https://gpdf.dev/zh/blog/add-custom-truetype-font" />
    <id>https://gpdf.dev/zh/blog/add-custom-truetype-font</id>
    <updated>2026-04-30T00:00:00.000Z</updated>
    <published>2026-04-30T00:00:00.000Z</published>
    <summary>读取 TTF 字节，用 gpdf.WithFont 注册字族，再按名称引用即可。Inter、Roboto、图标字体、品牌字体都同样适用。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>unipdf 是 AGPL 或付费：迁移到 gpdf 的完整指南</title>
    <link href="https://gpdf.dev/zh/blog/unidoc-migration" />
    <id>https://gpdf.dev/zh/blog/unidoc-migration</id>
    <updated>2026-04-29T00:00:00.000Z</updated>
    <published>2026-04-29T00:00:00.000Z</published>
    <summary>UniDoc 的 unipdf 必须选 AGPL v3 或按开发者收费的商用许可。迁移到 MIT、零依赖、无许可证密钥的 gpdf。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="migration" />
    <category term="comparison" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>把 Bootstrap 思维带进 PDF：gpdf 的 12 栏网格</title>
    <link href="https://gpdf.dev/zh/blog/bootstrap-grid-thinking-for-pdf" />
    <id>https://gpdf.dev/zh/blog/bootstrap-grid-thinking-for-pdf</id>
    <updated>2026-04-29T00:00:00.000Z</updated>
    <published>2026-04-29T00:00:00.000Z</published>
    <summary>gpdf 的 PDF 布局借鉴了 Bootstrap 的 12 栏网格——只保留整数 span 模型，丢弃断点、间距、排序等所有响应式包袱。本文剖析这一设计判断。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="internals" />
    <category term="templates" />
    <category term="comparison" />
  </entry>
  <entry>
    <title>如何在 gpdf 表格中设置列宽？</title>
    <link href="https://gpdf.dev/zh/blog/table-column-widths" />
    <id>https://gpdf.dev/zh/blog/table-column-widths</id>
    <updated>2026-04-28T00:00:00.000Z</updated>
    <published>2026-04-28T00:00:00.000Z</published>
    <summary>在 c.Table 中传入 template.ColumnWidths(...)。值是相对于父 Col 宽度的百分比。合计 100 占满全宽，未传完的尾部列会自动均分剩余空间。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>如何在 gpdf 中嵌入带透明度的 PNG？</title>
    <link href="https://gpdf.dev/zh/blog/embed-png-transparency" />
    <id>https://gpdf.dev/zh/blog/embed-png-transparency</id>
    <updated>2026-04-28T00:00:00.000Z</updated>
    <published>2026-04-28T00:00:00.000Z</published>
    <summary>把 PNG 字节直接传给 c.Image。gpdf 会把 alpha 通道解码成 PDF 的 SMask 对象，透明背景能正确渲染出来。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>如何在 gpdf 中同时使用粗体和斜体</title>
    <link href="https://gpdf.dev/zh/blog/bold-italic-together" />
    <id>https://gpdf.dev/zh/blog/bold-italic-together</id>
    <updated>2026-04-23T00:00:00.000Z</updated>
    <published>2026-04-23T00:00:00.000Z</published>
    <summary>在同一个 span 上传入 template.Bold() 和 template.Italic() 即可。但是 TrueType 字体必须注册全部 4 个变体，否则 BoldItalic 查找会静默回退到基础字体。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>用 Go 生成发票 PDF：50 行以下的完整代码</title>
    <link href="https://gpdf.dev/zh/blog/invoice-pdf-go-under-50-lines" />
    <id>https://gpdf.dev/zh/blog/invoice-pdf-go-under-50-lines</id>
    <updated>2026-04-21T00:00:00.000Z</updated>
    <published>2026-04-21T00:00:00.000Z</published>
    <summary>可运行的完整发票 PDF 生成器，50 行 Go 代码。零依赖，不需要 Chromium，不需要 CGO。gpdf 一个包搞定表头、表格、合计。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>如何在 gpdf 中使用思源黑体 JP（Source Han Sans JP）？</title>
    <link href="https://gpdf.dev/zh/blog/source-han-sans-jp-with-gpdf" />
    <id>https://gpdf.dev/zh/blog/source-han-sans-jp-with-gpdf</id>
    <updated>2026-04-19T00:00:00.000Z</updated>
    <published>2026-04-19T00:00:00.000Z</published>
    <summary>从 Adobe 的 GitHub 发布页下载 TTF 版本的思源黑体 JP，用 gpdf.WithFont 注册。七个字重，SIL OFL，与 Noto Sans JP 同源字形。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="cjk" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>为什么 gpdf 比其他 Go PDF 库快 10–30 倍</title>
    <link href="https://gpdf.dev/zh/blog/why-gpdf-is-faster" />
    <id>https://gpdf.dev/zh/blog/why-gpdf-is-faster</id>
    <updated>2026-04-19T00:00:00.000Z</updated>
    <published>2026-04-19T00:00:00.000Z</published>
    <summary>单页 13 µs，100 页报告 683 µs。不是调参，而是三个架构决策的叠加。本文走一遍代码路径。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="benchmark" />
    <category term="internals" />
    <category term="comparison" />
  </entry>
  <entry>
    <title>为什么 gpdf 生成的 PDF 中日文显示为方块（豆腐字）？</title>
    <link href="https://gpdf.dev/zh/blog/tofu-boxes-japanese" />
    <id>https://gpdf.dev/zh/blog/tofu-boxes-japanese</id>
    <updated>2026-04-17T00:00:00.000Z</updated>
    <published>2026-04-17T00:00:00.000Z</published>
    <summary>日文字符变成空方块（□），通常是字体未注册或族名不匹配。整理 4 种常见原因和最快的修复路径。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="troubleshooting" />
    <category term="cjk" />
  </entry>
  <entry>
    <title>如何在 gpdf 中使用 IPAex 哥特体（IPAex Gothic）？</title>
    <link href="https://gpdf.dev/zh/blog/ipaex-gothic-gpdf" />
    <id>https://gpdf.dev/zh/blog/ipaex-gothic-gpdf</id>
    <updated>2026-04-17T00:00:00.000Z</updated>
    <published>2026-04-17T00:00:00.000Z</published>
    <summary>用 gpdf.WithFont 注册 ipaexg.ttf。IPAex 只提供 Regular 一个字重，粗体需要合成或与 Mincho 配对。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="cjk" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>gpdf 的 12 列网格是怎么工作的？</title>
    <link href="https://gpdf.dev/zh/blog/12-column-grid" />
    <id>https://gpdf.dev/zh/blog/12-column-grid</id>
    <updated>2026-04-16T00:00:00.000Z</updated>
    <published>2026-04-16T00:00:00.000Z</published>
    <summary>gpdf 的 12 列网格用 r.Col(span, fn) 接收 1–12 的整数。列宽为 span/12 的比例，没有断点、没有槽宽间距，为 PDF 固定宽度设计。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="tutorial" />
    <category term="templates" />
  </entry>
  <entry>
    <title>go-pdf/fpdf 也归档了。2026 年的 Go PDF 栈长这样。</title>
    <link href="https://gpdf.dev/zh/blog/go-pdf-fpdf-archived" />
    <id>https://gpdf.dev/zh/blog/go-pdf-fpdf-archived</id>
    <updated>2026-04-16T00:00:00.000Z</updated>
    <published>2026-04-16T00:00:00.000Z</published>
    <summary>jung-kurt/gofpdf 2021 年归档，go-pdf/fpdf 2025 年跟进。2026 年我们实际在用的 Go PDF 栈是 gpdf — 原因、权衡与迁移路径。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="migration" />
    <category term="comparison" />
    <category term="benchmark" />
  </entry>
  <entry>
    <title>用 Go 生成日文 PDF 的 2026 权威指南</title>
    <link href="https://gpdf.dev/zh/blog/japanese-pdf-in-go" />
    <id>https://gpdf.dev/zh/blog/japanese-pdf-in-go</id>
    <updated>2026-04-16T00:00:00.000Z</updated>
    <published>2026-04-16T00:00:00.000Z</published>
    <summary>用 Go 生成日文 PDF 的完整流程。无 CGO、无 Chromium、无豆腐字。涵盖字体、子集化、混合排版、纵排。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="tutorial" />
    <category term="cjk" />
    <category term="troubleshooting" />
  </entry>
  <entry>
    <title>2026 年 Go PDF 库终极对决</title>
    <link href="https://gpdf.dev/zh/blog/go-pdf-library-showdown-2026" />
    <id>https://gpdf.dev/zh/blog/go-pdf-library-showdown-2026</id>
    <updated>2026-04-15T00:00:00.000Z</updated>
    <published>2026-04-15T00:00:00.000Z</published>
    <summary>2026 年仍在维护的 Go PDF 库，在 4 种工作负载上基准测试，并对比许可证、依赖与维护状态。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="comparison" />
    <category term="benchmark" />
  </entry>
  <entry>
    <title>如何在 gpdf 中嵌入日文字体？</title>
    <link href="https://gpdf.dev/zh/blog/embed-japanese-font" />
    <id>https://gpdf.dev/zh/blog/embed-japanese-font</id>
    <updated>2026-04-15T00:00:00.000Z</updated>
    <published>2026-04-15T00:00:00.000Z</published>
    <summary>将 TTF 字节传给 gpdf.WithFont 即可。自动子集化嵌入、无需 CGO，用 Go 生成日文 PDF 的最短路径。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="cjk" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>如何在 gpdf 中使用 Noto Sans JP？</title>
    <link href="https://gpdf.dev/zh/blog/noto-sans-jp-with-gpdf" />
    <id>https://gpdf.dev/zh/blog/noto-sans-jp-with-gpdf</id>
    <updated>2026-04-15T00:00:00.000Z</updated>
    <published>2026-04-15T00:00:00.000Z</published>
    <summary>用 gpdf.WithFont 注册 static 版 NotoSansJP-Regular.ttf，不要用 variable font。gpdf 会把 17,000 个字形子集化到每份 PDF 不到 40 KB。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="recipe" />
    <category term="cjk" />
    <category term="tutorial" />
  </entry>
  <entry>
    <title>gofpdf 已归档：迁移到 gpdf 的完整指南</title>
    <link href="https://gpdf.dev/zh/blog/gofpdf-migration" />
    <id>https://gpdf.dev/zh/blog/gofpdf-migration</id>
    <updated>2026-04-14T00:00:00.000Z</updated>
    <published>2026-04-14T00:00:00.000Z</published>
    <summary>gofpdf 于 2021 年归档，后继 go-pdf/fpdf 也在 2025 年停止。纯 Go、零依赖、原生 CJK 的 gpdf 迁移指南。</summary>
    <author>
      <name>Taiki Noda</name>
      <uri>https://nadai.dev/en/about</uri>
    </author>
    <category term="migration" />
    <category term="comparison" />
    <category term="tutorial" />
    <category term="cjk" />
  </entry>
</feed>
