title: convert html div or page url to pdf using php
body: <p>I have a HTML code like this:</p>
  
  <pre><code>&lt;div id="invoice"&gt; 
    &lt;div id="invoice-header"&gt; &lt;img alt="Mainlogo_large" class="logo screen" src="http://colosus.com/invoice/images/freeagent_logo.png"&gt; 
      &lt;!-- hCard microformat --&gt; 
      &lt;div class="vcard" id="company-address"&gt; 
        &lt;div class="fn org"&gt;&lt;strong&gt;KIOSBAN.COM&lt;/strong&gt;&lt;/div&gt; 
        &lt;div class="adr"&gt; 
          &lt;div class="street-address"&gt;Gedung Atlantica Lt.4&lt;br&gt;
            Jl. Kuningan Barat No. 7, Mampang&lt;br&gt; 
          &lt;/div&gt; 
          &lt;!-- street-address --&gt; 
          &lt;div class="locality"&gt;Indonesia&lt;/div&gt; 
          &lt;div id="company-postcode"&gt;&lt;span class="region"&gt;Jakarta Selatan&lt;/span&gt; &lt;span class="postal-code"&gt;12710&lt;/span&gt;&lt;/div&gt; 
        &lt;/div&gt; 
        &lt;!-- adr --&gt; 
        &lt;div class="email"&gt;fajar@kiosban.com&lt;/div&gt; 
      &lt;div id="sales-tax-reg-number"&gt;Fajar tampan&lt;/div&gt; 
      &lt;/div&gt; 
      &lt;!-- company-address vcard --&gt; 
    &lt;/div&gt; 
    &lt;!-- #invoice-header --&gt; 
    &lt;div id="invoice-info"&gt; 
      &lt;h2&gt;Invoice &lt;strong&gt;INV001&lt;/strong&gt;&lt;/h2&gt; 
      &lt;h3&gt;21 February 2008&lt;/h3&gt; 
      &lt;p id="payment-terms"&gt;Payment Terms: 30 days&lt;/p&gt; 
      &lt;p id="payment-due"&gt;Payment due by 21 March 2008&lt;/p&gt; 
      &lt;p id="payment-total"&gt;£2643.75&lt;/p&gt;
    &lt;/div&gt; 
    &lt;!-- #invoice-info --&gt; 
    &lt;div class="vcard" id="client-details"&gt; 
      &lt;div class="fn"&gt;John Doe&lt;/div&gt; 
      &lt;div class="org"&gt;Client Company&lt;/div&gt; 
      &lt;div class="adr"&gt; 
        &lt;div class="street-address"&gt; Client Street Address&lt;br&gt; 
          Street Address 2&lt;br&gt; 
          Street Address 3&lt;br&gt; 
        &lt;/div&gt; 
        &lt;!-- street-address --&gt; 
        &lt;div class="locality"&gt;LOCALITY&lt;/div&gt; 
        &lt;div id="client-postcode"&gt;&lt;span class="region"&gt;Region&lt;/span&gt; &lt;span class="postal-code"&gt;MV2 8SX&lt;/span&gt;&lt;/div&gt; 
        &lt;div id="your-tax-number"&gt;SALES TAX: 193528491&lt;/div&gt;
      &lt;/div&gt; 
      &lt;!-- adr --&gt; 
    &lt;/div&gt; 
    &lt;!-- #client-details vcard --&gt; 
    &lt;table id="invoice-amount"&gt; 
      &lt;thead&gt; 
        &lt;tr id="header_row"&gt; 
          &lt;th class="quantity_th"&gt;Quantity&lt;/th&gt; 
          &lt;th class="left details_th"&gt;Details&lt;/th&gt; 
          &lt;th class="unitprice_th"&gt;Unit Price (£)&lt;/th&gt; 
          &lt;th class="salestax_th"&gt;VAT&lt;/th&gt; 
          &lt;th class="subtotal_th"&gt;Net Subtotal (£)&lt;/th&gt; 
        &lt;/tr&gt; 
      &lt;/thead&gt; 
      &lt;tfoot&gt; 
        &lt;tr id="discount_tr"&gt; 
          &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt; 
          &lt;td colspan="2" class="item_r"&gt;10% Discount&lt;/td&gt; 
          &lt;td class="item_r"&gt;£250.00&lt;/td&gt; 
        &lt;/tr&gt; 
        &lt;tr id="net_total_tr"&gt; 
          &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt; 
          &lt;td colspan="2" class="item_r"&gt;Net Total&lt;/td&gt; 
          &lt;td class="item_r"&gt;2250.00&lt;/td&gt; 
        &lt;/tr&gt; 
        &lt;tr id="vat_tr"&gt; 
          &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt; 
          &lt;td colspan="2" class="item_r"&gt;VAT&lt;/td&gt; 
          &lt;td class="item_r"&gt;393.75&lt;/td&gt; 
        &lt;/tr&gt; 
        &lt;tr id="total_tr"&gt; 
          &lt;td colspan="2"&gt;&amp;nbsp;&lt;/td&gt; 
          &lt;td colspan="2" class="total" id="total_currency"&gt;&lt;span class="currency"&gt;GBP &lt;/span&gt; Total&lt;/td&gt; 
          &lt;td class="total"&gt;£2643.75&lt;/td&gt; 
        &lt;/tr&gt; 
      &lt;/tfoot&gt; 
      &lt;tbody&gt; 
        &lt;tr class="item odd"&gt; 
          &lt;td class="item_l"&gt;1 Day&lt;/td&gt; 
          &lt;td class="item_l"&gt;Details of project activity to be billed &lt;/td&gt; 
          &lt;td class="item_r"&gt;500.00&lt;/td&gt; 
          &lt;td class="item_r"&gt;17.5%&lt;/td&gt; 
          &lt;td class="item_r"&gt;500.00&lt;/td&gt; 
        &lt;/tr&gt; 
        &lt;tr class="item"&gt; 
          &lt;td class="item_l"&gt;2 Days&lt;/td&gt; 
          &lt;td class="item_l"&gt;Other Details of project activity to be billed &lt;/td&gt; 
          &lt;td class="item_r"&gt;1000.00&lt;/td&gt; 
          &lt;td class="item_r"&gt;17.5%&lt;/td&gt; 
          &lt;td class="item_r"&gt;1000.00&lt;/td&gt; 
        &lt;/tr&gt; 
        &lt;tr class="item odd"&gt; 
          &lt;td class="item_l"&gt;2 Days&lt;/td&gt; 
          &lt;td class="item_l"&gt;More d etails of project activity to be billed &lt;/td&gt; 
          &lt;td class="item_r"&gt;1500.00&lt;/td&gt; 
          &lt;td class="item_r"&gt;17.5%&lt;/td&gt; 
          &lt;td class="item_r"&gt;1000.00&lt;/td&gt; 
        &lt;/tr&gt; 
      &lt;/tbody&gt; 
    &lt;/table&gt; 
    &lt;!-- invoice-amount --&gt; 
    &lt;div id="invoice-other"&gt; 
      &lt;h2&gt;Other Information&lt;/h2&gt; 
      &lt;div id="company-reg-number"&gt;&lt;strong&gt;Company Registration Number:&lt;/strong&gt; 9273109&lt;/div&gt;  
      &lt;div id="contract-number"&gt;&lt;strong&gt;Contract/PO:&lt;/strong&gt; PO 87227643&lt;/div&gt; 
    &lt;/div&gt; 
    &lt;!-- invoice-other --&gt; 
    &lt;div id="payment-details"&gt; 
      &lt;h2&gt;Payment Details&lt;/h2&gt; 
      &lt;div id="bank_name"&gt;Bank Name&lt;/div&gt; 
      &lt;div id="sort-code"&gt;&lt;strong&gt;Bank/Sort Code:&lt;/strong&gt; 32-75-97&lt;/div&gt; 
      &lt;div id="account-number"&gt;&lt;strong&gt;Account Number:&lt;/strong&gt; 28270761&lt;/div&gt; 
      &lt;div id="iban"&gt;&lt;strong&gt;IBAN:&lt;/strong&gt; 973547&lt;/div&gt; 
      &lt;div id="bic"&gt;&lt;strong&gt;BIC:&lt;/strong&gt; 220197&lt;/div&gt; 
      &lt;div id="payment-reference"&gt;&lt;strong&gt;Payment Reference:&lt;/strong&gt; INV001&lt;/div&gt; 
    &lt;/div&gt; 
    &lt;!-- payment-details --&gt; 
    &lt;div id="comments"&gt;Payment should be made by bank transfer or cheque made payable to John Smith.&lt;/div&gt; 
    &lt;!-- comments --&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>My question is: how to convert that HTML code <strong>only</strong> element inside <code>&lt;div id='invoice'&gt;bla bla bla&lt;/div&gt;</code> or maybe just the specified url of that page <code>(ex: localhost/invoice/index.php)</code> to a downloadable <code>pdf</code>?</p>
  
  <p>I've been searching many pdf class libraries but I can't find a solution.</p>
  
  <p>Can anyone give me a solution, idea or possible approach?</p>