title: Bloated PDF created by TCPDF
body: <p>In a web app developed in PHP we are generating Quotations and Invoices (which are very simple and of single page) using TCPDF lib.</p>
  
  <p>The lib is working just great but it seems to generate very large PDF files. For example in our case it is generating PDF files as large as 4 MB (+/- a few KB).</p>
  
  <p>How to reduce this bloating of PDF files generated by TCPDF?</p>
  
  <p>Here is code snippet that I am using</p>
  
  <pre><code>ob_start();
                  include('quote_view_bag_pdf.php'); //This file is valid HTML file with PHP code to insert data from DB
                  $quote = ob_get_contents();  //Capture the content of 'quote_view_bag_pdf.php' file and store in variable
  
                  ob_end_clean();
  
                  //Code to generate PDF file for this Quote
                  //This line is to fix a few errors in tcpdf
                  $k_path_url='';
  
  
                  require_once('tcpdf/config/lang/eng.php');
                  require_once('tcpdf/tcpdf.php');
  
                  // create new PDF document
                  $pdf = new TCPDF();
  
                  // remove default header/footer
                  $pdf-&gt;setPrintHeader(false);
                  $pdf-&gt;setPrintFooter(false); 
  
                  // add a page
                  $pdf-&gt;AddPage();
  
                  // print html formated text
                  $pdf-&gt;writeHtml($quote, true, 0, true, 0); //Insert Variables contents here.
  
                  //Build Out File Name
                  $pdf_out_file = "pdf/Quote_".$_POST['quote_id']."_.pdf";
  
                  //Close and output PDF document
                  $pdf-&gt;Output($pdf_out_file, 'F');
                  $pdf-&gt;Output($pdf_out_file, 'I');
                  ///////////////
  enter code here
  </code></pre>
  
  <p>Hope this code fragment will give some idea?</p>