feat(pdf): generate PNG assets from SVG logos, use -com variant in footer

- Generated 24 PNGs (128/256/512/1024) from 6 SVG logos into public/assets/
- PDF footer now uses faunosteo-horizontal-com (with .com branding)
- Simplified logo.ts: both logos are pre-rasterized PNGs, removed SVG
  rasterization code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.6 committed 2026-05-27 07:02:40 +02:00
1 parent 710171afda
commit f1c639d93e
26 files changed
+7 -73

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

+1 -1
View File
@@ -106,7 +106,7 @@ export async function exportReportToPdf(
let logoPdfImage = null
let zqLogoPdfImage = null
try {
const logoPngBytes = await loadFaunosteoLogo(400)
const logoPngBytes = await loadFaunosteoLogo()
logoPdfImage = await pdfDoc.embedPng(logoPngBytes)
} catch (err) {
console.warn('Faunosteo logo embed failed:', err)
+6 -72
View File
@@ -1,82 +1,16 @@
const FAUNOSTEO_LOGO = '/logo-horizontal.svg'
const FAUNOSTEO_LOGO = '/assets/faunosteo-horizontal-com-512.png'
const ZENQUALITY_LOGO = '/brand/zenquality-logo-fr.png'
async function rasterizeSvgToCanvas(
svgString: string,
width: number,
height: number,
): Promise<HTMLCanvasElement> {
const doc = new DOMParser().parseFromString(svgString, 'image/svg+xml')
const root = doc.documentElement
if (!root.getAttribute('xmlns')) {
root.setAttribute('xmlns', 'http://www.w3.org/2000/svg')
}
if (!root.getAttribute('width')) root.setAttribute('width', String(width))
if (!root.getAttribute('height')) root.setAttribute('height', String(height))
const normalized = new XMLSerializer().serializeToString(root)
const blob = new Blob([normalized], { type: 'image/svg+xml;charset=utf-8' })
const url = URL.createObjectURL(blob)
const img = new Image()
img.decoding = 'sync'
img.crossOrigin = 'anonymous'
try {
await new Promise<void>((resolve, reject) => {
img.onload = () => resolve()
img.onerror = () => reject(new Error('Failed to rasterize logo SVG'))
img.src = url
})
} finally {
URL.revokeObjectURL(url)
}
const canvas = document.createElement('canvas')
canvas.width = width
canvas.height = height
const ctx = canvas.getContext('2d')
if (!ctx) throw new Error('Canvas 2D context unavailable')
ctx.drawImage(img, 0, 0, width, height)
return canvas
}
async function canvasToPng(canvas: HTMLCanvasElement): Promise<Uint8Array> {
const blob = await new Promise<Blob | null>((resolve) => {
canvas.toBlob((b) => resolve(b), 'image/png')
})
if (blob) return new Uint8Array(await blob.arrayBuffer())
const dataUrl = canvas.toDataURL('image/png')
const comma = dataUrl.indexOf(',')
const binary = atob(dataUrl.slice(comma + 1))
const bytes = new Uint8Array(binary.length)
for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i)
return bytes
}
async function loadSvgLogoPng(
path: string,
widthPx: number,
fallbackViewBox: string,
): Promise<Uint8Array> {
async function fetchPngBytes(path: string): Promise<Uint8Array> {
const resp = await fetch(path)
if (!resp.ok) throw new Error(`Logo fetch failed: HTTP ${resp.status}`)
const svgText = await resp.text()
const vb = svgText.match(/viewBox="([^"]*)"/)
const parts = (vb?.[1] ?? fallbackViewBox).split(/\s+/).map(Number)
const ratio = parts[3] / parts[2]
const heightPx = Math.round(widthPx * ratio)
const canvas = await rasterizeSvgToCanvas(svgText, widthPx, heightPx)
return canvasToPng(canvas)
return new Uint8Array(await resp.arrayBuffer())
}
export async function loadFaunosteoLogo(widthPx: number): Promise<Uint8Array> {
return loadSvgLogoPng(FAUNOSTEO_LOGO, widthPx, '0 0 1070 410')
export async function loadFaunosteoLogo(): Promise<Uint8Array> {
return fetchPngBytes(FAUNOSTEO_LOGO)
}
export async function loadZenqualityLogo(): Promise<Uint8Array> {
const resp = await fetch(ZENQUALITY_LOGO)
if (!resp.ok) throw new Error(`ZQ logo fetch failed: HTTP ${resp.status}`)
return new Uint8Array(await resp.arrayBuffer())
return fetchPngBytes(ZENQUALITY_LOGO)
}