fix(BUG-006,007,008): copy feedback, invoice data unwrap, zero margins
BUG-007: Unwrap req.body.data for template endpoint (docs show wrapped format) BUG-008: Default PDF margins set to 0 (user can override via request body) BUG-006: Copy button shows Copied! for 2s then reverts
This commit is contained in:
parent
2638f6638c
commit
6891e488b6
4 changed files with 27 additions and 17 deletions
|
|
@ -25,7 +25,7 @@ templatesRouter.post("/:id/render", async (req: Request, res: Response) => {
|
|||
return;
|
||||
}
|
||||
|
||||
const data = req.body;
|
||||
const data = req.body.data || req.body;
|
||||
const html = renderTemplate(id, data);
|
||||
const pdf = await renderPdf(html, {
|
||||
format: data._format || "A4",
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ export async function renderPdf(
|
|||
landscape: options.landscape || false,
|
||||
printBackground: options.printBackground !== false,
|
||||
margin: options.margin || {
|
||||
top: "20mm",
|
||||
right: "15mm",
|
||||
bottom: "20mm",
|
||||
left: "15mm",
|
||||
top: "0",
|
||||
right: "0",
|
||||
bottom: "0",
|
||||
left: "0",
|
||||
},
|
||||
headerTemplate: options.headerTemplate,
|
||||
footerTemplate: options.footerTemplate,
|
||||
|
|
@ -79,10 +79,10 @@ export async function renderUrlPdf(
|
|||
landscape: options.landscape || false,
|
||||
printBackground: options.printBackground !== false,
|
||||
margin: options.margin || {
|
||||
top: "20mm",
|
||||
right: "15mm",
|
||||
bottom: "20mm",
|
||||
left: "15mm",
|
||||
top: "0",
|
||||
right: "0",
|
||||
bottom: "0",
|
||||
left: "0",
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue