dpevsxjn809817 2018-07-11 12:41
浏览 118

MPDF不支持图像/图标旋转

I would like to generate a PDF from my HTML script.Now the script is

<?php

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();

$mpdf->WriteHTML('<div class="pageContatiner noSelect ui-droppable slctCon"><div onmousedown="objSelection(this)" ontouchstart="objSelection(this)" id="pmObj-1" class="shape obj" style="width: 136.217px; height: 136.217px; position: absolute; transform: matrix(-0.491017, -0.87115, 0.87115, -0.491017, 0, 0); margin-left: 312px; margin-top: 99px;" x="330" y="117" angle="240.59253473738065" scalex="1" scaley="1"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" height="136.2166748046875" width="136.2166748046875"><polygon class="svgObj" fill="rgba(51,122,183,1)" stroke="rgba(51,122,183,0.99)" stroke-width="1" points="96,100 50,5 4,100" width="136.2166748046875" height="136.2166748046875"></polygon></svg></div></div>');
$mpdf->Output();

?>

But the problem is here the triangle icon is showing without rotation.

  • 写回答

2条回答 默认 最新

  • duanji1899 2018-07-11 14:16
    关注

    You may want to try PrinceXML - it is a Linux command-line tool specifically designed to convert HTML + CSS into print-ready PDF. There is a PHP wrapper class and I usually use it like this

    include_once("./inc/prince.php");
    
    if($template = @file_get_contents($tmpdir.'/temp/deal/custom/show/pr_offer3.htm'))
    {
      // populate/fill placeholders in your template with the real values
      // e.g. $template = str_replace('{PLACE_HOLDER}', $real_value, $template);
    
      // finally generate the PDF and send it to browser - the class offers
      // also possibility to save as file locally on server
      $prince = new Prince('/usr/bin/prince');
      header('Content-Type: application/force-download');
      header('Content-Disposition: attachment;  filename="offer_'.$_REQUEST['id'].'.pdf"');
      header('Content-Transfer-Encoding: binary');
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
      header('Pragma: public');
      ob_end_flush();
      $prince->setHTML(true);
      $prince->setBaseURL('http://my.domain.com'); // to resolve relative URLs in the HTML
      $prince->convert_string_to_passthru($template);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 运动想象脑电信号数据集.vhdr
  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目