title: How to integrate TCPDF?
body: <p>I wanted to add TCPDF to codeigniter so i downloaded TCPDF from <a href="http://sourceforge.net/projects/tcpdf/files/" rel="nofollow noreferrer">TCPDF Download</a> and created a file in /libraries/Pdf.php as such 
      
  
  <pre><code>require_once dirname(__FILE__) . '/tcpdf/tcpdf.php';
  
  class Pdf extends TCPDF
  {
      function __construct()
      {
          parent::__construct();
      }
  }
  </code></pre>
  
  <p>and used it as such in controller</p>
  
  <pre><code>function pdfTest(){
  
          $this-&gt;load-&gt;library("Pdf");
          $pdf = new Pdf('P', 'mm', 'A4', true, 'UTF-8', false);
          $pdf-&gt;SetCreator(PDF_CREATOR);
              // Add a page
              $pdf-&gt;AddPage();
              $html = "&lt;h1&gt;Test Page&lt;/h1&gt;";
              $pdf-&gt;writeHTML($html, true, false, true, false, '');
              $pdf-&gt;Output();
          }
  </code></pre>
  
  <p>But it gives me below error</p>
  
  <pre><code>TCPDF ERROR: Some data has already been output, can't send PDF file
  </code></pre>
  
  <p>What could be the reason of the error and how can I solve it? I have searched allot but couldn't find a solution. 
  Thank you guys in advance.</p>