doupian9798 2017-06-05 03:26 采纳率: 100%
浏览 466

dompdf图像不起作用

The images do not appear loop. Only the first image appears the rest does not.

$namePic = "";
    foreach($_POST['ck'] as $ck){
        $namePic.= $ck.", ";
        $namesPic = explode(",", $namePic);
    }

$dompdf = new DOMPDF();
$html = "";

    for($i = 0; $i < $count; $i ++){
       $html.= "<html><head><style type='text/css'> </style></head><body><div style=\"page-break-after: always;\"><p align=\"center\"><img src=\"../folder/images/$namePic[$i]\" ></p></div>";
    }

$html.= "</body></html>";

$dompdf->load_html($html);
$dompdf->set_paper("a4", "portrail");
$dompdf->render();
$pdf = $dompdf->output();
$folder = "../sample.pdf";
file_put_contents($folder,$pdf);

With this I can generate the pdf, but it does not show all the images of the loop shows only the first image. How can I do to show all the images in my loop?

  • 写回答

1条回答 默认 最新

  • dongwei3120 2017-06-13 15:08
    关注

    Just remove your var $namePic[$i] from your string and use concatenation

    $html.= "<html><head><style type='text/css'> </style></head><body><div style=\"page-break-after: always;\"><p align=\"center\"><img src=\"../folder/images/".$namePic[$i]."\" ></p></div>";
    
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料