【问题标题】:tcpdf generates square at the and of stringtcpdf 在字符串的 and 处生成正方形
【发布时间】:2017-01-07 15:40:36
【问题描述】:

我对@9​​87654323@ 有疑问。我在字符串末尾收到square。 实际上我正在做的是使用svg 图像生成PDF

这是代码,

$pdf = new TCPDF();
$pdf->AddPage('L', $page_format, false, false);
$pdf->ImageSVG($uploadPath, $x=16, $y=16, $w=$width+$margin, $h=$height+$margin, $link='', $align='', $palign='', $border=0, $fitonpage=false);     
$pdf->output($filename, 'D'); 

它对某些svg 非常有用(我有很多不同字体的svg,所以我们可以说有些字体不生成正方形)。 这是图片

经过一番研究,我修改了svg 图片内容 来自,

<g transform="translate(1189.73 792.69)">
  <text font-family="Arvo" font-size="25" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;">
     <tspan x="-100" y="7.87" fill="rgb(0, 0, 0)">Type Text Here</tspan>
  </text>
</g>

到,

<g transform="translate(1189.73 792.69)">
  <text font-family="Arvo" font-size="25" style="stroke: none; stroke-width: 1; stroke-dasharray: none; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 10; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;"><tspan x="-100" y="7.87" fill="rgb(0, 0, 0)">Type Text Here</tspan></text>
</g>

它对我有用。知道那里发生了什么吗?不确定它的svg 问题或tcpdf

【问题讨论】:

    标签: javascript php css svg tcpdf


    【解决方案1】:

    SVG 没有任何问题,所以它肯定是 TCPDF。您看到的矩形是某些字体在您尝试打印未定义字符时显示的内容。

    由于删除空格后它消失了,我猜 TCPPDF 正在尝试打印回车符 (13) 或其他内容。

    您可能希望将该错误报告给 TCPDF 人员。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-05
      • 2013-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多