From 523bc89c3a919c0db234149dedb422c69f0cffa5 Mon Sep 17 00:00:00 2001 From: Wada Yusuke Date: Mon, 29 Jun 2026 14:36:40 +0900 Subject: [PATCH] =?UTF-8?q?fix(resume):=20PDF=E3=81=AE=E3=83=97=E3=83=AD?= =?UTF-8?q?=E3=82=B8=E3=82=A7=E3=82=AF=E3=83=88=E8=A6=8B=E5=87=BA=E3=81=97?= =?UTF-8?q?=E3=81=8C=E3=83=9A=E3=83=BC=E3=82=B8=E8=B7=A8=E3=81=8E=E3=81=A7?= =?UTF-8?q?=E7=B9=B0=E3=82=8A=E8=BF=94=E3=81=99=E3=81=AE=E3=82=92=E8=A7=A3?= =?UTF-8?q?=E6=B6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 経歴書PDFでプロジェクトの詳細がページを跨ぐと、WeasyPrintが thead を各ページ先頭で繰り返し、見出し(期間/役割/体制/工程・ スキルセット)が毎ページ表示されていた。見出し行を thead から tbody の先頭行へ移し、見出しは1回のみ表示・詳細はページ境界で 見切れる挙動にする。 Co-Authored-By: Claude Opus 4.8 --- backend/app/services/pdf/generators/resume_generator.py | 9 ++++++--- backend/app/services/pdf/templates/resume.css | 3 ++- backend/tests/test_pdf_generator.py | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/backend/app/services/pdf/generators/resume_generator.py b/backend/app/services/pdf/generators/resume_generator.py index 20500efa..4e967b67 100644 --- a/backend/app/services/pdf/generators/resume_generator.py +++ b/backend/app/services/pdf/generators/resume_generator.py @@ -166,12 +166,15 @@ def _build_project_html(project, fp: str) -> str: # 体制は表のカラムではなく役割行に併記する(line2 で処理済み)。 # 左列見出しに構造化情報(info_header)を入れ、独立ヘッダーは廃止した。 + # 見出し行は thead ではなく tbody の先頭行に置く。thead だと WeasyPrint が + # ページ跨ぎ時に各ページ先頭で見出しを繰り返してしまうため、tbody 内の通常行に + # することで見出しは 1 回だけ表示し、長い詳細はページ境界で見切れる挙動にする。 return ( f'
' f'' - f'' - f"" - f'' + f'' + f"" + f'' f'' f"
{info_header}スキルセット
{left_content}
{info_header}スキルセット
{left_content}{right_content}
" ) diff --git a/backend/app/services/pdf/templates/resume.css b/backend/app/services/pdf/templates/resume.css index b2275d92..82bbf891 100644 --- a/backend/app/services/pdf/templates/resume.css +++ b/backend/app/services/pdf/templates/resume.css @@ -127,7 +127,8 @@ h2 { /* 案件が残りスペースに収まらない時に丸ごと次ページへ送られると、 枠付き company 内に大きな余白が残る。ページを詰めるため分割を許可する (長い案件はページ境界で割れるが、余白を残すより詰めることを優先)。 - 分割時の列見出しは project-table の thead で繰り返す。 */ + 見出し行は tbody の通常行に置いており、ページ跨ぎ時に繰り返さない + (詳細はページ境界で見切れる)。 */ } .project-table { diff --git a/backend/tests/test_pdf_generator.py b/backend/tests/test_pdf_generator.py index a2e5e4e9..26971e1d 100644 --- a/backend/tests/test_pdf_generator.py +++ b/backend/tests/test_pdf_generator.py @@ -180,6 +180,9 @@ def test_project_structured_info_in_header_cell() -> None: # 構造化情報は左列見出しセル(th.proj-info)に入る assert 'class="proj-info"' in html + # 見出し行は thead に置かない(thead だと WeasyPrint がページ跨ぎ時に + # 各ページ先頭で見出しを繰り返すため)。tbody の通常行に置く。 + assert "" not in html # 旧来の独立ヘッダーと「業務内容」ラベルは廃止 assert "project-header" not in html assert "業務内容" not in html