title: Adding vertical text with fpdf/fpdi in php
body: <p>I have a script that builds up a multi page pdf from a database blob. This pdf works and outputs fine current but I need to add a vertical line of text down the left hand side of each page. I have managed to get this to work for some of the pdfs but for some I get a corrupted file error. Does anyone have a different way of adding vertical text I can try using fpdf/fpdi.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>function buildBSIPDF($filename){
  global $supplier;
  
  $pdf = new FPDI();
  $i = 1;
  $pagecount = $pdf-&gt;setSourceFile($filename);
  
  //create text to append
  $sideline = "Some text here";
  
  while($i &lt;= $pagecount){
  
      //$pdf-&gt;setSourceFile($filename); 
      // import page 1 
      $tplIdx = $pdf-&gt;importPage($i); 
      //use the imported page and place it at point 0,0; calculate width and height
      //automaticallay and ajust the page size to the size of the imported page 
  
      //$s = $pdf-&gt;getTemplatesize($tplidx); 
      $pdf-&gt;AddPage();
      $pdf-&gt;useTemplate($tplIdx); 
  
      // now write some text above the imported page 
      $pdf-&gt;SetFont('Arial', '', '12'); 
      $pdf-&gt;SetTextColor(0,0,0);
      //set position in pdf document
      $pdf-&gt;SetXY(20, 20);
      //first parameter defines the line height
      $pdf-&gt;RotatedText(5,250,$sideline,90);
      $i++;
  }
  $pdf-&gt;Output($filename, 'F');
  </code></pre>
  
  <p>}</p>