php - MPDF not supporting image/icon rotation
762
I would like to generate a PDF from my HTML script.Now the script is
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<div ><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-1" x="330" y="117" angle="240.59253473738065" scalex="1" scaley="1"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" height="136.2166748046875" width="136.2166748046875"><polygon fill="rgba(51,122,183,1)" stroke="rgba(51,122,183,0.99)" stroke-width="1" points="96,100 50,5 4,100" width="136.2166748046875" height="136.2166748046875"></polygon></svg></div></div>');
$mpdf->Output();
?>
But the problem is here the triangle icon is showing without rotation.
Answer
Solution:
Save your SVG to a file and link it through an
img
element which supports CSStransform: rotate
property:See more on supported CSS in the documentation.
Answer
Solution:
You may want to try PrinceXML - it is a Linux command-line tool specifically designed to convert HTML + CSS into print-ready PDF. There is a PHP wrapper class and I usually use it like this