duanbichou4942 2015-10-26 15:20
浏览 110
已采纳

mPDF&char没有编码,我怎么办?

mPDF not convert the character ' & ' and makes all that follows is not translatable . the pdf is generated but all the code following the character ' & ' is not printed . this is my code:

<table>
    <tr>
        <p>test example & test example</p>
    </tr>
</table>

i use this php code to create the pdf output:

<?php
$divcontent = $_POST['divcontent'];
$html='<html><head></head><body style="background-color:#FFFFFF;height:100%; width:100%;">';
$html.= $divcontent;
$html.='</body></html>';
//==============================================================

include(dirname(__FILE__)."/../../libs/MPDF57/mpdf.php");
@$mpdf=new mPDF('c');
@$mpdf->SetDisplayMode('fullpage');
@$stylesheet = file_get_contents(realpath(dirname(__FILE__)."/../..")."/css/style.css");
$mpdf->setFooter('{PAGENO}');
@$mpdf->WriteHTML($stylesheet,1);
@$mpdf->WriteHTML($html);

$rand = rand();
@$mpdf->Output(realpath(dirname(__FILE__)."/../..")."/file.pdf",'F');
?> 
  • 写回答

3条回答 默认 最新

  • duanpai6581 2015-11-11 07:49
    关注

    After days I found the problem. The ajax call not coded character and now adding "encodeURIComponent (divcontent)" and passing the result to the php function, should not use "html_entity_decode", mPDF print special characters such as "&".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题