我看到代码Combine JPG's into one PDF with PHP,但我需要动态组合jpg到一个pdf可以做到吗?
$totalFile = count($resultJ);
foreach ($resultJ as $key) {
$runPage = substr("000" . $i, -3);
$name = "pages-$runPage.jpg";
$images[$cThumb->writeToImageFile($key->{path} . $key->{uid})]; // on fly
$i++;
}
//$images = array("file1.jpg", "file2.jpg");
//
$pdf = new Imagick($images);
$pdf->setImageFormat('pdf');
$pdf->writeImages('combined.pdf', true);