feat(issued-orders-pdf): true per-page footer (Vystavil + Strana X z Y), sections flow inline

The PDF now carries a real repeating footer on EVERY page via Puppeteer's footerTemplate (Chromium has no CSS margin-box support, so this is the only true footer): 'Vystavil: <logged-in user>' on the left, 'Strana X z Y' / 'Page X of Y' centered, localized by the document language. htmlToPdf gained an optional footerTemplate option (empty header suppresses Chromium's default; bottom margin grows to 18mm). The old body footer pinned by flex min-height is gone. The 'Obsah' sections no longer start a new page with a repeated header - they flow inline right after the items/totals block and paginate naturally (break-inside: avoid per section). Applied at all three render sites (PDF route, ?save=1 archive, /file fallback).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
BOHA
2026-06-10 17:44:11 +02:00
parent 75dc97516e
commit 268a947c85
4 changed files with 129 additions and 79 deletions

View File

@@ -18,7 +18,10 @@ import {
deleteIssuedOrder,
getNextIssuedOrderNumberPreview,
} from "../../services/issued-orders.service";
import { renderIssuedOrderHtml } from "./issued-orders-pdf";
import {
renderIssuedOrderHtml,
buildIssuedOrderPdfFooter,
} from "./issued-orders-pdf";
import { htmlToPdf } from "../../utils/html-to-pdf";
import { nasOrdersManager } from "../../services/nas-financials-manager";
import { contentDisposition } from "../../utils/content-disposition";
@@ -306,7 +309,9 @@ export default async function issuedOrdersRoutes(fastify: FastifyInstance) {
issuer,
sections,
);
const pdf = await htmlToPdf(html);
const pdf = await htmlToPdf(html, {
footerTemplate: buildIssuedOrderPdfFooter(lang, issuer.name),
});
if (nasOrdersManager.isConfigured()) {
const baseDate = order.order_date