php-svg-lib icon indicating copy to clipboard operation
php-svg-lib copied to clipboard

Matrix transform not working on SVG

Open raduvarga opened this issue 4 years ago • 1 comments
trafficstars

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?

raduvarga avatar Dec 18 '20 13:12 raduvarga

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".

raduvarga avatar Dec 18 '20 15:12 raduvarga