diff --git a/src/report/pdf.py b/src/report/pdf.py index a02724b..ebd916e 100644 --- a/src/report/pdf.py +++ b/src/report/pdf.py @@ -262,13 +262,18 @@ def generate_pdf(data: dict) -> str: story.append(Spacer(1, 6)) if recalls: - r_rows = [["#", "Campaña", "Componente", "Descripción breve"]] + P = lambda txt, bold=False: Paragraph( + str(txt), + ParagraphStyle("rc", fontSize=7, fontName="Helvetica-Bold" if bold else "Helvetica", + textColor=NAVY2, leading=9, wordWrap="LTR"), + ) + r_rows = [[P("#", True), P("Campaña", True), P("Componente", True), P("Descripción breve", True)]] for i, r in enumerate(recalls[:20], 1): - comp = (r.get("Component") or r.get("component") or "—")[:35] - summary = (r.get("Summary") or r.get("summary") or "—")[:80] + comp = (r.get("Component") or r.get("component") or "—")[:120] + summary = (r.get("Summary") or r.get("summary") or "—")[:300] campaign = r.get("NHTSACampaignNumber") or r.get("campaignNumber") or "—" - r_rows.append([str(i), campaign, comp, summary]) - story.append(_table(r_rows, [0.3*inch, 1.1*inch, 1.8*inch, W-3.2*inch])) + r_rows.append([P(i), P(campaign), P(comp), P(summary)]) + story.append(_table(r_rows, [0.25*inch, 1.0*inch, 1.9*inch, W-3.15*inch])) # ── Complaints ──────────────────────────────────────────────────────────── story += _section("4 — QUEJAS DE PROPIETARIOS") @@ -291,13 +296,17 @@ def generate_pdf(data: dict) -> str: story += _section("5 — INVESTIGACIONES DE SEGURIDAD") if invests: - inv_rows = [["Número", "Asunto", "Estado"]] + PI = lambda txt, bold=False: Paragraph( + str(txt), + ParagraphStyle("iv", fontSize=7, fontName="Helvetica-Bold" if bold else "Helvetica", + textColor=NAVY2, leading=9, wordWrap="LTR"), + ) + inv_rows = [[PI("Número", True), PI("Asunto", True), PI("Estado", True)]] for inv in invests[:10]: - num = inv.get("InvestigationNumber") or inv.get("investigationNumber") or "—" - subj = (inv.get("Subject") or inv.get("subject") or "—")[:60] + num = inv.get("InvestigationNumber") or inv.get("investigationNumber") or "—" + subj = (inv.get("Subject") or inv.get("subject") or "—")[:200] closed = inv.get("ClosingDate") or inv.get("closingDate") - status = "Cerrada" if closed else "Abierta" - inv_rows.append([num, subj, status]) + inv_rows.append([PI(num), PI(subj), PI("Cerrada" if closed else "Abierta")]) story.append(_table(inv_rows, [1.2*inch, W-2.4*inch, 1.2*inch])) else: story.append(Paragraph("Sin investigaciones activas.", STYLE_BODY))