I have a bunch of HTML data that I write to a PDF file using PHP. In PDF, I want all HTML to be removed and cleaned up. For example:
<ul>
<li>First list item</li>
<li>Second list item which is quite a bit longer</li>
<li>List item with apostrophe 's</li>
</ul>
It should become:
First list item
Second list item which is quite a bit longer
List item with apostrophe 's
However, if I just use strip_tags(), I get something like this:
First list item&
Second list item which is quite a bit
longer&
List item with apostrophe ’s ’s
Also note the indentation of the output.
Any tips on how to properly clear HTML to nice clean lines without messy spaces and odd characters?
Thank:)
source
share