if (!file_exists($file1) or !file_exists($file2)){
$soapclient = new
soapclient("http://www.mbeach.com/propservices/index3.php?wsdl",true);//change path as needed
//no chached file so grab info
$passparams = array('id' => $zid);
// invoke the method
//echo "called www.mbeach.com/propservices/index3.php?wsdl with id=15";
$resultoverview=$soapclient->call('GetPropDetails',$passparams);
//ok lets see if this file is in cache
$myimage=explode("/",$pvals[2]);
$imgcnt=count($myimage)-1;
$img1 = $imagepath.$myimage[$imgcnt];
//check for image existience
if (!file_exists($img1)){
$newimage = copy_image($pvals[2],$img1);
if ($newimage==0){$img1="";}
}
}
$img2="";
if ($pvals[4]){
//ok lets see if this file is in cache
$myimage=explode("/",$pvals[4]);
$imgcnt=count($myimage)-1;
$img2 = $imagepath.$myimage[$imgcnt];
//check for image existience
if (!file_exists($img2)){
$newimage = copy_image($pvals[4],$img2);
if ($newimage==0){$img2="";}
}
}
$pdf = new Cezpdf('LETTER','portrait');
$pdf -> ezSetMargins(50,70,50,50);
// put a line top and bottom on all the pages
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0,0,0,1);
$pdf->line(50,40,570,40);
$pdf->addText(60,34,6,'Printed as a service of www.kotis.org');
$pdf->restoreState();
$pdf->closeObject();
// note that object can be told to appear on just odd or even pages by changing 'all' to 'odd'
// or 'even'.
$pdf->addObject($all,'all');
Getting the following error from Adobe Acrobat Reader for the document
http://www.kotis.org/pdfprofile.php?zid=15
'An error exists on this page.....'
For reference the code that generates this looks lke this:
//process config file
include("includes/users.inc");
include('pdflibrary/class.ezpdf.php');
require_once('services/lib/nusoap.php');
$pagecontent="";
$imagepath="services/cache/";//used for photo gallery etc
//cached file location
$dt=date("Ymd");
$yr=date("Y");
$mo= date("n");
$day= date("j");
$thishr=date("G")/6;
$hrincr=ceil($thishr);
$yesterday=date ("Ymd",mktime(0,0,0,$mo,$day-1,$yr) );
$file1=$imagepath."/overview_".$zid."_".$dt."_".$hrincr.".txt";
$file10=$imagepath."/overview_".$zid."_".$yesterday."_".$hrincr.".txt";
$file2=$imagepath."/myfiles_".$zid."_".$dt."_".$hrincr.".txt";
$file20=$imagepath."/myfiles_".$zid."_".$yesterday."_".$hrincr.".txt";
$newf=0;
// no cache results for this property
if (!file_exists($file1) or !file_exists($file2)){
$soapclient = new
soapclient("http://www.mbeach.com/propservices/index3.php?wsdl",true);//change path as needed
//no chached file so grab info
$passparams = array('id' => $zid);
// invoke the method
//echo "called www.mbeach.com/propservices/index3.php?wsdl with id=15";
$resultoverview=$soapclient->call('GetPropDetails',$passparams);
$myfiles=$soapclient->call('GetSiteFiles',$passparams);
unset($soapclient);
//overview info
$pvals=explode("|",$resultoverview);
$pvalcount=count($pvals);
//available files
$availfiles=explode("|",$myfiles);
$availfilescount=count($availfiles);
//do files
$fp2 = @fopen($file1, "w+");//open output file for writing
fwrite($fp2,$resultoverview);//write to file
fclose($fp2);//close file
@chmod($file1,0777);
//remove old cache file
@unlink($file10);
$fp3 = @fopen($file2, "w+");//open output file for writing
fwrite($fp3,$myfiles);//write to file
fclose($fp3);//close file
@chmod($file2,0777);
//remove old cache file
@unlink($file20);
$newf=1;
}
// existing files
if (file_exists($file1) and file_exists($file2) and $newf==0){
$fp = @fopen($file1, "r");
$fsize1=@filesize($file1);
$resultoverview = @fread($fp, $fsize1);
$resultoverview =trim($resultoverview);
fclose($fp);//close file
$fp2 = @fopen($file2, "r");
$fsize2=@filesize($file2);
$myfiles = @fread($fp2, $fsize2);
$myfiles=trim($myfiles);
fclose($fp2);//close file
//overview info
$pvals=explode("|",$resultoverview);
$pvalcount=count($pvals);
//available files
$availfiles=explode("|",$myfiles);
$availfilescount=count($availfiles);
}
$img1="";
if ($pvals[2]){
//ok lets see if this file is in cache
$myimage=explode("/",$pvals[2]);
$imgcnt=count($myimage)-1;
$img1 = $imagepath.$myimage[$imgcnt];
//check for image existience
if (!file_exists($img1)){
$newimage = copy_image($pvals[2],$img1);
if ($newimage==0){$img1="";}
}
}
$img2="";
if ($pvals[4]){
//ok lets see if this file is in cache
$myimage=explode("/",$pvals[4]);
$imgcnt=count($myimage)-1;
$img2 = $imagepath.$myimage[$imgcnt];
//check for image existience
if (!file_exists($img2)){
$newimage = copy_image($pvals[4],$img2);
if ($newimage==0){$img2="";}
}
}
$pdf = new Cezpdf('LETTER','portrait');
$pdf -> ezSetMargins(50,70,50,50);
// put a line top and bottom on all the pages
$all = $pdf->openObject();
$pdf->saveState();
$pdf->setStrokeColor(0,0,0,1);
$pdf->line(50,40,570,40);
$pdf->addText(60,34,6,'Printed as a service of www.kotis.org');
$pdf->restoreState();
$pdf->closeObject();
// note that object can be told to appear on just odd or even pages by changing 'all' to 'odd'
// or 'even'.
$pdf->addObject($all,'all');
$mainFont = 'pdflibrary/fonts/Times-Roman.afm';
$pdf->selectFont($mainFont);
$pdf->ezSetDy(-1);
$pdf->addJpegFromFile('pdflibrary/printerhead.jpg',50,$pdf->y-70,520,0);
$pdf->ezSetDy(-90);
$headtitle="Property Details: $pvals[0]";
//cleanup the text
$headtitle=trim($headtitle);
$headtitle =str_replace("<B>","<b>",$headtitle);
$headtitle =str_replace("</B>","</b>",$headtitle);
$headtitle =str_replace("<br>"," ",$headtitle);
$pdf->setColor(153,0,0);
$pdf->ezText($headtitle,14);
$sitetext = $pvals[1];
//cleanup the text
$sitetext=trim($sitetext);
$sitetext =str_replace("<B>","<b>",$sitetext);
$sitetext =str_replace("</B>","</b>",$sitetext);
$sitetext =str_replace("<SUM>","",$sitetext);
$sitetext =str_replace("<BR><BR>","\n",$sitetext);
$sitetext =str_replace("<BR>","\n",$sitetext);
$sitetext =str_replace("<LI>"," - ",$sitetext);
$sitetext =str_replace("</LI>","",$sitetext);
$sitetext = strip_tags($sitetext);
$sitetext =$sitetext."\n";
$pdf->ezSetDy(-10);
$pdf->setColor(0,0,0);
$pdf->ezText($sitetext,10);
$pdf->ezSetDy(-20);
if($img1){
$pdf->ezImage($img1,0,240,'full','left');
}
if($img2){
$pdf->ezNewPage();
$pdf->ezSetDy(-1);
$pdf->addJpegFromFile($img2,50,50,520,0);
}
$pdf->doPageNumbering();
$pdf->ezStream();
unset($pdf);
exit();