Chapter 4 · Example 3

A business card, two ways

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

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

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

All of these stay in the same framework. No commercial business-card service, no Illustrator session, no Word merge field.


実測値

環境

生成物の寸法 (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 で開いて目視確認:

WeasyPrint 版でシステムフォントが見つからない場合、フォールバックで DejaVu / Liberation 系になることがあるが、Noto CJK が入っている環境では 意図通りの明朝・ゴシックで描画される。

印刷との関係

Files

out/

Back to Chapter 4: Designing — With Mermaid and Claude Design