This is an archived forum post. The information may be outdated. Contact us if you have any questions.
function createPDF($htmlContent) { $todayDate = date('Y-m-d--H-i-s'); $this->pdfFilename = $this->upload_dir['basedir'] . '/rns/rns--'. $todayDate . '.pdf'; //GET OUTPUT AS STRING AND PUT IN TO SOME FILE echo "<br><br>Creating: ". $this->pdfFilename ."<br>"; try { // create an API client instance $client = new Pdfcrowd($username, $apikey); $out_file = fopen($this->pdfFilename, "wb"); echo "<br>HTML:<br><br>" . $htmlContent . "<br><br><br>"; $client->convertHtml($htmlContent, $out_file); fclose($out_file); } catch(PdfcrowdException $why) { echo "Pdfcrowd Error: " . $why . "<br>"; } }
foreach($this->xml->Announcement as $announcement) { // 3. Filter the 20 that came back by cd_tidm field = "AGR"; if($announcement->attributes()->cd_tidm == 'AGR'){ $this->createPDF($announcement->ht_ann); } }
echo "<br>HTML:<br><br>" . $htmlContent . "<br><br><br>";
file_put_contents('xmlrequest.html', $htmlString); $this->createPDF('xmlrequest.html');
$client->convertFile($htmlContent, $out_file);
$client->convertHTML($htmlContent, $out_file);