[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:
39 files changed
+2184
-27
No files matched your search
@@ -16,6 +16,7 @@ Abschnitt 3.4).
|
||||
| `exportPdf.ts` | Vektor-PDF eines Plans (Massstab, Papier, Ausrichtung) mit jsPDF und svg2pdf |
|
||||
| `layoutPdf.ts` | alle Layouts eines Ordners als Mehrseiten-PDF |
|
||||
| `pdfLayers.ts` | PDF-Ebenen (Optional Content Groups, `[80]`) |
|
||||
| `pdfInfo.ts` | PDF-Info-Wörterbuch; bei anonymer Wettbewerbs-Abgabe nur das Kennwort, Producer/Datum längengleich neutralisiert (`[208]`) |
|
||||
| `exportDxf.ts` | DXF/DWG des Grundrisses in Modellmetern; Schreiben in `src-tauri/fileio/src/export.rs` |
|
||||
| `legendSvg.ts` | Legende als Plan-/Druck-SVG (`[82]`) |
|
||||
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// [208] Blatt-PDF: Bild eingebettet (JPEG ohne Neukompression), Plakat-Kopfzeile, anonyme Abgabe ohne Metadaten.
|
||||
import { inflateSync } from "node:zlib";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { sampleProject } from "../model/sampleProject";
|
||||
import type { Layout, Project } from "../model/types";
|
||||
import { createPosterMaster, posterTemplate } from "../model/posterTemplates";
|
||||
import { addImage, createLayoutImage } from "../model/layoutImages";
|
||||
import { JPEG_64X48, PNG_40X30, PNG_40X30_ALPHA } from "../model/layoutImages.testing";
|
||||
import { buildPagesPdf, layoutPages, pdfBytes } from "./layoutPdf";
|
||||
import { pdfInfoText } from "./pdfInfo";
|
||||
|
||||
const latin1 = (b: Uint8Array): string => {
|
||||
let s = "";
|
||||
for (let i = 0; i < b.length; i++) s += String.fromCharCode(b[i]);
|
||||
return s;
|
||||
};
|
||||
|
||||
/** Alle Flate-Streams des PDF entpackt, hintereinander (Seiteninhalt ist komprimiert). */
|
||||
function streamsText(bytes: Uint8Array): string {
|
||||
const all = Buffer.from(bytes);
|
||||
const text = all.toString("latin1");
|
||||
let out = "";
|
||||
for (const m of text.matchAll(/stream\r?\n/g)) {
|
||||
const from = m.index! + m[0].length;
|
||||
const to = text.indexOf("endstream", from);
|
||||
try {
|
||||
out += inflateSync(all.subarray(from, to)).toString("latin1") + "\n";
|
||||
} catch {
|
||||
// kein Flate-Stream (z. B. JPEG)
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function indexOfBytes(hay: Uint8Array, needle: Uint8Array): number {
|
||||
outer: for (let i = 0; i + needle.length <= hay.length; i++) {
|
||||
for (let j = 0; j < needle.length; j++) if (hay[i + j] !== needle[j]) continue outer;
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function poster(extra?: Partial<Project>): Project {
|
||||
const master = createPosterMaster("m1", posterTemplate("poster-a1-landscape")!);
|
||||
master.titleBlock = { projectName: "Büro Muster AG", author: "Maria Muster" };
|
||||
const base: Layout = { id: "l1", name: "Grundriss", paper: "a1", orientation: "landscape", masterId: "m1", viewports: [] };
|
||||
const img = createLayoutImage("i1", "foto.jpg", JPEG_64X48, { w: 841, h: 594 })!;
|
||||
return { ...sampleProject, name: "Haus Muster", masterLayouts: [master], layouts: [addImage(base, img)], ...extra };
|
||||
}
|
||||
|
||||
describe("Blatt-PDF mit Bild", () => {
|
||||
it("bettet das JPEG unverändert ein (DCTDecode, keine Neukompression)", async () => {
|
||||
const p = poster();
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
const bytes = pdfBytes(p, doc!);
|
||||
expect(latin1(bytes)).toContain("/DCTDecode");
|
||||
expect(indexOfBytes(bytes, JPEG_64X48)).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("PNG mit und ohne Alpha lässt sich einbetten", async () => {
|
||||
for (const png of [PNG_40X30, PNG_40X30_ALPHA]) {
|
||||
const p = poster();
|
||||
const img = createLayoutImage("i2", "r.png", png, { w: 841, h: 594 })!;
|
||||
p.layouts = [addImage({ ...p.layouts![0], images: [] }, img)];
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
expect(latin1(pdfBytes(p, doc!))).toContain("/Subtype /Image");
|
||||
}
|
||||
});
|
||||
|
||||
it("Blattgrösse A1 quer, Plakat-Kopfzeile mit Kennwort und Plan x/n", async () => {
|
||||
const p = poster({ competition: { anonymous: false, keyword: "FALKE 7" } });
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
const bytes = pdfBytes(p, doc!);
|
||||
expect(latin1(bytes)).toMatch(/\/MediaBox \[0 0 2383\.93\d* 1683\.7\d*/); // 841 × 594 mm in pt
|
||||
const content = streamsText(bytes);
|
||||
expect(content).toContain("(Kennwort)");
|
||||
expect(content).toContain("(FALKE 7)");
|
||||
expect(content).toContain("(Plan 1/1)");
|
||||
});
|
||||
|
||||
it("anonyme Abgabe: keine Büro-/Autor-Angaben, Info nur mit Kennwort, kein jsPDF-Producer", async () => {
|
||||
const p = poster({ competition: { anonymous: true, keyword: "FALKE 7" } });
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
const bytes = pdfBytes(p, doc!);
|
||||
const info = pdfInfoText(bytes);
|
||||
expect(info).toContain("/Title (FALKE 7)");
|
||||
expect(info).not.toMatch(/jsPDF/);
|
||||
expect(info).not.toContain("/Author");
|
||||
expect(info).not.toContain("/Creator");
|
||||
expect(info).toContain("D:20000101000000");
|
||||
const all = latin1(bytes) + streamsText(bytes);
|
||||
expect(all).not.toContain("Büro Muster");
|
||||
expect(all).not.toContain("Maria Muster");
|
||||
expect(all).not.toContain("Haus Muster");
|
||||
expect(all).toContain("(FALKE 7)");
|
||||
});
|
||||
|
||||
it("nicht anonym: Projektname im Titel, Bearbeiter im Info-Wörterbuch", async () => {
|
||||
const p = poster();
|
||||
const doc = await buildPagesPdf(p, layoutPages(p, ["l1"]));
|
||||
const info = pdfInfoText(pdfBytes(p, doc!));
|
||||
expect(info).toContain("/Title (Haus Muster)");
|
||||
expect(info).toContain("Maria Muster");
|
||||
});
|
||||
});
|
||||
+77
-1
@@ -20,6 +20,9 @@ import { generatePlan, type Plan } from "../plan/generatePlan";
|
||||
import { snapshotMono, snapshotOverrideRuleIds, snapshotTemplate, viewportLevelPlan } from "../plan/viewportPlan";
|
||||
import { planToPrintSvg } from "./planToPrintSvg";
|
||||
import { drawTablesPdf, sheetTables } from "./sheetTable";
|
||||
import { applyPdfInfo, finishPdfBytes } from "./pdfInfo";
|
||||
import { imageGeometry } from "../model/layoutImages";
|
||||
import { posterHeaderItems, viewportScaleLabel } from "../model/posterTemplates";
|
||||
import { collectVisibleCodes } from "../model/types";
|
||||
import {
|
||||
effectiveSheetSizeMm,
|
||||
@@ -90,6 +93,9 @@ function drawTitleBlock(
|
||||
doc.text(`${tb.date} · ${fmt}`, x + boxW - 3, y + boxH - 2.4, { align: "right" });
|
||||
}
|
||||
|
||||
/** Schrifthöhe in mm → pt (jsPDF misst Schriftgrössen in pt). */
|
||||
const MM_TO_PT = 72 / 25.4;
|
||||
|
||||
function clip(s: string, max: number): string {
|
||||
return s.length > max ? s.slice(0, max - 1) + "…" : s;
|
||||
}
|
||||
@@ -149,6 +155,55 @@ function inLayer(ctx: PageCtx, name: string, fn: () => void | Promise<void>): Pr
|
||||
return ctx.layers ? ctx.layers.run(name, fn) : fn();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bilder des Blatts ([208]): das Original unverändert eingebettet (JPEG ohne Neukompression), auf den Rahmen
|
||||
* geklippt; mit Zuschnitt liegt das ganze Bild verschoben/vergrössert dahinter, sichtbar ist nur der Rahmen.
|
||||
*/
|
||||
function drawImagesPdf(doc: jsPDF, layout: Layout): void {
|
||||
for (const img of layout.images ?? []) {
|
||||
const m = /^data:image\/(png|jpeg);base64,/.exec(img.src);
|
||||
if (!m || img.widthMm <= 0 || img.heightMm <= 0) continue;
|
||||
const g = imageGeometry(img);
|
||||
doc.saveGraphicsState();
|
||||
doc.rect(g.clip.x, g.clip.y, g.clip.w, g.clip.h, null);
|
||||
doc.clip();
|
||||
doc.discardPath();
|
||||
try {
|
||||
doc.addImage(img.src, m[1] === "png" ? "PNG" : "JPEG", g.draw.x, g.draw.y, g.draw.w, g.draw.h, img.id, "NONE");
|
||||
} finally {
|
||||
doc.restoreGraphicsState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Massstabsangabe unter jedem Viewport ([208], Master `viewportScaleLabels`). */
|
||||
function drawScaleLabelsPdf(doc: jsPDF, project: Project, layout: Layout, sheet: { w: number; h: number }, scaleOverride?: number): void {
|
||||
doc.setTextColor(17, 17, 17);
|
||||
doc.setFont("helvetica", "normal");
|
||||
for (const vp of layout.viewports) {
|
||||
const l = viewportScaleLabel(project, vp, sheet, scaleOverride);
|
||||
if (!l) continue;
|
||||
doc.setFontSize(l.sizeMm * MM_TO_PT);
|
||||
doc.text(l.text, l.x, l.y);
|
||||
}
|
||||
}
|
||||
|
||||
/** Plakat-Kopfzeile ([208]): Band, Kennwort-Feld, Titel, „Plan x/n". */
|
||||
function drawPosterHeaderPdf(doc: jsPDF, project: Project, layout: Layout, master: MasterLayout, sheet: { w: number; h: number }): void {
|
||||
doc.setDrawColor(17, 17, 17);
|
||||
doc.setTextColor(17, 17, 17);
|
||||
for (const it of posterHeaderItems(project, layout, master, sheet)) {
|
||||
if (it.kind === "rect") {
|
||||
doc.setLineWidth(it.stroke);
|
||||
doc.rect(it.x, it.y, it.w, it.h);
|
||||
} else {
|
||||
doc.setFont("helvetica", it.bold ? "bold" : "normal");
|
||||
doc.setFontSize(it.sizeMm * MM_TO_PT);
|
||||
doc.text(it.text, it.x, it.y, { align: it.align });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Zeichnet die Viewports + Master-Elemente EINER Seite in das jsPDF-Dokument. */
|
||||
async function renderPage(
|
||||
doc: jsPDF,
|
||||
@@ -196,6 +251,18 @@ async function renderPage(
|
||||
}
|
||||
}
|
||||
|
||||
// Bilder ([208]): Renderings, Fotos — über den Viewports, unter Legenden und Schriftfeld.
|
||||
try {
|
||||
await inLayer(ctx, t("pdfLayers.images"), () => drawImagesPdf(doc, layout));
|
||||
} catch {
|
||||
// Ein Bild, das nicht einbettet, darf die Seite nicht killen.
|
||||
}
|
||||
|
||||
// Massstab je Viewport ([208]).
|
||||
if (master?.viewportScaleLabels) {
|
||||
await inLayer(ctx, t("pdfLayers.frame"), () => drawScaleLabelsPdf(doc, project, layout, { w: widthMm, h: heightMm }, ctx.scaleOverride));
|
||||
}
|
||||
|
||||
// Legenden ([82]): live aus den Viewports (oder Handauswahl), Muster vom Kern-Schraffurgenerator.
|
||||
for (const lg of layout.legends ?? []) {
|
||||
try {
|
||||
@@ -219,6 +286,7 @@ async function renderPage(
|
||||
}
|
||||
const tb = resolveTitleBlock(project, layout, master);
|
||||
drawTitleBlock(doc, widthMm, heightMm, tb, layout.paper, layout.orientation, ctx.includeRevision);
|
||||
if (master.posterHeader) drawPosterHeaderPdf(doc, project, layout, master, { w: widthMm, h: heightMm });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -259,6 +327,9 @@ export async function buildPagesPdf(project: Project, pages: FolderPdfPage[], op
|
||||
|
||||
const first = sizeOf(pages[0]);
|
||||
const doc = new jsPDF({ unit: "mm", format: [first.w, first.h], orientation: orientOf(first), compress: true });
|
||||
// Info-Wörterbuch: anonym nur das Kennwort ([208]); sonst Projektname und Bearbeiter des ersten Blatts.
|
||||
const firstMaster = findMaster(project, pages[0].layout);
|
||||
applyPdfInfo(doc, project, firstMaster ? resolveTitleBlock(project, pages[0].layout, firstMaster).author : undefined);
|
||||
const ctx: PageCtx = {
|
||||
layers: opts.layers ? enablePdfLayers(doc) : undefined,
|
||||
scaleOverride: opts.scaleOverride && opts.scaleOverride > 0 ? opts.scaleOverride : undefined,
|
||||
@@ -301,5 +372,10 @@ export async function buildFolderPdf(project: Project, folderId: string): Promis
|
||||
export async function folderPdfBytes(project: Project, folderId: string): Promise<Uint8Array | null> {
|
||||
const doc = await buildFolderPdf(project, folderId);
|
||||
if (!doc) return null;
|
||||
return new Uint8Array(doc.output("arraybuffer"));
|
||||
return pdfBytes(project, doc);
|
||||
}
|
||||
|
||||
/** Fertige PDF-Bytes eines Dokuments; bei anonymer Abgabe ohne Erzeuger-/Datumsangaben ([208]). */
|
||||
export function pdfBytes(project: Project, doc: jsPDF): Uint8Array {
|
||||
return finishPdfBytes(project, new Uint8Array(doc.output("arraybuffer")));
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// PDF-Metadaten ([208]): Titel/Autor/Ersteller des Info-Wörterbuchs. Bei anonymer Wettbewerbs-Abgabe
|
||||
// (`Project.competition`) enthält das PDF nur das Kennwort als Titel — keine Büro-, Autor- oder Programmangaben:
|
||||
// jsPDF schreibt `/Producer (jsPDF x.y.z)` und `/CreationDate` immer selbst, darum wird die fertige Datei
|
||||
// längengleich nachbearbeitet (Xref-Offsets bleiben gültig).
|
||||
//
|
||||
// Bezeichner englisch, Kommentare deutsch.
|
||||
|
||||
import type { jsPDF } from "jspdf";
|
||||
import type { Project } from "../model/types";
|
||||
|
||||
/** Ist die Abgabe anonym? */
|
||||
export function isAnonymous(project: Pick<Project, "competition">): boolean {
|
||||
return project.competition?.anonymous === true;
|
||||
}
|
||||
|
||||
/** Kennwort der Abgabe (getrimmt, leer ohne Wettbewerb). */
|
||||
export function competitionKeyword(project: Pick<Project, "competition">): string {
|
||||
return (project.competition?.keyword ?? "").trim();
|
||||
}
|
||||
|
||||
/** Projektname für Schriftfelder und Dateinamen der Exporte: bei anonymer Abgabe das Kennwort. */
|
||||
export function exportProjectName(project: Pick<Project, "name" | "competition">): string {
|
||||
return isAnonymous(project) ? competitionKeyword(project) : (project.name ?? "");
|
||||
}
|
||||
|
||||
/** Info-Felder, die ins PDF gehören: anonym nur das Kennwort als Titel, sonst Projektname und Autor des Titelblocks. */
|
||||
export function pdfInfoFields(project: Pick<Project, "name" | "competition">, author?: string): { title: string; author: string; subject: string; keywords: string; creator: string } {
|
||||
if (isAnonymous(project)) return { title: competitionKeyword(project), author: "", subject: "", keywords: "", creator: "" };
|
||||
return { title: project.name ?? "", author: author ?? "", subject: "", keywords: "", creator: "Dossier" };
|
||||
}
|
||||
|
||||
/** Setzt die Info-Felder auf dem jsPDF-Dokument. */
|
||||
export function applyPdfInfo(doc: jsPDF, project: Pick<Project, "name" | "competition">, author?: string): void {
|
||||
doc.setProperties(pdfInfoFields(project, author));
|
||||
}
|
||||
|
||||
/**
|
||||
* Anonymisiert die fertigen PDF-Bytes: `/Producer (…)` wird durch Leerzeichen gleicher Länge ersetzt und das
|
||||
* Datum in `/CreationDate` auf einen festen Wert gesetzt. Gilt nur für anonyme Abgaben; sonst unverändert.
|
||||
*/
|
||||
export function finishPdfBytes(project: Pick<Project, "competition">, bytes: Uint8Array): Uint8Array {
|
||||
return isAnonymous(project) ? neutralizePdfInfo(bytes) : bytes;
|
||||
}
|
||||
|
||||
/** Letzte Fundstelle des ASCII-Musters in den Bytes (-1: keine). */
|
||||
function lastIndexOfAscii(bytes: Uint8Array, pattern: string): number {
|
||||
const n = pattern.length;
|
||||
outer: for (let i = bytes.length - n; i >= 0; i--) {
|
||||
for (let j = 0; j < n; j++) if (bytes[i + j] !== pattern.charCodeAt(j)) continue outer;
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** Längengleiche Ersetzung der Erzeuger- und Datumsangabe im Info-Wörterbuch (das letzte im Text, nahe dem Ende). */
|
||||
export function neutralizePdfInfo(bytes: Uint8Array): Uint8Array {
|
||||
// Byteweise, nicht über TextDecoder: "latin1" ist dort windows-1252 und verfälschte Binärdaten.
|
||||
const out = new Uint8Array(bytes);
|
||||
const blank = (key: string, fn: (v: string) => string) => {
|
||||
const at = lastIndexOfAscii(out, `${key} (`);
|
||||
if (at < 0) return;
|
||||
const from = at + key.length + 2;
|
||||
let to = from;
|
||||
while (to < out.length && out[to] !== 0x29 /* ) */) to++;
|
||||
if (to >= out.length) return;
|
||||
let v = "";
|
||||
for (let i = from; i < to; i++) v += String.fromCharCode(out[i]);
|
||||
const next = fn(v);
|
||||
if (next.length !== v.length) return;
|
||||
for (let i = 0; i < next.length; i++) out[from + i] = next.charCodeAt(i);
|
||||
};
|
||||
blank("/Producer", (v) => " ".repeat(v.length));
|
||||
blank("/CreationDate", (v) => v.replace(/^D:\d{14}/, "D:20000101000000"));
|
||||
blank("/ModDate", (v) => v.replace(/^D:\d{14}/, "D:20000101000000"));
|
||||
return out;
|
||||
}
|
||||
|
||||
/** Hilfsfunktion für Tests: das Info-Wörterbuch als Text. */
|
||||
export function pdfInfoText(bytes: Uint8Array): string {
|
||||
const at = lastIndexOfAscii(bytes, "/Producer");
|
||||
if (at < 0) return "";
|
||||
const start = Math.max(0, at - 4);
|
||||
let s = "";
|
||||
for (let i = start; i < Math.min(bytes.length, at + 400); i++) s += String.fromCharCode(bytes[i]);
|
||||
const end = s.indexOf(">>");
|
||||
return end < 0 ? s : s.slice(0, end + 2);
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { collectVisibleCodes } from "../model/types";
|
||||
import { generatePlan } from "../plan/generatePlan";
|
||||
import { sheetLevelOf } from "../model/layoutModel";
|
||||
import { legendDrawings, legendEntries } from "../analysis/legend";
|
||||
import { buildPagesPdf, layoutPages } from "./layoutPdf";
|
||||
import { buildPagesPdf, layoutPages, pdfBytes } from "./layoutPdf";
|
||||
import { buildPlanDwg, buildPlanDxfBinary } from "./exportDxf";
|
||||
import { loadFileio } from "../engine/fileioWasm";
|
||||
import { withDocument } from "../core/document";
|
||||
@@ -97,7 +97,7 @@ async function publishFiles(shown: Project, set: PublishSet, plan: PublishPlan):
|
||||
paperOverride: plan.paperOverride,
|
||||
includeRevision: plan.includeRevision,
|
||||
});
|
||||
if (doc) out.push({ fileName: f.fileName, bytes: new Uint8Array(doc.output("arraybuffer")), mime: "application/pdf" });
|
||||
if (doc) out.push({ fileName: f.fileName, bytes: pdfBytes(shown, doc), mime: "application/pdf" });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -85,9 +85,11 @@ export function planPublish(project: Project, set: PublishSet, today: string): P
|
||||
const revision = includeRevision ? (bump ? nextRevision(l.revision) : (l.revision ?? "")) : "";
|
||||
return { layoutId: l.id, number: tb.planNumber, name: l.name, revision };
|
||||
});
|
||||
// Anonyme Abgabe ([208]): Dateinamen tragen das Kennwort statt Projektnummer und Projektname.
|
||||
const anon = project.competition?.anonymous === true;
|
||||
const base = {
|
||||
Projektnummer: project.projectNumber ?? "",
|
||||
Projekt: project.name ?? "",
|
||||
Projektnummer: anon ? "" : (project.projectNumber ?? ""),
|
||||
Projekt: anon ? (project.competition?.keyword ?? "").trim() : (project.name ?? ""),
|
||||
Datum: today,
|
||||
Satz: set.name,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user