NYCPHP Meetup

NYPHP.org

[nycphp-talk] PDF mailing labels in PHP 5

Dan Cech dcech at phpwerx.net
Fri Sep 9 17:24:57 EDT 2005


David,

I have used the pdf class extensively under php4, but not php5.

I'd definitely spend a little time trying to figure out exactly what is 
going wrong in php5, as it seems this wonderful class is receiving very 
little of the love it deserves at present.

To get some idea of why the output may be munged, you could try using 
this debugging code:

// debugging
$pdf->ezText("\n\n".$pdf->messages,10,array('justification'=>'left'));
$pdfcode = $pdf->output(1);
$pdfcode = str_replace("\n","<br />\n",htmlspecialchars($pdfcode));
echo '<html><body>';
echo trim($pdfcode);
echo '</body></html>';
exit();

Dan

David Mintz wrote:
> I want to generate standard Avery #5160 mailing labels with data from a
> MySQL db. I have done this using Perl modules but I want to use PHP (can't
> seem get Perl DBD:mysql installed and communicating with MySQL 4.1)
> 
> So I tried running the example that comes with the label-making subclass
> of class.ezpdf.php found at http://www.ros.co.nz/pdf/user.php and the
> resulting output file is somehow corrupt, but I haven't succeeded in
> debugging the problem any better than that. I am running PHP 5.0.4. I
> thought, gee let's try it on a PHP 4 server. Bingo.
> 
> Question is, to anyone who's familiar with this class, is this a PHP 5
> compatibility problem, or is the fact that I was lucky on one box but not
> the other just luck?
> 
> Or:  does anyone know of another good solution for making labels? I
> suppose possible solutions are: install PHP 4 to run in cgi mode and use
> this code as is, or fix it to run under PHP 5.
> 
> ---
> David Mintz
> http://davidmintz.org/



More information about the talk mailing list