get text from html including format
<p>I would like to get the text from my html and preserve the proper format just like how it looks like on a browser.</p>

<p>i want this</p>

<pre><code>               CompanyName
              CompanyAddress
           Company Phone Number

       1  Item1   7.00   0%   7.00
       2  Item2   5.00   0%   5.00
                  TOTAL:         2
               SUBTOTAL:     12.00
                   CASH:     12.00
</code></pre>

<p>I'm getting this</p>

<pre><code>                    CompanyName
                   CompanyAddress
                Company Phone Number

                   1  

                   Item1   

                  7.00   
                   0%   

                     7.00
</code></pre>

<p>My HTML:</p>

<pre><code>&lt;div id="printPreview" class="interprise-popover-container"&gt;
&lt;div class="interprise-popover-header popover-header"&gt;
    &lt;h1 class="title"&gt;Print Preview&lt;/h1&gt;
    &lt;a class="popover-btn left-popover-btn btn-Cancel"&gt;Cancel&lt;/a&gt;
    &lt;a class="popover-btn right-popover-btn btn-Done"&gt;Done&lt;/a&gt;
&lt;/div&gt;
&lt;br class="clearfloat"/&gt;
&lt;div id="printPreviewBody" class="interprise-popover-content"&gt;
    &lt;div id="print-area"&gt;
    &lt;div id="print-header"&gt;
        &lt;h4&gt;&lt;%= Company %&gt;&lt;/h4&gt;
        &lt;h6&gt;&lt;%= WarehouseAddress %&gt;&lt;/h6&gt;
        &lt;h6&gt;&lt;%= WarehouseCity %&gt;, &lt;%= WarehouseState %&gt; &lt;%= WarehousePostalCode %&gt;&lt;/h6&gt;
        &lt;h6&gt;&lt;%= PhoneNumber %&gt;&lt;/h6&gt;
        &lt;h6&gt;www.fairysales.com&lt;/h6&gt;
        &lt;h5 style="margin-top: 5px;"&gt;&lt;%= TransactionType %&gt;#&amp;nbsp;&lt;%= InvoiceCode %&gt;&lt;/h5&gt;
    &lt;/div&gt;
    &lt;div id="print-barcode" style="margin:0 auto; "&gt;&lt;/div&gt;
    &lt;span style="font-size: 12px;"&gt;Monday&lt;/span&gt;
    &lt;div&gt;
        &lt;table id="print-items" cellspacing="0" width="100%"&gt;
                        &lt;tbody&gt;
                          &lt;tr&gt;
                            &lt;td align="right"&gt; 1 &lt;/td&gt;
                            &lt;td align="left"&gt; Item1&lt;br&gt;&lt;/td&gt;
                            &lt;td align="right"&gt;12.00&lt;/td&gt;
                            &lt;td align="right"&gt;0%&lt;/td&gt;
                            &lt;td align="right"&gt;&lt;div&gt;&lt;abbr&gt;12.00&lt;/abbr&gt;&lt;/div&gt;&lt;/td&gt;
                          &lt;/tr&gt;
                       &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;/div&gt;
    &lt;div id="print-total"&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p></p>

<p>By the way i used </p>

<pre><code>$("#print-header").text(); to extract the text from the div
</code></pre>

<p><strong>UPDATE: here is the jsfiddle</strong></p>

<p><a href="http://jsfiddle.net/8yC5G/1/" rel="nofollow">http://jsfiddle.net/8yC5G/1/</a></p>

<p>What i want to achieve is actually the same as the result but in text format so i can pass it as string from javascript to objective c. </p>
