duanfen2008 2019-07-16 17:42
浏览 419

我尝试添加图片时未加载pdf

I'm trying to use mpdf and it works fine with text but when I try to add an image to my pdf file the page is infinitely loading and nothing happens. I just see the browser page. When I delete the image, it works fine again and pdf file is created and could be downloaded.

The path to the image is right, I checked on the other simple view page without mpdf. Here is current result that I see when add an image: (https://i.ibb.co/KyfmvpN/2019-07-16-23-39-14.png)

I will be glad for any help, please!

Here is the controller:

public function actionCreateMPDF()
{
  $mpdf = new mPDF();
  $mpdf->WriteHTML($this->renderPartial('mpdf'));
  $mpdf->Output();
  exit;
}

public function actionForceDownloadPdf()
{
 $mpdf = new mPDF();
 $mpdf->WriteHTML($this->renderPartial('mpdf'));
 $mpdf->Output('MyPDF.pdf', 'D');
 exit;
}

and the view file where I am creating my pdf mpdf.php:

<p>Hello</p> 
<img src="/images/top.png">

  • 写回答

1条回答 默认 最新

  • dongshi7433 2019-07-18 11:44
    关注

    I fixed this problem by deleting the width:100% from the div(where img tag was located) style and putting it directly to the img tag styling.

    评论

报告相同问题?

悬赏问题

  • ¥50 comsol稳态求解器 找不到解,奇异矩阵有1个空方程返回的解不收敛。没有返回所有参数步长;pid控制
  • ¥15 怎么让wx群机器人发送音乐
  • ¥15 fesafe材料库问题
  • ¥35 beats蓝牙耳机怎么查看日志
  • ¥15 Fluent齿轮搅油
  • ¥15 八爪鱼爬数据为什么自己停了
  • ¥15 交替优化波束形成和ris反射角使保密速率最大化
  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功