Upload Neu
This commit is contained in:
@@ -23,9 +23,6 @@ async function finalizeOrder(req, res, next) {
|
||||
}
|
||||
|
||||
console.log(`[Order] Finalizing order: ${orderNumber} from session: ${sessionId}`);
|
||||
if (envelopes && envelopes.length > 0) {
|
||||
console.log(`[Order] Envelope data provided: ${envelopes.length} envelopes`);
|
||||
}
|
||||
|
||||
// Check if session cache exists
|
||||
const sessionDir = path.join(config.paths.previews, sessionId);
|
||||
@@ -97,6 +94,7 @@ async function finalizeOrder(req, res, next) {
|
||||
}
|
||||
|
||||
// Create order metadata
|
||||
const meta = req.body.metadata || {};
|
||||
const orderMetadata = {
|
||||
orderNumber,
|
||||
sessionId,
|
||||
@@ -105,7 +103,10 @@ async function finalizeOrder(req, res, next) {
|
||||
envelopeCount: copiedEnvelopes.length,
|
||||
letters: copiedLetters,
|
||||
envelopes: copiedEnvelopes,
|
||||
other: copiedOther
|
||||
other: copiedOther,
|
||||
letterFormat: meta.letterFormat || null,
|
||||
envelopeFormat: meta.envelopeFormat || null,
|
||||
envelopeBeschriftung: meta.envelopeBeschriftung || null,
|
||||
};
|
||||
|
||||
const orderMetadataPath = path.join(outputDir, 'order-metadata.json');
|
||||
@@ -317,6 +318,7 @@ async function generateOrder(req, res, next) {
|
||||
}
|
||||
|
||||
// Step 6: Create order metadata
|
||||
const meta = req.body.metadata || {};
|
||||
const orderMetadata = {
|
||||
orderNumber,
|
||||
generatedAt: new Date().toISOString(),
|
||||
@@ -326,7 +328,10 @@ async function generateOrder(req, res, next) {
|
||||
envelopes: generatedEnvelopes,
|
||||
fonts: Object.keys(lettersByFont),
|
||||
hasPlaceholders,
|
||||
csvFiles
|
||||
csvFiles,
|
||||
letterFormat: meta.letterFormat || null,
|
||||
envelopeFormat: meta.envelopeFormat || null,
|
||||
envelopeBeschriftung: meta.envelopeBeschriftung || null,
|
||||
};
|
||||
|
||||
const orderMetadataPath = path.join(outputDir, 'order-metadata.json');
|
||||
|
||||
@@ -5,7 +5,7 @@ const FONT_SIZE_PX = 26;
|
||||
const LINE_LIMITS = {
|
||||
a4: 27,
|
||||
a6p: 14,
|
||||
a6l: 9,
|
||||
a6l: 11,
|
||||
};
|
||||
|
||||
// Layout Konfiguration pro Format + Orientation
|
||||
@@ -19,15 +19,16 @@ const FORMAT_LAYOUTS = {
|
||||
|
||||
// A6 Hochformat
|
||||
a6p: {
|
||||
marginTopMm: 12,
|
||||
marginLeftMm: 10,
|
||||
marginTopMm: 8,
|
||||
marginLeftMm: 8,
|
||||
lineHeightFactor: 1.3,
|
||||
},
|
||||
|
||||
// A6 Querformat (landscape)
|
||||
a6l: {
|
||||
marginTopMm: 10,
|
||||
marginTopMm: 8,
|
||||
marginLeftMm: 8,
|
||||
marginRightMm: 14,
|
||||
lineHeightFactor: 1.2,
|
||||
},
|
||||
|
||||
@@ -77,6 +78,7 @@ function getLayoutForFormat(format) {
|
||||
return {
|
||||
marginTopPx: mmToPx(layoutConfig.marginTopMm),
|
||||
marginLeftPx: mmToPx(layoutConfig.marginLeftMm),
|
||||
marginRightPx: layoutConfig.marginRightMm ? mmToPx(layoutConfig.marginRightMm) : null,
|
||||
lineHeightPx: FONT_SIZE_PX * layoutConfig.lineHeightFactor,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ function generateLetterSVG(text, format, options = {}) {
|
||||
const fontConfig = SVG_FONT_CONFIG[fontKey];
|
||||
|
||||
const { widthPx, heightPx, widthMm, heightMm } = getPageDimensions(format);
|
||||
const { marginTopPx, marginLeftPx, lineHeightPx } = getLayoutForFormat(format);
|
||||
const { marginTopPx, marginLeftPx, marginRightPx, lineHeightPx } = getLayoutForFormat(format);
|
||||
|
||||
// Automatischer Zeilenumbruch
|
||||
const maxWidthPx = widthPx - 2 * marginLeftPx;
|
||||
const maxWidthPx = widthPx - marginLeftPx - (marginRightPx ?? marginLeftPx);
|
||||
|
||||
const lines = wrapTextToLinesByWidth({
|
||||
text: String(text || ''),
|
||||
|
||||
Reference in New Issue
Block a user