[208] Wettbewerbs-Abgabe: Bilder auf Layout-Blättern, Plakat-Vorlagen A0/A1, anonyme Abgabe, Satz „WBW-Abgabe“

- Bild-Element im Layout (Layout.images, Data-URL wie ContextImage): Kern layout_image.rs (Dateikopf, Seitenverhältnis,
  Zuschnitt, dpi), Blatt mit Knopf, Verschieben, Skalieren, HUD; PDF bettet das Original ein (JPEG ohne Neukompression).
- Rendering-Dialog: „Ins Layout einsetzen“.
- Plakat-Vorlagen A0/A1 hoch/quer (Master mit Raster-Hilfslinien, Kopfzeile mit Kennwort-Feld und Plan x/n, Massstab je
  Viewport; Kern layout_poster.rs), wählbar in „Neues Layout“.
- Project.competition: anonym + Kennwort; Plankopf, PDF-Info (Producer/Datum neutralisiert) und Dateinamen nur mit Kennwort.
- Publikationssatz „WBW-Abgabe“ mit allen Plakaten.
This commit is contained in:
Claude committed 2026-11-12 19:40:40 +00:00
1 parent 61c11fc03f
commit cebb7c313d
39 files changed
+2184 -27

No files matched your search

+17
View File
@@ -16,6 +16,8 @@ import "svg2pdf.js";
import type { Plan } from "../plan/generatePlan";
import { planToRenderScene } from "../plan/toRenderScene";
import { sceneToPrintSvg } from "./sceneToPrintSvg";
import type { Project } from "../model/types";
import { finishPdfBytes, pdfInfoFields } from "./pdfInfo";
/** Unterstützte Papierformate (Blattmasse in mm, Hochformat-Basis). */
export type PaperFormat = "a4" | "a3";
@@ -42,6 +44,8 @@ export interface ExportPdfOptions {
titleBlock?: boolean;
/** Dateiname des Downloads (ohne/inkl. .pdf). */
fileName?: string;
/** Wettbewerb ([208]): bei anonymer Abgabe nur das Kennwort als Titel, keine Erzeuger-/Datumsangaben im PDF. */
competition?: Project["competition"];
}
/** Blattmasse (mm) nach Format + Ausrichtung. */
@@ -90,6 +94,8 @@ export async function buildPlanPdf(
// und deckungsgleich mit der Blattgröße; svg2pdf bildet sie 1:1 auf das mm-Ziel
// (Blattbreite/-höhe) ab.
await doc.svg(print.svg, { x: 0, y: 0, width: pageW, height: pageH });
// Info-Wörterbuch ([208]): anonym nur das Kennwort.
doc.setProperties(pdfInfoFields({ name: opts.subtitle ?? opts.title, competition: opts.competition }));
if (opts.titleBlock ?? true) {
drawTitleBlock(doc, pageW, pageH, opts);
@@ -149,5 +155,16 @@ export async function savePlanPdf(
): Promise<void> {
const doc = await buildPlanPdf(plan, opts);
const name = (opts.fileName ?? "grundriss").replace(/\.pdf$/i, "");
if (opts.competition?.anonymous) {
// doc.save() schreibt Producer/Datum selbst; anonym darum über die nachbearbeiteten Bytes.
const bytes = finishPdfBytes({ competition: opts.competition }, new Uint8Array(doc.output("arraybuffer")));
const url = URL.createObjectURL(new Blob([bytes as BlobPart], { type: "application/pdf" }));
const a = document.createElement("a");
a.href = url;
a.download = `${name}.pdf`;
a.click();
setTimeout(() => URL.revokeObjectURL(url), 1000);
return;
}
doc.save(`${name}.pdf`);
}