From a546ffe69ce32d7c15d7e0e00a5854e806a56893 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Mon, 16 Mar 2026 07:47:47 +0100 Subject: [PATCH] fix(pdf): remove broken helvetica font registration causing 500 error --- app/[locale]/layout.tsx | 6 +---- lib/pdf-datasheet.tsx | 51 ++++++++++++----------------------------- lib/pdf-page.tsx | 10 ++------ 3 files changed, 18 insertions(+), 49 deletions(-) diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index b5cc4390..eeb055b6 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -132,11 +132,7 @@ export default async function Layout(props: { const feedbackEnabled = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true'; return ( - + diff --git a/lib/pdf-datasheet.tsx b/lib/pdf-datasheet.tsx index 075ec15e..ae7dc787 100644 --- a/lib/pdf-datasheet.tsx +++ b/lib/pdf-datasheet.tsx @@ -1,22 +1,8 @@ import * as React from 'react'; -import { - Document, - Page, - View, - Text, - Image, - StyleSheet, - Font, -} from '@react-pdf/renderer'; +import { Document, Page, View, Text, Image, StyleSheet, Font } from '@react-pdf/renderer'; -// Register fonts (using system fonts for now, can be customized) -Font.register({ - family: 'Helvetica', - fonts: [ - { src: '/fonts/Helvetica.ttf', fontWeight: 400 }, - { src: '/fonts/Helvetica-Bold.ttf', fontWeight: 700 }, - ], -}); +// Standard fonts like Helvetica are built-in to PDF and don't require registration +// unless we want to use specific TTF files. Using built-in Helvetica for maximum stability. // Industrial/technical/restrained design - STYLEGUIDE.md compliant const styles = StyleSheet.create({ @@ -302,10 +288,7 @@ const getLabels = (locale: 'en' | 'de') => { return labels[locale]; }; -export const PDFDatasheet: React.FC = ({ - product, - locale, -}) => { +export const PDFDatasheet: React.FC = ({ product, locale }) => { const labels = getLabels(locale); return ( @@ -317,9 +300,7 @@ export const PDFDatasheet: React.FC = ({ KLZ - - {labels.productDatasheet} - + {labels.productDatasheet} @@ -328,7 +309,8 @@ export const PDFDatasheet: React.FC = ({ {product.categories.map((cat, index) => ( - {cat.name}{index < product.categories.length - 1 ? ' • ' : ''} + {cat.name} + {index < product.categories.length - 1 ? ' • ' : ''} ))} @@ -337,12 +319,8 @@ export const PDFDatasheet: React.FC = ({ {product.featuredImage ? ( - + ) : ( - {labels.noImage} )} @@ -356,7 +334,11 @@ export const PDFDatasheet: React.FC = ({ {labels.description} - {stripHtml(product.applicationHtml || product.shortDescriptionHtml || product.descriptionHtml)} + {stripHtml( + product.applicationHtml || + product.shortDescriptionHtml || + product.descriptionHtml, + )} )} @@ -372,17 +354,14 @@ export const PDFDatasheet: React.FC = ({ key={index} style={[ styles.specsTableRow, - index === product.attributes.length - 1 && - styles.specsTableRowLast, + index === product.attributes.length - 1 && styles.specsTableRowLast, ]} > {attr.name} - - {attr.options.join(', ')} - + {attr.options.join(', ')} ))} diff --git a/lib/pdf-page.tsx b/lib/pdf-page.tsx index a3aeecc0..4502e02d 100644 --- a/lib/pdf-page.tsx +++ b/lib/pdf-page.tsx @@ -1,14 +1,8 @@ import * as React from 'react'; import { Document, Page, View, Text, StyleSheet, Font, Link } from '@react-pdf/renderer'; -// Register fonts (using system fonts for now, can be customized) -Font.register({ - family: 'Helvetica', - fonts: [ - { src: '/fonts/Helvetica.ttf', fontWeight: 400 }, - { src: '/fonts/Helvetica-Bold.ttf', fontWeight: 700 }, - ], -}); +// Standard fonts like Helvetica are built-in to PDF and don't require registration +// unless we want to use specific TTF files. Using built-in Helvetica for maximum stability. // ─── Brand Tokens (matching datasheet) ────────────────────────────────── const C = {