fix(pdf): correct logo-black path, fix image fetch logic, and resolve irregular cross-section table spacing
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -3132,7 +3132,8 @@ async function loadEmbeddablePng(
|
|||||||
|
|
||||||
// Remote (fallback)
|
// Remote (fallback)
|
||||||
const host = process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
|
const host = process.env.NEXT_PUBLIC_BASE_URL || 'http://localhost:3000';
|
||||||
const fetchUrl = resolved.startsWith('/') ? `${host}${resolved}` : resolved;
|
// Ensure we don't end up with `http://localhost:3000http://...`
|
||||||
|
const fetchUrl = resolved.startsWith('/') ? `${host.replace(/\/$/, '')}${resolved}` : resolved;
|
||||||
const bytes = await fetchBytes(fetchUrl);
|
const bytes = await fetchBytes(fetchUrl);
|
||||||
return { pngBytes: await toPngBytes(bytes, fetchUrl), debugLabel: fetchUrl };
|
return { pngBytes: await toPngBytes(bytes, fetchUrl), debugLabel: fetchUrl };
|
||||||
} catch {
|
} catch {
|
||||||
@@ -3975,7 +3976,7 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
|
|||||||
// Assets
|
// Assets
|
||||||
// Prefer a raster logo for reliability (sharp SVG support can vary between environments).
|
// Prefer a raster logo for reliability (sharp SVG support can vary between environments).
|
||||||
const logoPng =
|
const logoPng =
|
||||||
(await loadEmbeddablePng('/logo.png')) || (await loadEmbeddablePng('/logo.svg'));
|
(await loadEmbeddablePng('/logo-black.png')) || (await loadEmbeddablePng('/logo.png'));
|
||||||
const logoImage = logoPng ? await pdfDoc.embedPng(logoPng.pngBytes) : null;
|
const logoImage = logoPng ? await pdfDoc.embedPng(logoPng.pngBytes) : null;
|
||||||
|
|
||||||
// Some products have no product-specific images.
|
// Some products have no product-specific images.
|
||||||
@@ -4321,9 +4322,8 @@ async function generatePDF(product: ProductData, locale: 'en' | 'de'): Promise<B
|
|||||||
const firstColLabel = locale === 'de' ? 'Adern & Querschnitt' : 'Cores & cross-section';
|
const firstColLabel = locale === 'de' ? 'Adern & Querschnitt' : 'Cores & cross-section';
|
||||||
|
|
||||||
for (const t of tables) {
|
for (const t of tables) {
|
||||||
// Maintain a minimum space between tables (even when staying on the same page).
|
// Only apply top margin if we aren't at the very start of the page
|
||||||
// This avoids visual collisions between the previous table and the next meta header.
|
if (hasRenderedContent && y - 10 >= contentMinY) y -= 10;
|
||||||
if (hasRenderedContent && y - 24 >= contentMinY) y -= 24;
|
|
||||||
|
|
||||||
// Check if we need a new page for this voltage table
|
// Check if we need a new page for this voltage table
|
||||||
// Estimate: meta block (if shown) + table header + at least 3 data rows
|
// Estimate: meta block (if shown) + table header + at least 3 data rows
|
||||||
|
|||||||
Reference in New Issue
Block a user