Add Ledger and Band template families with decor primitives
Crimson Grid, Tangerine Ledger, Slate Band and Teal Swoosh are rebuilt from the reference PDFs with grid and band tables that survive page breaks, full-bleed fixed bands, pennant tabs, gradient corner swooshes with keep-outs, Carbon icon circles, and the user's logo in the measured slot (knockout or white chip on the dark Slate band). Adds static Poppins 500-700 and Inter fonts. Thumbnails regenerated for all eight templates; the item-count sweeps run in their own test file.
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
// Side-by-side review of the Neutral templates: the reference original (left) against our render (right), plus
|
||||
// the multi-page, Letter and long-text samples. Run: npm run templates:compare [-- linea monogram serenity]
|
||||
// Output: /tmp/invoice-c3/. With --numbers it also prints text baselines (reference vs ours) for tuning.
|
||||
// Side-by-side review of the reference-based templates: the reference original (left) against our render (right), plus
|
||||
// the multi-page, Letter, long-text and logo-variant samples. Run: npm run templates:compare [-- crimson-grid slate-band]
|
||||
// Output: /tmp/invoice-c4/ (override with --out=DIR). With --numbers it also prints text baselines (reference vs ours) for tuning.
|
||||
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { CANVA_DIR, loadCanvas, loadRenderer, rasterize, textItems } from "./lib.mjs";
|
||||
|
||||
const OUT = "/tmp/invoice-c3";
|
||||
const argv = process.argv.slice(2);
|
||||
const OUT = argv.find((a) => a.startsWith("--out="))?.slice(6) ?? "/tmp/invoice-c4";
|
||||
const SCALE = 1.6;
|
||||
const PDF_NO = { marble: 1, highlighter: 2, monolith: 3, linea: 4, monogram: 5, serenity: 6 };
|
||||
const PDF_NO = { marble: 1, highlighter: 2, monolith: 3, linea: 4, monogram: 5, serenity: 6, "crimson-grid": 7, "cobalt-stripe": 8, "slate-band": 9, "teal-swoosh": 10, "tangerine-ledger": 11, "purple-pop": 12, "citrus-split": 13 };
|
||||
const ROWS = { linea: 7, "crimson-grid": 3, "tangerine-ledger": 3, "slate-band": 5, "teal-swoosh": 5 };
|
||||
const DARK = ["slate-band"];
|
||||
const args = process.argv.slice(2);
|
||||
const numbers = args.includes("--numbers");
|
||||
const ids = args.filter((a) => !a.startsWith("--"));
|
||||
const targets = ids.length ? ids : ["linea", "monogram", "serenity"];
|
||||
const targets = ids.length ? ids : ["crimson-grid", "tangerine-ledger", "slate-band", "teal-swoosh"];
|
||||
|
||||
const LONG = "Unit 4, Third Floor, The Grand Heritage Business Centre, Plot 1187-B, Old Airport Road Extension, Opposite the Municipal Corporation Ward Office, Domlur Second Stage, Bengaluru Urban District, Karnataka State, India - 560071; Registered office: Level 12, Tower C, Global Technology Park, Outer Ring Road, Marathahalli, Bengaluru - 560103";
|
||||
const TOKEN = "Supercalifragilisticexpialidocious-Pneumonoultramicroscopic-1234567890";
|
||||
@@ -36,7 +39,7 @@ async function main() {
|
||||
const no = PDF_NO[id];
|
||||
const canvaBytes = readFileSync(path.join(CANVA_DIR, `${no}.pdf`));
|
||||
const reference = await rasterize(canvaBytes, 1, SCALE);
|
||||
const rows = id === "linea" ? 7 : 5;
|
||||
const rows = ROWS[id] ?? 5;
|
||||
const NAMES = ["Brand consultation", "Logo design", "Website design", "Social media templates", "Brand photography", "Brand guide", "Social media templates"];
|
||||
// Short one-line descriptions like the reference sample, so positions can be compared row by row.
|
||||
const items = (hsn) => NAMES.slice(0, rows).map((description, i) => ({ id: i + 1, description, mode: "rate", rate: 100, unit: "hour", quantity: 1, amount: 0, sortOrder: i, ...(hsn ? { hsnSac: "998397" } : {}) }));
|
||||
@@ -63,7 +66,9 @@ async function main() {
|
||||
const shown = await r.renderFixture(sample({ logo: "real" }), r.prefsFor("A4", { templateId: id, logo: { show: true } }));
|
||||
writeFileSync(path.join(OUT, `${id}-A4-logo-optin.png`), (await rasterize(shown.result.bytes, 1, SCALE)).toBuffer("image/png"));
|
||||
}
|
||||
for (const logo of ["square", "wide"]) {
|
||||
// Dark-surface templates: the white knockout variant (a logo with alpha) next to the chip fallback (no alpha) above.
|
||||
const logoKinds = DARK.includes(id) ? ["square", "wide", "knockout"] : ["square", "wide"];
|
||||
for (const logo of logoKinds) {
|
||||
const x = await render(sample({ logo }));
|
||||
writeFileSync(path.join(OUT, `${id}-A4-logo-${logo}.png`), (await rasterize(x.result.bytes, 1, SCALE)).toBuffer("image/png"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user