Hi all,

I am learning how to create pdf files on the fly with PHP. I am using the R&OS classes, together with Sitepoint's Harry Fuecks PHP book.

I was able to make the pdf file, but:
-in IE I get lots of weird characters, in FF it works fine. I have already reset everything, restarted, etc, doesn't work.
-My first page does not show the logo, and the text disappears when I scroll down and up again. The text on page two and three stays ok.

Can anyone help me or give me some points to look for?

Below is the code of the file:

PHP Code:
<?php
error_reporting
(E_ALL E_NOTICE);

include 
'class.ezpdf.php';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>

<?php

//Set up general info
$title 'Allthegigs.com - Concert Reviews';
$author 'Michel';
$producer 'Allthegigs.com';
$articleurl 'http://www.allthegigs.com';
$date '12 Juni 2007';

$intro file('intro.txt');
$intro implode('',$intro);

$body file('body.txt');
$body implode('',$body);

//New pdf file
$pdf = new Cezpdf();

//Add doc information
$pdf->addInfo('Title'$title);
$pdf->addInfo('Author'$author);
$pdf->addInfo('Producer'$producer);
$pdf->addInfo('CreationDate'$date);

//Set size in points (1 point = 1/72 of an inch)
$pdf->ezSetMargins(4040155.2890);

//Set up header and footer as recurring object
$headfoot $pdf->openObject(); //Create object
$pdf->saveState(); //Save document sate
$pdf->addJpegFromFile('../images/logo.jpg'3408137020); //Add logo
$pdf->setStrokeColor(00.20.4); //Set line color
$pdf->setLineStyle(2'round'); //set line style
$pdf->line(155.28811.89505.28811.89); //Add top line
$pdf->line(155.2830505.2830); //Add bottom line
$pdf->restoreState(); //Restore document state
$pdf->closeObject(); // Close the object

//Set up bottom link object
$bottomurl $pdf->openObject(); //Create object
$pdf->saveState();
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->addText(155.28246'Found at: ' .$articleurl);
$pdf->restoreState();
$pdf->closeObject();

//Add the $headfoot object to every page
$pdf->addObject($headfoot'all'); //Add to all pages

//Add the bottom url to even pages
$pdf->addObject($bottomurl'even');

//Add the title page
$pdf->selectFont('fonts/Helevetica-Bold.afm');
$pdf->ezSetY(650); //Set current Y-position
$pdf->saveState();
$pdf->setColor(10.40); //Change text color
$pdf->ezText($title20, array('justification' => 'center'));
$pdf->restoreState(); //Color back to black
$pdf->ezSetDy(-50); //Move down 50
$pdf->ezText('by ' $author15, array('justification' => 'center')); //Author
$pdf->ezSetDy(-50); //Move down 50
$pdf->ezText("c:alink:" $articleurl ">" $articleurl "</c:alink>" 11, array ('justification' => 'center'));
$pdf->ezSetDy(-50); //Move down 50
$pdf->ezText($date13, array('justification' => 'center'));
$pdf->ezSetDy(-50); //Move down 50
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->ezText($intro10, array('justification' => 'full'));
$pdf->ezNewPage(); //New page

//Start rest of document
$pdf->ezStartPageNumbers(505246);
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->ezText($body10, array('justification' => 'full'));

//Display the document
$pdf->ezStream();


$pdf->ezText("\n\n".$pdf->messages,10,array('justification'=>'left'));
  
if (isset(
$d) && $d){
  
$pdfcode $pdf->output(1);
  
$end_time getmicrotime();
  
$pdfcode str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
  echo 
'<html>';
  echo 
trim($pdfcode);
  echo 
'</body>';
} else {
  
$pdf->stream();
}
?>

</body>
</html>
Kind regards,
Michel