tcpdf 无法在 svg 文件中绘制破折号线
tcpdf cant draw dasharry line in svg file
我有一个 svg 字符串,我在其中画了一条 dasharry 线 我想用 tcpdf 在 pdf 文件中绘制它 library.when 我在 svg 字符串中使用 px 单位一切正常,但我需要我的单位是 Cm,当我将单位更改为 Cm 时,它画了一条线而不是 dasharry Line.I 搜索网络,但我找不到任何对我有帮助的东西。
我的svg代码
<svg height="29.7cm" width="21cm" viewBox="0 0 210 297" >
<g style="stroke-width:10;stroke:red;fill:none">
<path style="stroke-dasharray:10,20;" d="M 10 10 10 600" />
</g>
</svg>
和我的 php 代码
$pdf->ImageSVG('@'.$g,$x=0,$y=0,$w='',$h='',$link='', $align='', $palign='', $border=0, $fitonpage=false,false);
我找到了我的答案。应该替换
$dash_string .= sprintf('%F', $this->getHTMLUnitToUnits($v, 0, $this->svgunit, false));
与
$dash_string .= sprintf('%F', $v);
在SetLineStyle
方法中TCPDF
Class,
我有一个 svg 字符串,我在其中画了一条 dasharry 线 我想用 tcpdf 在 pdf 文件中绘制它 library.when 我在 svg 字符串中使用 px 单位一切正常,但我需要我的单位是 Cm,当我将单位更改为 Cm 时,它画了一条线而不是 dasharry Line.I 搜索网络,但我找不到任何对我有帮助的东西。
我的svg代码
<svg height="29.7cm" width="21cm" viewBox="0 0 210 297" >
<g style="stroke-width:10;stroke:red;fill:none">
<path style="stroke-dasharray:10,20;" d="M 10 10 10 600" />
</g>
</svg>
和我的 php 代码
$pdf->ImageSVG('@'.$g,$x=0,$y=0,$w='',$h='',$link='', $align='', $palign='', $border=0, $fitonpage=false,false);
我找到了我的答案。应该替换
$dash_string .= sprintf('%F', $this->getHTMLUnitToUnits($v, 0, $this->svgunit, false));
与
$dash_string .= sprintf('%F', $v);
在SetLineStyle
方法中TCPDF
Class,