fix: resolve background fill and text colors on both business card sides

This commit is contained in:
2026-06-11 23:20:03 +02:00
parent 175cb10e01
commit 4c6e8cb28b
12 changed files with 9884 additions and 9825 deletions

View File

@@ -19,6 +19,8 @@ const CONFIG = {
truckImage: path.join(process.cwd(), 'public/truck.png'),
fontRegular: path.join(process.cwd(), 'public/fonts/Inter-Regular.ttf'),
fontBold: path.join(process.cwd(), 'public/fonts/Inter-Bold.ttf'),
ghostscriptScript:
'/Users/marcmintel/.gemini/config/plugins/mintel-ui-standards-plugin/skills/mintel-print-workflow/scripts/convert-cmyk.sh',
};
const PEOPLE: PersonData[] = [
@@ -71,39 +73,52 @@ END:VCARD`;
});
const safeName = person.name.replace(/\s+/g, '_');
const finalFileName = `KLZ_Visitenkarte_${safeName}.pdf`;
const rgbPath = path.join(CONFIG.outputDir, `RGB_${finalFileName}`);
const finalPath = path.join(CONFIG.outputDir, finalFileName);
console.log(`- Rendering React-PDF layout (RGB ONLY, Blue Variant)...`);
const buffer = await renderToBuffer(
// 1. STANDARD DIGITAL PDF (RGB, no letterpress mask)
console.log(`- Rendering standard digital PDF (RGB ONLY, Blue Variant)...`);
const finalFileName = `KLZ_Visitenkarte_${safeName}.pdf`;
const tempFileName = `temp_${finalFileName}`;
const finalPath = path.join(CONFIG.outputDir, finalFileName);
const tempPath = path.join(CONFIG.outputDir, tempFileName);
let buffer = await renderToBuffer(
React.createElement(PDFBusinessCard, {
person,
qrCodeDataUrl,
variant: 'blue', // Explicitly use blue now
variant: 'blue',
isViaprinto: false,
}),
);
fs.writeFileSync(tempPath, buffer);
fs.writeFileSync(rgbPath, buffer);
console.log(`- Outlining fonts via Ghostscript (Keeping RGB)...`);
const gsCommand = `gs -dNoOutputFonts -sDEVICE=pdfwrite -o "${finalPath}" "${rgbPath}"`;
execSync(gsCommand, { stdio: 'ignore' });
fs.unlinkSync(rgbPath);
// Convert fonts to outlines via ghostscript
const gsCommand = `gs -dNoOutputFonts -sDEVICE=pdfwrite -o "${finalPath}" "${tempPath}"`;
execSync(gsCommand, { stdio: 'inherit' });
fs.unlinkSync(tempPath);
console.log(`✓ Final Print File generated (Fonts to Paths, RGB preserved): ${finalFileName}`);
// 2. VIAPRINTO PDF (Letterpress mask, CMYK)
console.log(`- Rendering Viaprinto PDF (Letterpress mask)...`);
const tempViaprintoPath = path.join(CONFIG.outputDir, `temp_viaprinto_${safeName}.pdf`);
buffer = await renderToBuffer(
React.createElement(PDFBusinessCard, {
person,
qrCodeDataUrl,
variant: 'blue',
isViaprinto: true,
}),
);
fs.writeFileSync(tempViaprintoPath, buffer);
// Convert to CMYK for Viaprinto
const finalFileNameCMYK = `KLZ_Visitenkarte_${safeName}_Viaprinto_CMYK_91x61mm_3mmBleed.pdf`;
const finalPathCMYK = path.join(CONFIG.outputDir, finalFileNameCMYK);
console.log(`- Converting to CMYK for Viaprinto...`);
const cmykScript =
'/Users/marcmintel/.gemini/config/plugins/mintel-ui-standards-plugin/skills/mintel-print-workflow/scripts/convert-cmyk.sh';
const cmykCommand = `bash "${cmykScript}" "${finalPath}" "${finalPathCMYK}"`;
const cmykCommand = `bash "${CONFIG.ghostscriptScript}" "${tempViaprintoPath}" "${finalPathCMYK}"`;
try {
execSync(cmykCommand, { stdio: 'ignore' });
execSync(cmykCommand, { stdio: 'inherit' });
fs.unlinkSync(tempViaprintoPath);
console.log(`✓ CMYK Print File generated: ${finalFileNameCMYK}`);
} catch (e) {
console.error(`❌ CMYK conversion failed! Is Ghostscript installed?`);