title: How to place text next to each other in TCPDF
body: <p>I am currently working on a little license plate generator and I'm trying to place some text, followed by an image and followed by some text again. However, I'm hardcoding all the positioning and it's not working when the data changes (e.g smaller text results in larger space)</p>
  
  <p>My question is, how do I turn my solution into a more general solution. The main issue is that if I have a text with less characters, the text is not being auto aligned and spaced again. I'm not sure why my code is not working. Here's what I wrote:</p>
  
  <pre><code>$left_text_x = 85;
  $left_text_y = 50;
  
  $middle_img_top_x = $left_text_x + 15.8;
  $middle_img_top_y = $y + 0.6;
  
  $middle_img_bottom_x = $left_text_x + 15.3;
  $middle_img_bottom_y = $y + 5.1;
  
  $middle_text_x = $middle_img_bottom_x + 4.7;
  $middle_text_y = $left_text_y;
  
  $right_text_x = $middle_text_x + 11.3;
  $right_text_y = $left_text_y;
  
  //Text
  $pdf-&gt;Text($left_text_x, $left_text_y, 'AAA', false, false, true, 0, 0, '', false, '', 0, false, 'T', 'M', false ); //Left
  $pdf-&gt;Image('../../images/bundesland/Baden-Wurttemberg.png', $middle_img_top_x, $middle_img_top_y, 4, 4, '', '', '', false, 300); //Top img mid
  $pdf-&gt;Image('../../images/plakette/rose.png', $middle_img_bottom_x, $middle_img_bottom_y, 5, 5, '', '', '', false, 300); //Bottom img mid
  
  $pdf-&gt;Text($middle_text_x, $middle_text_y, 'AA', false, false, true, 0, 0, '', false, '', 0, false, 'T', 'M', false ); //Middle
  $pdf-&gt;Text($right_text_x, $right_text_y, 'AAA', false, false, true, 0, 0, '', false, '', 0, false, 'T', 'M', false ); //Right
  </code></pre>
  
  <p>Here are my results:
  <a href="https://i.stack.imgur.com/BoZ8l.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BoZ8l.png" alt="enter image description here"></a></p>
  
  <p>Here's one that gives the unnecessary space:
  <a href="https://i.stack.imgur.com/DPO3Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DPO3Z.png" alt="enter image description here"></a></p>
  
  <p>Here's another one:
  <a href="https://i.stack.imgur.com/jH93p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jH93p.png" alt="enter image description here"></a></p>
  
  <p>So as you can see, the space is not being adjusted automatically although my code looks fine. I know there is a logical error but I can't figure it out.</p>
  
  <p><strong>EDIT: MORE DETAIL ON THE FOLLOWING LINK</strong>
  <a href="https://stackoverflow.com/questions/54893780/tcpdf-text-and-image-positioning">TCPDF Text and Image Positioning</a></p>