XSL-FO is a common standard that tool developers can implement for compatibility, just as HTML is a common standard for web pages, XSL is a standard for XML-to- * conversion, etc.
If your HTML can be considered well-formed XML (i.e. short tags close properly, for example, <br /> and <img /> - not <br> and <img>), then you should be able to use XSL to translate directly to XSL-FO, which can then be transferred directly to a tool, such as Apache FOP for conversion. If it is not correct, you can always use the Python BeautifulSoup tool or PHP DOMDocument :: loadHTML () to load HTML and output well-formed XHTML for your conversion.
There are also tools like FPDF (PHP) and Prawn (Ruby, which was used for very nice Dopplr reports ), but IMHO they are much more "fiddly" to use - more like using absolute positioning in CSS than letting things flow on their own. May cause problems when considering page breaks, etc.
However, it all depends on what you do with the exit.
source share