【问题标题】:Insert image in pdf in php using mpdf使用 mpdf 在 php 中插入 pdf 中的图像
【发布时间】:2013-09-05 09:31:29
【问题描述】:

这里,下面是我使用 mpdf 将图像转换为 pdf 的代码。 $html 包含upload/tulips.jpg 但是,当函数执行创建的 pdf 文件时,一个图像图标显示在那里,位置为upload/tulips.pdf。 请告诉我为什么会发生这种情况,因为没有错误出现。

   private function ConvertImageToPdf($inputPath,$outputPath)
            { 
                $mpdf=new mPDF();
                $html='<img src='.$inputPath.'/>';
                $mpdf->WriteHTML($html);
                $mpdf->Output($outputPath.".pdf",'F');
                $mpdf->debug = true;

            }

【问题讨论】:

    标签: php image file pdf mpdf


    【解决方案1】:
    $html='<img src="'.$inputPath.'"/>';
    

    例如"" 围绕图像路径,你应该很好(如果图像存在)

    在 mPDF 包/examples 中有一个example04_images.php 你可以试试。

    PS : 你应该设置$mpdf-&gt;debug = true 之前 $mpdf-&gt;Output()

    【讨论】:

      【解决方案2】:

      是逗号问题

      $html='<img src="'.$inputPath.'"/>';
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-24
        • 1970-01-01
        • 1970-01-01
        • 2014-08-25
        相关资源
        最近更新 更多