The Chapter 4 claim — with text, AI, and a tiny script, you can produce work that competes with specialized design tools — demonstrated on the smallest print item there is: a business card.
Which chapter claim this maps to
You don't need to open Word, Illustrator, or a dedicated design app to produce print-ready output from a text source. With AI in the loop, even layout tweaks become natural-language conversations.
Business cards are the most dimensionally demanding print item (91 × 55mm at 9pt body text). If it works here, larger items (flyers, postcards, envelope-printing) work in the same framework.
What this does
A single card-data.json produces the same PDF via two paths:
card-data.json (name, title, contact)
│
┌──────┴──────┐
▼ ▼
business_card.py business-card{.html,.css}
(ReportLab) (HTML + Print CSS)
│ │
▼ ▼
91×55mm 1-up PDF Open in browser → Ctrl+P → Save as PDF
A4 10-up tile PDF (or WeasyPrint for automation)
| Path | Output |
|---|---|
| A. Python (ReportLab) | out/business-card-python.pdf (1 card) + out/business-card-sheet-python.pdf (A4, 10-up) |
| B. HTML + CSS | out/business-card-html.pdf (1 card) + out/business-card-sheet-html.pdf (A4, 10-up) |
make all produces all four.
Why two paths
- A (Python): scale use cases — generate 100 cards for a team in one go, pull data from a database, fully automate. Code is around 100 lines.
- B (HTML): visible immediately in a browser, easy CSS tweaking, accessible to designers who don't program. In production the browser's "Save as PDF" closes the loop (WeasyPrint just automates that step).
Both paths produce identical PDFs at identical dimensions — that is the methodology's core (Chapter 4, "Building business material that keeps its structure").
Layout
example-3/
├── README.md / README.en.md Documentation
├── card-data.json Shared data (name, title, contact)
├── business_card.py Path A: ReportLab → PDF
├── business-card.html Path B: 1 card, HTML
├── business-card.css same, Print CSS
├── business-card-sheet.html A4 10-up, HTML
├── business-card-sheet.css same, Print CSS
├── Makefile make all → run both paths
├── results.md Measurements
└── out/ Generated PDFs (committed)
├── business-card-python.pdf
├── business-card-sheet-python.pdf
├── business-card-html.pdf
└── business-card-sheet-html.pdf
Setup
pip install reportlab weasyprint
# Optional, for Linux Japanese font fallback
sudo apt install fonts-noto-cjk
ReportLab uses its bundled CID fonts (HeiseiKakuGo-W5 / HeiseiMin-W3) so no external font file is needed for Japanese. The HTML + CSS side falls back to system "Mincho" / "Sans" (Mac: Hiragino, Windows: Yu, Linux: Noto CJK).
Usage
make all # all four PDFs + size measurements
make python # path A only
make html # path B only
make clean # wipe out/
Design
- Name (Japanese, Mincho 14pt) — the dominant element
- Name (English, Sans 9pt, gray) — romanized
- Title (JA · EN, Sans 9pt, accent
#c8442a) — aiseed.dev's accent color - Thin accent rule — separates upper/lower
- email / URL (Sans 9pt) — contact
Tagline / job-role wording in the title slot matches aiseed.dev's
"free person of the AI era / builder" terminology. To change the
design, edit color constants in business_card.py or the relevant
CSS variables in business-card.css.
Extensions
- 100 cards at once: switch
card-data.jsontocard-data.csvand loop in Python — one PDF, many cards (Chapter 4, "structure-preserving document assembly"). - Two-sided card: extend
make_single()to emit two pages; put a QR code on the back viapip install qrcode. - Press-ready: add 3mm bleed to make it 97 × 61mm and draw crop marks. Same Python file, more constants.
- Multiple locales: keep
card-data-ja.json/card-data-en.jsonand pass the file as an argument.
All of these stay in the same framework. No commercial business-card service, no Illustrator session, no Word merge field.
実測値
環境
- OS: Linux 6.18.5 (x86_64)
- Python: 3.11.15
- reportlab: 4.5.1
- weasyprint: 68.1
生成物の寸法 (pypdf で検証)
| ファイル | ページ | 寸法 (pt) | 寸法 (mm) |
|---|---|---|---|
out/business-card-python.pdf |
1 | 258.0 × 155.9 | 91.0 × 55.0 (日本標準名刺) |
out/business-card-html.pdf |
1 | 258.0 × 155.9 | 91.0 × 55.0 (日本標準名刺) |
out/business-card-sheet-python.pdf |
1 | 595.3 × 841.9 | 210.0 × 297.0 (A4 横) |
out/business-card-sheet-html.pdf |
1 | 595.3 × 841.9 | 210.0 × 297.0 (A4 横) |
両経路で寸法が完全一致 ── 同じ印刷物が、Python からも HTML からも出る。
ファイルサイズ
| ファイル | サイズ |
|---|---|
out/business-card-python.pdf |
4,077 bytes (4.0 KiB) |
out/business-card-sheet-python.pdf |
4,646 bytes (4.5 KiB) |
out/business-card-html.pdf |
9,476 bytes (9.3 KiB) |
out/business-card-sheet-html.pdf |
10,819 bytes (10.6 KiB) |
ReportLab 版が約 2 倍軽い。これは ReportLab が CID フォントで日本語を扱い、 PDF 内部にグリフを埋め込まないため。WeasyPrint は (使用したグリフだけだが) フォントを PDF に埋め込むため少し重くなる。
入稿サービスに渡す場合は HTML 経路 (フォント埋め込み) の方が確実 (印刷側のフォント環境に依存しない)。社内で配るだけなら Python 経路 (軽い) で十分。
生成時間 (参考)
$ time make all
それぞれの所要時間は環境による (ホスト性能・初回フォントキャッシュ等) が、 両経路とも 1 秒未満〜数秒 で完了する。Illustrator を起動して 1 枚作る 時間 (数分) と比較するとほぼ瞬時。
デザインの精度確認
両 PDF を Acrobat / Preview / Evince で開いて目視確認:
- 氏名 (明朝 14pt) ── 鮮明
- 肩書 (朱色
#c8442a) ── 色が正しく出ている - 朱色罫線 ── 0.6pt の細線が出ている
- 連絡先 (Helvetica 9pt) ── 鮮明
WeasyPrint 版でシステムフォントが見つからない場合、フォールバックで DejaVu / Liberation 系になることがあるが、Noto CJK が入っている環境では 意図通りの明朝・ゴシックで描画される。
印刷との関係
- 家庭用プリンタ + A4 普通紙:
business-card-sheet-*.pdfを A4 で 印刷 → カッターで切る。10 枚で約 30 秒。 - 市販の名刺用紙 (Elecom MT-JM 等): 同上、上下マージン 11mm / 左右マージン 14mm が一致するように設計してある。
- 入稿 (印刷会社):
business-card-{python,html}.pdf(1 枚版) を そのまま渡せる場合が多い。ドブ (塗り足し) や CMYK 要件は印刷会社の 仕様に合わせて Python 側で再生成すれば良い。