diff --git a/src/components/forms/estoppel-form.tsx b/src/components/forms/estoppel-form.tsx index 59d719e..7061c6b 100644 --- a/src/components/forms/estoppel-form.tsx +++ b/src/components/forms/estoppel-form.tsx @@ -109,22 +109,26 @@ export function EstoppelForm() { ); const handleExport = () => { - if (!client) { + if (!client || !template) { toast.error("Select a client first"); return; } + const font = (template.font ?? "helvetica") as "helvetica" | "times" | "courier"; + const fontSize = template.fontSizePt ?? 10; + const titleSize = template.titleFontSizePt ?? 16; + const margin = template.marginPt ?? 54; + const doc = new jsPDF({ unit: "pt", format: "letter" }); const pageW = doc.internal.pageSize.getWidth(); - const margin = 54; let y = 60; // Header - doc.setFont("helvetica", "bold"); - doc.setFontSize(16); - doc.text("ESTOPPEL CERTIFICATE", margin, y); - y += 22; - doc.setFont("helvetica", "normal"); - doc.setFontSize(10); + doc.setFont(font, "bold"); + doc.setFontSize(titleSize); + doc.text(template.title || "ESTOPPEL CERTIFICATE", margin, y); + y += titleSize + 6; + doc.setFont(font, "normal"); + doc.setFontSize(fontSize); doc.text(client.name, margin, y); y += 12; if (firm?.company_name) {