View Single Post
Old Oct 30th, 2005, 11:36 AM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
For those who need to do what I needed to do (print good-looking reports or summaries of page content), you might want to try pdf-php. This prepares .pdf pages in a VERY simple manner, using objects. You download this thing, unzip it, and put it in a directory. There is no need for "installation" on a server, or even for modifying the php .ini file. In other words, you can move this up to a site you have no server control over, and use it. It's free. You can find it here. The attached images show the original portion of the web page containing the data, and the resulting pdf output. Here's what the code looks like (disregarding the DB query and other PHP code):
$doc =& new Cezpdf ();
$doc->selectFont('pdf/fonts/Helvetica.afm');
$doc->ezSetMargins(30, 60, 30, 30);
$doc->ezStartPageNumbers (300,15,10,'','',1);
$doc->ezText ($letterhead, "16", array ("justification" => "center"));
$doc->ezSetDy (-5);
$doc->ezText ($header, "14", array ("justification" => "center"));
$doc->ezText ($reportdate, "10", array ("justification" => "center"));
$doc->ezSetDy (-5);
$doc->ezText ($title, "14", array ("justification" => "center"));
$doc->ezText ($sort, "12", array ("justification" => "center"));
$doc->ezSetDy (-10);
$doc->ezColumnsStart();
$doc->ezTable ($theArray, $cols, "", array ('width' => '250', 
	'cols' => array ('ytdnew'   => array ('justification' => 'right'),
					 'ytdused'  => array ('justification' => 'right'),
					 'ytdtotal' => array ('justification' => 'right'))));
$doc->ezStream ();
I am suitably impressed.
Attached Images
File Type: jpg webpage.jpg (15.1 KB, 35 views)
File Type: jpg report.jpg (12.7 KB, 35 views)
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote