Bill MacKenty

  Home     Computing     Teaching     Bushcraft     Games     Writing     About  

The Many Hells of PDF’s and PHP

Posted in Blogging Educational Tech on 01 - February 2010 at 05:58 PM (14 years ago). 399 views.

If you want to create a PDF from PHP you use a fairly simple PHP library.  The benefits are obvious: you can have ubiquitous PDF generated from dynamic data, which is fun and nice - especially for report cards.

But, because PDF’s are PDF’s, you have to EXACTLY specify where you want text to go - on an X - Y coordinate grid. This makes creating complex reports exceedingly painful.  Once the report is done, you can dance your “I’m so happy THIS is over” dance. But until then, you need to place text, test, change, place text, test, change, yadda yadda yadda.

Here’s an example:

PDF_set_text_pos($p, 50, 700);
PDF_show($p, “Hello world!”);

This is a simple example, imagine a full page with tables, descriptions, etc… It really is a pain in the neck.

Three guesses what I’m working on today, and the first two don’t count.