【问题标题】:Not rendering svg file in TCPDF不在 TCPDF 中呈现 svg 文件
【发布时间】:2015-02-24 08:19:05
【问题描述】:

我正在使用 tcpdf 导出页面。但我在 ImageSVG tcpdf.svg 文件无法正确渲染中挣扎。我的 svg 文件是

<svg width="525" height="300" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">

 <g display="" id="front">
  <title>Front 1</title>
  <rect stroke-width="3" stroke="#000000" fill="#FFF" id="svg_1" height="166" width="166" y="45" x="291"></rect>
  <rect stroke-dasharray="null" stroke-width="3" stroke="#000000" fill="#FFF" id="svg_2" height="150" width="131" ry="50" rx="50" y="56" x="158"></rect>
  <ellipse ry="58" rx="57" stroke-dasharray="null" stroke-width="3" stroke="#000000" fill="#FFF" id="svg_3" cy="134" cx="101"></ellipse>
  <line fill="none" stroke-dasharray="null" stroke-width="3" stroke="#000000" id="svg_4" y2="232" x2="41" y1="30" x1="43"></line>
  <g text="New Text" class="textBox">
   <rect stroke-dasharray="5,5" stroke-width="0" stroke="#22C" fill="none" id="svg_5" height="20" width="120" y="50" x="50"></rect>
   <line stroke-width="0" stroke="#000" class="caret" y2="68" x2="50" y1="50" x1="50"></line>
   <text xml:space="preserve" text-decoration="none" text-anchor="undefined" font-style="undefined" font-weight="undefined" font-family="serif" font-size="18" fill="#000000" y="65" x="50">New Text</text>
  </g>
  <object type="image/png" data="base64,encrypted string" id="svg_6" height="204.999989" width="121" y="23.000009" x="309"></image>
 </g>
</svg>



$imag='images/saved_image.svg';
$pdf->ImageSVG($imag, $x=0, $y=0, $w=100, $h=50, $link='', $align='', $palign='', $border=1, $fitonpage=false);

我在 svg 文件中使用了图像标签和对象标签。但不工作。帮帮我

【问题讨论】:

    标签: php svg tags tcpdf


    【解决方案1】:

    &lt;object&gt; 元素对 SVG 文件无效。

    如果您尝试包含图像,则应使用&lt;image&gt;。但是我不知道 TCPDF 是否处理数据 URL。

    【讨论】:

      猜你喜欢
      • 2023-03-14
      • 1970-01-01
      • 2015-12-08
      • 2014-11-24
      • 2013-05-07
      • 2015-05-07
      • 2021-04-17
      • 2011-03-25
      • 2016-12-31
      相关资源
      最近更新 更多