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 汇编语言除法溢出问题
  • ¥50 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗