[英]Generate PDF using svg raw data in php
Is it possible to generate pdf using svg raw data (getting from fabric js) on php side? 是否有可能在php端使用svg原始数据(从fabric js获取)生成pdf?
I have searched a bit and found this example: 我搜索了一下,找到了这个例子:
https://tcpdf.org/examples/example_058/ 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? 但它的svg图像除外,而不是svg原始数据,那么如何使用php在服务器端使用svg原始数据生成pdf?
Just pass your svg
raw data to ImageSVG
只需将svg
原始数据传递到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);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.