From 82690d8e5c89fe93f19dec34085371c2a1bb0306 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:02:34 +0000 Subject: [PATCH 1/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/integrations/supabase/types.ts | 3 +++ .../20260418030231_97cce1e8-ac07-42ff-93c7-84ae134b2c24.sql | 1 + 2 files changed, 4 insertions(+) create mode 100644 supabase/migrations/20260418030231_97cce1e8-ac07-42ff-93c7-84ae134b2c24.sql diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 5c939ec..ac52c0e 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -961,6 +961,7 @@ export type Database = { hide_title: boolean id: string line_height: number + margin_inches: number name: string signature_blocks: Json title: string @@ -977,6 +978,7 @@ export type Database = { hide_title?: boolean id?: string line_height?: number + margin_inches?: number name: string signature_blocks?: Json title?: string @@ -993,6 +995,7 @@ export type Database = { hide_title?: boolean id?: string line_height?: number + margin_inches?: number name?: string signature_blocks?: Json title?: string diff --git a/supabase/migrations/20260418030231_97cce1e8-ac07-42ff-93c7-84ae134b2c24.sql b/supabase/migrations/20260418030231_97cce1e8-ac07-42ff-93c7-84ae134b2c24.sql new file mode 100644 index 0000000..ea777bc --- /dev/null +++ b/supabase/migrations/20260418030231_97cce1e8-ac07-42ff-93c7-84ae134b2c24.sql @@ -0,0 +1 @@ +ALTER TABLE public.custom_form_templates ADD COLUMN IF NOT EXISTS margin_inches numeric NOT NULL DEFAULT 1.0; \ No newline at end of file From b609d63935e23c175ad07b9117d4641e638e9b66 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:02:46 +0000 Subject: [PATCH 2/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 31c5492..250f443 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -201,6 +201,7 @@ interface SavedTemplate { font_family: string; font_size_pt: number; line_height: number; + margin_inches?: number; signature_blocks: Array<{ name: string; title?: string }>; fields: FormFieldDef[]; updated_at: string; @@ -215,6 +216,15 @@ const LINE_HEIGHTS = [ { value: 2.0, label: "2.0" }, ]; +const MARGIN_OPTIONS = [ + { value: 0.5, label: '0.5"' }, + { value: 0.75, label: '0.75"' }, + { value: 1.0, label: '1"' }, + { value: 1.25, label: '1.25"' }, + { value: 1.5, label: '1.5"' }, + { value: 2.0, label: '2"' }, +]; + export function CustomFormBuilder() { const [title, setTitle] = useState("Official Notice"); const [hideTitle, setHideTitle] = useState(false); From 807d442108ac5ea6fdb4a4a6fa21b2a319f08d23 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:02:53 +0000 Subject: [PATCH 3/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 250f443..b686dce 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -238,6 +238,7 @@ export function CustomFormBuilder() { const [fontFamily, setFontFamily] = useState("Bookman Old Style"); const [fontSize, setFontSize] = useState(12); const [lineHeight, setLineHeight] = useState(1.5); + const [marginInches, setMarginInches] = useState(1.0); // Template management const [templates, setTemplates] = useState([]); From 95bc4bc5b7d135b864f0be64397fcb27cc7fa6c1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:05 +0000 Subject: [PATCH 4/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index b686dce..7342044 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -300,14 +300,16 @@ export function CustomFormBuilder() { setTemplates((data ?? []) as unknown as SavedTemplate[]); }; - // Apply font style + line height to editor DOM + // Apply font style + line height + page margin to editor DOM useEffect(() => { if (!editor) return; const el = editor.view.dom as HTMLElement; el.style.fontFamily = `"${fontFamily}", Georgia, serif`; el.style.fontSize = `${fontSize}pt`; el.style.lineHeight = String(lineHeight); - }, [editor, fontFamily, fontSize, lineHeight]); + const padPx = Math.round(marginInches * 96); + el.style.padding = `${padPx}px`; + }, [editor, fontFamily, fontSize, lineHeight, marginInches]); const insertVar = (key: string) => { if (!editor) return; From 8473cc281094fcce93b136410dc5cb14048a1f36 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:14 +0000 Subject: [PATCH 5/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 7342044..b787507 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -533,11 +533,11 @@ export function CustomFormBuilder() { const ctx = await getContext(); const segments = getRenderedSegments(); const doc = new jsPDF({ unit: "pt", format: "letter" }); - const margin = 54; + const margin = Math.round(marginInches * 72); const pageW = doc.internal.pageSize.getWidth(); const pageH = doc.internal.pageSize.getHeight(); const maxW = pageW - margin * 2; - let y = 80; + let y = margin + 26; const fontDef = FONT_FAMILIES.find((f) => f.value === fontFamily); const pdfFont = fontDef?.pdf ?? "times"; From 2c6856aea8126970dc766aaf858642f84eb68631 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:22 +0000 Subject: [PATCH 6/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index b787507..72674f8 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -874,7 +874,7 @@ export function CustomFormBuilder() { properties: { page: { size: { width: 12240, height: 15840 }, - margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 }, + margin: (() => { const m = Math.round(marginInches * 1440); return { top: m, right: m, bottom: m, left: m }; })(), }, }, children, From 60217a933a71c598ee9fc4d56a40b672165319c4 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:28 +0000 Subject: [PATCH 7/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 72674f8..143924a 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -929,6 +929,7 @@ export function CustomFormBuilder() { font_family: fontFamily, font_size_pt: fontSize, line_height: lineHeight, + margin_inches: marginInches, signature_blocks: [], fields: formFields as any, }; From 496b1a5e67a6ec59ff0f8a3770a850dd01448b82 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:37 +0000 Subject: [PATCH 8/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 143924a..77ff82c 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -968,6 +968,7 @@ export function CustomFormBuilder() { setFontFamily(t.font_family); setFontSize(t.font_size_pt); if (typeof t.line_height === "number" && t.line_height > 0) setLineHeight(t.line_height); + if (typeof t.margin_inches === "number" && t.margin_inches > 0) setMarginInches(t.margin_inches); editor.commands.setContent(t.body_html || "

"); const loadedFields = Array.isArray(t.fields) ? t.fields : []; setFormFields(loadedFields); From 10baa2c183d12c6d2f263b6c3bbf0c0f8b180740 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 03:03:47 +0000 Subject: [PATCH 9/9] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 77ff82c..af80017 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -1108,6 +1108,17 @@ export function CustomFormBuilder() { +
+ + +