title: Convert HTM to PDF using PHP - FPDF, DOMPDF, TCPDF, HTML2PDF
body: <p>I am trying to convert an html code which has tables and background images to pdf. I have used fpdf, dompdf, tcpdf and html2pdf available on internet. I can either use tables or div tags with background properties, width etc. It converts the html to pdf but does not pickup many attributes like background image, width, height, etc.</p>
  
  <p>Is there a code which i can use to make pdf as it is displayed in html.</p>
  
  <p>In using div tags i have seen it displays data but in vertical way i.e. 1st one will be displayed in line 1 and the others in line 2,3,4,5.</p>
  
  <p>DOMPDF CODE:</p>
  
  <pre><code> &lt;?php
  
  
   Include("dompdf/dompdf_config.inc.php"); 
   $html = &lt;&lt;&lt;'ENDHTML'
  &lt;html&gt;
   &lt;body&gt;
    &lt;div style="position:absolute;top:38;left:89"&gt;&lt;img width="665" height="156" src="daso_template/header.jpg" ALT=""&gt;&lt;/div&gt;
  &lt;div style="position:absolute;top:196;left:84"&gt;&lt;img width="668" height="113" src="daso_template/MB-1.jpg" ALT=""&gt;&lt;/div&gt;
  &lt;div style="position:absolute;top:58;left:326"&gt;&lt;span class="ft0"&gt;  &lt;/span&gt;&lt;/div&gt;
  &lt;div style="position:absolute;top:51;left:381"&gt;&lt;span class="ft1"&gt; Deliverable Authorization Sign-off&lt;/span&gt;&lt;/div&gt;
  &lt;div style="position:absolute;top:120;left:89"&gt;&lt;span class="ft5"&gt;Project No.:&lt;/span&gt;    &lt;/div&gt;
   &lt;/body&gt;
   &lt;/html&gt;
    ENDHTML;
  
  
   $dompdf-&gt;load_html($html);
   $dompdf-&gt;render();
  </code></pre>
  
  <p>This is just one code, it produces a pdf but  not with formatting and background images.</p>
  
  <p>Please do help, appreciate it.</p>
  
  <p>$dompdf->stream("hello.pdf");
      ?></p>