dompdf/php-svg-lib

Matrix transform not working on SVG

raduvarga opened this issue · 1 comments

I am trying to generate a PDF with dompdf which includes a SVG that has a matrix transform at its top level.
The SVG renders correctly in the browser, in the PDF however the matrix transform is not being applied.

In one specific example, the matrix transform "matrix(-1, 0, 0, 1, 0, 0)" is doing a flip on the x axis, however if I replace the matrix with a "scaleX(-1)" transform, this does get applied correctly in the PDF.
Inside the SVG, there are many other matrix transforms that are being respected, so it seems that just the top level one is not working. I have also tried to wrap the SVG with a div that contains that matrix transform, with no success.

Thoughts?

Correction for the above: The "scaleX(-1)" fix only works if I apply it too the "style" of the parent "img" element where the SVG is being shown, it doesn't work on the top level of the SVG itself, nor does it work on the "transform" property of both "img" or "svg".