diff --git a/scripts/generate-business-cards.ts b/scripts/generate-business-cards.ts index 8a1e915b..51fd6ff6 100644 --- a/scripts/generate-business-cards.ts +++ b/scripts/generate-business-cards.ts @@ -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}`); } }