chore: clean up output to only generate one print PDF per person
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 10s
Build & Deploy / 🧪 QA (push) Successful in 51s
Build & Deploy / 🏗️ Build (push) Successful in 1m56s
Build & Deploy / 🚀 Deploy (push) Successful in 15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 1s

- Script no longer leaves RGB masters or spaces in filenames
This commit is contained in:
2026-06-09 15:55:10 +02:00
parent 0f8a92693e
commit d6876f6107

View File

@@ -76,28 +76,27 @@ END:VCARD`;
});
const safeName = person.name.replace(/\s+/g, '_');
const rgbFileName = `KLZ_BusinessCard_${safeName}_RGB.pdf`;
const cmykFileName = `KLZ_BusinessCard_${safeName}_CMYK_Print.pdf`;
const rgbPath = path.join(CONFIG.outputDir, rgbFileName);
const cmykPath = path.join(CONFIG.outputDir, cmykFileName);
const finalFileName = `KLZ_Visitenkarte_${safeName}.pdf`;
const tempRgbPath = path.join(CONFIG.outputDir, `temp_rgb_${safeName}.pdf`);
const finalPath = path.join(CONFIG.outputDir, finalFileName);
console.log(`- Rendering React-PDF layout...`);
const buffer = await renderToBuffer(
React.createElement(PDFBusinessCard, {
person,
logoWhitePath: CONFIG.logoWhite,
logoBluePath: CONFIG.logoBlue,
logoFullPath: CONFIG.logoFull,
truckImagePath: CONFIG.truckImage,
qrCodeDataUrl,
}),
);
fs.writeFileSync(rgbPath, buffer);
console.log(`✓ RGB Master generated: ${rgbFileName}`);
fs.writeFileSync(tempRgbPath, buffer);
convertToCMYK(tempRgbPath, finalPath);
convertToCMYK(rgbPath, cmykPath);
// Clean up temporary RGB file
if (fs.existsSync(tempRgbPath)) {
fs.unlinkSync(tempRgbPath);
}
console.log(`✓ Final Print File generated: ${finalFileName}`);
}
}