Zend PDF and PHP: Drawn text has another position each time its drawn?

StackOverflow https://stackoverflow.com/questions/12263759

  •  30-06-2021
  •  | 
  •  

سؤال

I am using Zend PDF to draw text, like this:

$page->drawText('Hinweis: ' . $note, $this->getAlignCenter('Hinweis: ' . $note, 66, 100, $font, $fontSize), $this->y, 'UTF-8');

According to how long $note is, the text is placed somewhere else. How could I always align the complete text like 30px from the left border?

هل كانت مفيدة؟

المحلول

getAlignCenter() calculates the position in which the text needs to be in order to be center aligned. If you simply want to left align it, provide the desired x coordinate instead of using getAlignCenter().

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top