This is an archived forum post. The information may be outdated. Contact us if you have any questions.
/* loop over urls and generate pdfs */ $pdfs = array(); for($i=0; $i<count($urls); $i+=1) { $pdf = $client->convertURI($urls[$i]); /* save the pdf to a temp file */ $pdf_path = "/tmp/".$unique_orderid."_".$i.".pdf"; $fp = fopen($pdf_path, "wb"); fwrite($fp, $pdf); fclose($fp); /* remember the temp file */ $pdfs[] = $pdf_path; } /* output HTTP headers */ header("Content-Type: application/pdf"); header("Cache-Control: no-cache"); header("Accept-Ranges: none"); header("Content-Disposition: attachment; filename=\"".$title.".pdf\""); /* merge */ $pdf_files = join(" ", $pdfs); passthru("pdftk ".$pdf_files." cat output -"); /* delete the temp files */ foreach($pdfs as $fpath){ unlink($fpath); }