diff --git a/lib/TruckBlueprint.tsx b/lib/TruckBlueprint.tsx
new file mode 100644
index 00000000..b09e1f18
--- /dev/null
+++ b/lib/TruckBlueprint.tsx
@@ -0,0 +1,9898 @@
+import React from 'react';
+import { Svg, G, Path } from '@react-pdf/renderer';
+
+export const TruckBlueprint = ({ style, opacity = 1 }: { style?: any; opacity?: number }) => (
+
+);
diff --git a/lib/pdf-business-card.tsx b/lib/pdf-business-card.tsx
index 853a3fda..c24a922c 100644
--- a/lib/pdf-business-card.tsx
+++ b/lib/pdf-business-card.tsx
@@ -16,6 +16,7 @@ import {
Circle,
} from '@react-pdf/renderer';
import * as path from 'path';
+import { TruckBlueprint } from './TruckBlueprint';
// Register embedded fonts so Ghostscript -dNoOutputFonts can convert them to
// outlines (curves). Built-in PDF fonts like Helvetica are NEVER embedded and
@@ -89,9 +90,6 @@ const styles = StyleSheet.create({
frontBackgroundImage: {
width: '100%',
height: '100%',
- objectFit: 'contain',
- objectPositionX: 'center',
- objectPositionY: 'center',
opacity: 0.4, // Less transparent, more contrast
},
frontContainer: {
@@ -362,16 +360,25 @@ const VectorLogo = ({
paths,
style,
overrideColor,
+ overrideWhiteColor,
}: {
paths: { d: string; fill: string }[];
style: any;
overrideColor?: string;
+ overrideWhiteColor?: string;
}) => (
);
@@ -704,8 +711,7 @@ export const PDFBusinessCard: React.FC = ({
style={[styles.pageBleed, isWhiteVariant && { backgroundColor: '#ffffff' }]}
>
-
@@ -766,7 +772,11 @@ export const PDFBusinessCard: React.FC = ({
-
+
diff --git a/scripts/svg-to-react-pdf.ts b/scripts/svg-to-react-pdf.ts
new file mode 100644
index 00000000..96f45d9e
--- /dev/null
+++ b/scripts/svg-to-react-pdf.ts
@@ -0,0 +1,64 @@
+import fs from 'fs';
+
+const svgFile = process.argv[2];
+const outFile = process.argv[3];
+
+let content = fs.readFileSync(svgFile, 'utf8');
+
+content = content.replace(/<\?xml.*\?>/g, '');
+content = content.replace(//g, '');
+content = content.replace(/xmlns:xlink="[^"]+"/g, '');
+content = content.replace(/xmlns:serif="[^"]+"/g, '');
+content = content.replace(/xml:space="preserve"/g, '');
+content = content.replace(/xmlns="[^"]+"/g, '');
+content = content.replace(/version="[^"]+"/g, '');
+
+// Convert attributes to camelCase
+content = content.replace(/fill-rule/g, 'fillRule');
+content = content.replace(/clip-rule/g, 'clipRule');
+content = content.replace(/stroke-linejoin/g, 'strokeLinejoin');
+content = content.replace(/stroke-miterlimit/g, 'strokeMiterlimit');
+
+// Convert style="fill:#xxxx;fill-rule:nonzero;" to fill="#xxxx" fillRule="nonzero"
+content = content.replace(/style="([^"]+)"/g, (match, styleStr) => {
+ const parts = styleStr.split(';').filter(Boolean);
+ let attrs = [];
+ for (const part of parts) {
+ const [key, val] = part.split(':');
+ if (key === 'fill') attrs.push(`fill="${val}"`);
+ if (key === 'fillRule' || key === 'fill-rule') attrs.push(`fillRule="${val}"`);
+ if (key === 'clipRule' || key === 'clip-rule') attrs.push(`clipRule="${val}"`);
+ if (key === 'strokeLinejoin' || key === 'stroke-linejoin')
+ attrs.push(`strokeLinejoin="${val}"`);
+ if (key === 'strokeMiterlimit' || key === 'stroke-miterlimit')
+ attrs.push(`strokeMiterlimit="${val}"`);
+ }
+ return attrs.join(' ');
+});
+
+// React components
+content = content.replace(/');
+content = content.replace(//g, '');
+content = content.replace(//g, '');
+
+// In React PDF, width/height on Svg can be removed and controlled via style.
+content = content.replace(/width="100%" height="100%" /, '');
+
+const final = `
+import React from 'react';
+import { Svg, G, Path } from '@react-pdf/renderer';
+
+export const TruckBlueprint = ({ style, opacity = 1 }: { style?: any, opacity?: number }) => (
+
+);
+`;
+
+fs.writeFileSync(outFile, final);
+console.log('Done!');