The hardest part of creating a PDF document this way is to keep control of blocks of text. You need to
know the height of a block of text in order to handle pagination correctly in multipage documents.
<?
pdf_save($pdf);
pdf_translate($pdf,0,$page_height);
pdf_scale($pdf,1,-1);
pdf_set_font($pdf, $font , 12, 'winansi');
$leading = pdf_get_value($pdf, "leading");
$height = $inc = 12+$leading;
while(pdf_show_boxed($pdf, $text, $x, $page_height-$y,
$page_width-2*$x, $height, $align,
'blind')!=0)
$height+=$inc;
pdf_restore($pdf);
?>