Reputation: 585
I have searched for a while and can not find a clear answer to this.
I have a folder with images: 001.png, 002.png ....etc.
what I have tried.
$allImages = 'folder/001.png folder/002.png folder/003.png';
//and
$allImages = 'folder/001.png,folder/002.png,folder/003.png';
//and
$allImages = '-adjoin folder/001.png -adjoin folder/002.png -adjoin folder/003.png';
then:
exec(convert $allImages folder/newdoc.pdf);
//and
exec(convert -density 150 -format pdf{} ".$all_images folder/newdoc.pdf);
This only puts one page into the pdf and the pdf has a header of png so it really is not readable by a pdf viewer.
I do not want to use (convert *.png newdoc.pdf) as i need the pdf in a certain sequence. EDIT: this does not work either.
Upvotes: 3
Views: 6082
Reputation: 5206
You can use mPDF. All the information you need is here: mPDF Github project
Upvotes: 3
Reputation: 2500
You need to look into this old question
How can I convert a series of images to a PDF from the command line on linux?
you can use imagemagick for this.
Upvotes: 0
Reputation: 95
FPDF is all need, see this tutorial page: http://www.fpdf.org/en/tutorial/tuto2.htm And here you can find the manual: http://www.fpdf.org/en/doc/index.php
Do something similar like this example:
<?php
require_once('fpdf.php');
$pdf = new FPDF('P', 'mm', 'A4');
$pdf->AddPage();
foreach($pictures as $picture) {
$pdf->Image($image,'0','0');
$pdf->Ln();
}
$pdf->Output();
?>
Upvotes: 1
Reputation: 1246
From looking at imagemagick.org I would conclude it to work like this:
$allImages = '-adjoin folder/001.png -adjoin folder/002.png -adjoin folder/003.png';
exec("convert $allImages folder/newdoc.pdf");
Upvotes: 1