dqu92800 2017-11-23 07:21
浏览 220

使用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?

  • 写回答

1条回答 默认 最新

  • duansha8764 2017-11-23 07:50
    关注

    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);
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度