使用php中的svg原始数据生成PDF

Is it possible to generate pdf using svg raw data (getting from fabric js) on php side?

I have searched a bit and found this example:

https://tcpdf.org/examples/example_058/

but its except svg image not the svg raw data, so how one can generate pdf using svg raw data on server side using php?

Just pass your svg raw data to ImageSVG

$svgRaw = '<svg height="80" width="300">
  <g fill="none">
    <path stroke="red" d="M5 20 l215 0" />
    <path stroke="black" d="M5 40 l215 0" />
    <path stroke="blue" d="M5 60 l215 0" />
  </g>
  Sorry, your browser does not support inline SVG.
</svg>';


$pdf->ImageSVG('@' . $svgRaw, $x=15, $y=30, $w='', $h='', $link='http://www.tcpdf.org', $align='', $palign='', $border=1, $fitonpage=false);

$pdf->Write(0, $txt='', '', 0, 'L', true, 0, false, false, 0);