Add the Neutral template family, template picker and text-only logo allowances

Linea (the vendor's original format.pdf design), Monogram and Serenity are
rebuilt from the reference PDFs as one parametric family on the engine, with
the user's logo in the measured slot, a home for every GST field and
A4/Letter support. Adds static Montserrat, Open Sans and Poppins fonts and
a generated Ms Madi outline for Serenity's vertical word. Text-only logo
placeholders (Monolith, Tangerine) use a doc-derived allowance box. A
Carbon TemplatePicker with committed thumbnails opens from the page
setup controls.
This commit is contained in:
2026-10-04 07:27:12 +05:30
parent eddf27629f
commit aa7a407944
61 changed files with 3278 additions and 110 deletions
+16
View File
@@ -145,3 +145,19 @@ Page is 595.5x842.25 (A4). Same grid as Linea: rules x 69.64-525.86; text column
- 'RATE' instead of 'UNIT PRICE', and a bold SUBTOTAL.
- **Not similar to the current in-app template** beyond normal invoice structure.
- **Shares its type system with 6.pdf:** Open Sans sizes and weights, 1pt tracking, Medium address lines.
## Implementation notes
Built on the shared Neutral family (`src/pdf/templates/neutral/`, tokens in `monogram.ts`). Measured against `5.pdf` with `npm run templates:compare` (`/tmp/invoice-c3/compare-monogram.png`).
**Matches the design (measured, A4):** title baseline 144.0 pt (reference 143.98) and x 69.6 (flush with the rule start, 69.3 in reference); ISSUED TO and INVOICE NO baselines 325.4 pt and meta pitch 15 pt; header baseline to first row 36.3 pt; label and value widths agree to 0.1 pt (Open Sans at 0.10 em tracking); rules x 69.6-525.6; ink #3D3B3A only.
**Intentional deviations, and why:**
- **Data text is tracked 0.05 em, not 0.10 em.** Wider tracking makes PDF text extraction split words, so the table body, address lines and values use 0.05 em (layout rule 7). Titles, labels and table heads keep 0.10 em. Body lines are therefore a little narrower than the reference design's.
- **Logo, not the ring.** The user's logo goes in the measured slot (up to 142.75 x 116.5 pt, right edge on the margin, vertically centred on the old ring centre). A wordmark such as The sample vendor's comes out about 100 x 22 pt because the weight factor matches the visual weight of the ring (ink density 0.14). Without a logo the vendor's initials are set in Open Sans Bold 46 pt in the same slot, with no ring and no caption; a vendor name is always printed as text in the supplier block.
- **Supplier block (FROM)** is right-aligned under the logo (max 240 pt), as the doc suggests, and may push the info row down.
- **Margins.** Left and right 69.64 pt (the rule edge, text 7.8 pt inside), top 58, bottom 60 plus a 16 pt footer reserve. The logo may not overshoot the rule end by the reference design's 5 pt (the audit keeps flowing content inside the margin box); it sits 4.6 pt further left.
- **Payment block** sits in the bottom row with the signature, bottoms aligned; it grows with IFSC, Branch and Account Name, and the user's signature image replaces the script name (name and designation without one). 'Payment info:' keeps the design's label.
- **Totals** as Linea, except SUBTOTAL, TOTAL and the labels are bold and the rows 18.6 pt apart; the right column shows tax amounts (`CGST @ 9%`), not a rate.
- **Table.** RATE is shown as in Linea (amount plus short unit), HSN/SAC is a column when present.
- **Letter:** the band above the logo shrinks (23.25 to 8 pt after the 58 pt margin) and the header-to-info and info-to-table gaps take the rest; type is untouched.