Skip to content

Commit b93a9ee

Browse files
Shaun Mahonyclaude
andcommitted
Fix SVG export: add xlink:href for Illustrator compatibility
Illustrator implements SVG 1.1 and requires xlink:href on <image> elements plus the xmlns:xlink namespace declaration on the root. The generated SVG used only the modern href attribute (SVG 2.0), causing embedded PNG logos to not render in Illustrator. Add xmlns:xlink to the <svg> root and xlink:href alongside href on each <image> element. Both attributes are kept so the SVG renders correctly in both browsers (href) and Illustrator (xlink:href). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
1 parent 3f8cde9 commit b93a9ee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

web/src/lib/export/logoRenderer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export function exportLogosAsSvg(
399399
const hasLabels = logos.some((l) => l.label);
400400
const compositeW = (hasLabels ? labelWidth : 0) + maxLogoW;
401401

402-
let svgContent = `<svg xmlns="http://www.w3.org/2000/svg" width="${compositeW}" height="${totalH}" viewBox="0 0 ${compositeW} ${totalH}">\n`;
402+
let svgContent = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${compositeW}" height="${totalH}" viewBox="0 0 ${compositeW} ${totalH}">\n`;
403403
svgContent += `<rect width="100%" height="100%" fill="white"/>\n`;
404404

405405
let y = 0;
@@ -414,7 +414,7 @@ export function exportLogosAsSvg(
414414

415415
const dataUrl = logoCanvas.toDataURL("image/png");
416416
const xOff = hasLabels ? labelWidth : 0;
417-
svgContent += `<image x="${xOff}" y="${y}" width="${lw}" height="${lh}" href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-s1">${dataUrl}"/>\n`;
417+
svgContent += `<image x="${xOff}" y="${y}" width="${lw}" height="${lh}" href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Cspan+class%3D"pl-s1">${dataUrl}" xlink:href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3C%2Fspan%3E%3Cspan+class%3D"pl-s1">${dataUrl}"/>\n`;
418418

419419
y += lh + gap;
420420
}

0 commit comments

Comments
 (0)