fix(pdf): use plain logo in header, -com in footer, enlarge footer logos
- Header: faunosteo_logo_horizontal (no .com) - Footer: faunosteo-horizontal-com (with .com branding) - Footer Faunosteo logo: 60x23 → 80x30 - Footer ZenQuality logo: 50x12 → 70x16 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f1c639d93e
commit
09be33fd84
3 files changed
+23
-11
No files matched your search
+13
-6
@@ -8,7 +8,7 @@ import { addObservationPage } from './render/observationPage'
|
|||||||
import { addConclusionPage } from './render/conclusionPage'
|
import { addConclusionPage } from './render/conclusionPage'
|
||||||
import { attachReportJson } from './attachment'
|
import { attachReportJson } from './attachment'
|
||||||
import { drawFooter } from './render/footer'
|
import { drawFooter } from './render/footer'
|
||||||
import { loadFaunosteoLogo, loadZenqualityLogo } from './render/logo'
|
import { loadFaunosteoLogo, loadFaunosteoComLogo, loadZenqualityLogo } from './render/logo'
|
||||||
import { loadSvg } from '@/anatomy/svgLoader'
|
import { loadSvg } from '@/anatomy/svgLoader'
|
||||||
import { parseSvgBones } from '@/anatomy/svgConvention'
|
import { parseSvgBones } from '@/anatomy/svgConvention'
|
||||||
import { getSpecies } from '@/domain/species/registry'
|
import { getSpecies } from '@/domain/species/registry'
|
||||||
@@ -103,14 +103,21 @@ export async function exportReportToPdf(
|
|||||||
const zoneLabels = await buildZoneLabels(report)
|
const zoneLabels = await buildZoneLabels(report)
|
||||||
const findingsTree = await loadSpeciesFindings(report.animal.speciesId)
|
const findingsTree = await loadSpeciesFindings(report.animal.speciesId)
|
||||||
|
|
||||||
let logoPdfImage = null
|
let headerLogoPdf = null
|
||||||
|
let footerLogoPdf = null
|
||||||
let zqLogoPdfImage = null
|
let zqLogoPdfImage = null
|
||||||
try {
|
try {
|
||||||
const logoPngBytes = await loadFaunosteoLogo()
|
const bytes = await loadFaunosteoLogo()
|
||||||
logoPdfImage = await pdfDoc.embedPng(logoPngBytes)
|
headerLogoPdf = await pdfDoc.embedPng(bytes)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('Faunosteo logo embed failed:', err)
|
console.warn('Faunosteo logo embed failed:', err)
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
const bytes = await loadFaunosteoComLogo()
|
||||||
|
footerLogoPdf = await pdfDoc.embedPng(bytes)
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('Faunosteo -com logo embed failed:', err)
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const zqPngBytes = await loadZenqualityLogo()
|
const zqPngBytes = await loadZenqualityLogo()
|
||||||
zqLogoPdfImage = await pdfDoc.embedPng(zqPngBytes)
|
zqLogoPdfImage = await pdfDoc.embedPng(zqPngBytes)
|
||||||
@@ -118,7 +125,7 @@ export async function exportReportToPdf(
|
|||||||
console.warn('ZenQuality logo embed failed:', err)
|
console.warn('ZenQuality logo embed failed:', err)
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerAssets = { logoPng: logoPdfImage }
|
const headerAssets = { logoPng: headerLogoPdf }
|
||||||
const totalObs = report.observations.length
|
const totalObs = report.observations.length
|
||||||
|
|
||||||
for (let i = 0; i < totalObs; i += 1) {
|
for (let i = 0; i < totalObs; i += 1) {
|
||||||
@@ -137,7 +144,7 @@ export async function exportReportToPdf(
|
|||||||
await addConclusionPage(pdfDoc, report, fonts, locale, headerAssets)
|
await addConclusionPage(pdfDoc, report, fonts, locale, headerAssets)
|
||||||
|
|
||||||
const pages = pdfDoc.getPages()
|
const pages = pdfDoc.getPages()
|
||||||
const footerAssets = { logoPng: logoPdfImage, zqLogoPng: zqLogoPdfImage }
|
const footerAssets = { logoPng: footerLogoPdf, zqLogoPng: zqLogoPdfImage }
|
||||||
pages.forEach((page, idx) => {
|
pages.forEach((page, idx) => {
|
||||||
drawFooter(page, fonts, idx + 1, pages.length, locale, footerAssets)
|
drawFooter(page, fonts, idx + 1, pages.length, locale, footerAssets)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ export function drawFooter(
|
|||||||
const muted = rgb(0.42, 0.39, 0.35)
|
const muted = rgb(0.42, 0.39, 0.35)
|
||||||
const accent = rgb(0.28, 0.56, 0.42)
|
const accent = rgb(0.28, 0.56, 0.42)
|
||||||
|
|
||||||
const logoW = 60
|
const logoW = 80
|
||||||
const logoH = 23
|
const logoH = 30
|
||||||
const rowY = FOOTER_BASE_Y + 14
|
const rowY = FOOTER_BASE_Y + 14
|
||||||
const separatorY = rowY + logoH + 6
|
const separatorY = rowY + logoH + 6
|
||||||
|
|
||||||
@@ -56,8 +56,8 @@ export function drawFooter(
|
|||||||
|
|
||||||
const poweredLabel = `${dict['footer.powered_by']} `
|
const poweredLabel = `${dict['footer.powered_by']} `
|
||||||
const poweredLabelW = fonts.bodyRegular.widthOfTextAtSize(poweredLabel, FONT_SIZE)
|
const poweredLabelW = fonts.bodyRegular.widthOfTextAtSize(poweredLabel, FONT_SIZE)
|
||||||
const zqLogoW = 50
|
const zqLogoW = 70
|
||||||
const zqLogoH = 12
|
const zqLogoH = 16
|
||||||
const zqFallback = 'zenquality.fr'
|
const zqFallback = 'zenquality.fr'
|
||||||
const zqFallbackW = fonts.bodyRegular.widthOfTextAtSize(zqFallback, FONT_SIZE)
|
const zqFallbackW = fonts.bodyRegular.widthOfTextAtSize(zqFallback, FONT_SIZE)
|
||||||
const poweredBlockW = assets.zqLogoPng
|
const poweredBlockW = assets.zqLogoPng
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const FAUNOSTEO_LOGO = '/assets/faunosteo-horizontal-com-512.png'
|
const FAUNOSTEO_LOGO = '/assets/faunosteo_logo_horizontal-512.png'
|
||||||
|
const FAUNOSTEO_COM_LOGO = '/assets/faunosteo-horizontal-com-512.png'
|
||||||
const ZENQUALITY_LOGO = '/brand/zenquality-logo-fr.png'
|
const ZENQUALITY_LOGO = '/brand/zenquality-logo-fr.png'
|
||||||
|
|
||||||
async function fetchPngBytes(path: string): Promise<Uint8Array> {
|
async function fetchPngBytes(path: string): Promise<Uint8Array> {
|
||||||
@@ -11,6 +12,10 @@ export async function loadFaunosteoLogo(): Promise<Uint8Array> {
|
|||||||
return fetchPngBytes(FAUNOSTEO_LOGO)
|
return fetchPngBytes(FAUNOSTEO_LOGO)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function loadFaunosteoComLogo(): Promise<Uint8Array> {
|
||||||
|
return fetchPngBytes(FAUNOSTEO_COM_LOGO)
|
||||||
|
}
|
||||||
|
|
||||||
export async function loadZenqualityLogo(): Promise<Uint8Array> {
|
export async function loadZenqualityLogo(): Promise<Uint8Array> {
|
||||||
return fetchPngBytes(ZENQUALITY_LOGO)
|
return fetchPngBytes(ZENQUALITY_LOGO)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user