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(40, 40, 155.28, 90);
//Set up header and footer as recurring object
$headfoot = $pdf->openObject(); //Create object
$pdf->saveState(); //Save document sate
$pdf->addJpegFromFile('../images/logo.jpg', 340, 813, 70, 20); //Add logo
$pdf->setStrokeColor(0, 0.2, 0.4); //Set line color
$pdf->setLineStyle(2, 'round'); //set line style
$pdf->line(155.28, 811.89, 505.28, 811.89); //Add top line
$pdf->line(155.28, 30, 505.28, 30); //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.28, 24, 6, '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(1, 0.4, 0); //Change text color
$pdf->ezText($title, 20, array('justification' => 'center'));
$pdf->restoreState(); //Color back to black
$pdf->ezSetDy(-50); //Move down 50
$pdf->ezText('by ' . $author, 15, 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($date, 13, array('justification' => 'center'));
$pdf->ezSetDy(-50); //Move down 50
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->ezText($intro, 10, array('justification' => 'full'));
$pdf->ezNewPage(); //New page
//Start rest of document
$pdf->ezStartPageNumbers(505, 24, 6);
$pdf->selectFont('fonts/Helvetica.afm');
$pdf->ezText($body, 10, 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,
Bookmarks