TCPDF icon indicating copy to clipboard operation
TCPDF copied to clipboard

Incorrect SVG rendering in TCPDF since version 6.8.2

Open braukma opened this issue 5 months ago • 4 comments

Description: I noticed that SVG files are no longer rendered correctly starting with TCPDF version 6.8.2. In my test case, a simple green downward arrow SVG is displayed properly in version 6.6.5, but gets distorted in 6.8.2 and 6.10.0.

Steps to reproduce: Use the following minimal PHP script:

AddPage(); $pdf->ImageSVG('@' . $svg, 15, 30, 50, 50, '', '', '', 0, false); $pdf->Output('php://stdout', 'I'); php testpgm.php icon.svg > output.pdf Expected result: A clean green downward arrow. Actual result: Starting with TCPDF 6.8.2, the SVG is rendered incorrectly (see comparison below). Comparison: ✅ TCPDF 6.6.5 → correct rendering ❌ TCPDF 6.8.2 / 6.10.0 → distorted rendering Screenshots: Image ❌ TCPDF 6.8.2 / 6.10.0 → distorted rendering Image ✅ TCPDF 6.6.5 → correct rendering ![Image](https://github.com/user-attachments/assets/52363fe0-2eee-47c7-92d7-4ee9749e9a47) I am not so sure working here in GitHub, but I think I managed to include the SVG as well. I also had the issue with other SVG files (for the record: I use an extension within typo3 CMS that relies on tcpdf). I managed to locate the issue down to tcpdf and with a bit of AI help generated this testcase. Jürgen

braukma avatar Oct 17 '25 11:10 braukma

@braukma Could you please also provide the full source of the SVG file to this issue here?

maechler avatar Oct 17 '25 12:10 maechler

Hi,

sure I can. I tried to include it but maybe I failed. I’ll attach it here. If oit fails again, let me know – I’ll find another way

Mit freundlichen Grüßen Jürgen Braukmann

braukma avatar Oct 17 '25 12:10 braukma

@braukma I think it didn't work. I don't see an image in your second comment and the images in the first comment are only available as PNG.

You could just open the SVG file in a text editor and then copy everything and paste it here. SVG files are XML based.

maechler avatar Oct 17 '25 12:10 maechler

Yes, I know these little basterds are XML. Hoped to manage different. Here we go: (And hope the Character Set won’t interfere ☺)

braukma avatar Oct 17 '25 12:10 braukma