Hi all!
At the moment I need to align text to the right (prices of an invoice all
need to align at the right). But how do I do this? I found the following
code:
function get_text_width($text_line,$current_font, $font_size)
{
$glyph_array = array();
$total_item_width = 0;
$text_array = str_split($text_line,1);
foreach($text_array as $character)
{
$glyph_array[] = ord($character);
}
$oPage->drawText($oFont->getUnitsPerEm(), 10, 10);
$text_width = $current_font->widthsForGlyphs($glyph_array);
foreach($text_width as $char_width)
{
$total_item_width = $total_item_width + $char_width;
}
return ($total_item_width/1000)*$font_size;
}
This seems to do SOMEthing, but if I take the right border at 1000 and I
take the result of the function of this, it still isn't aligned at the
right. It seems like the returned value isn't right.
Does anyone have a suggestion on how to correctly align text items to the
right?
Thanks!
--
View this message in context:
http://www.nabble.com/Zend_PDF-right-align-text--tf4509182s16154.html#a12859890
Sent from the Zend Framework mailing list archive at Nabble.com.