Before we look at specific ways to convert HTML to PDF, lets consider the task in more detail. HTML is the programming language that is used to create websites. Obviously, HTML is more versatile — it supports Flash, animated images, embedded video, background music (this is thankfully rare) and other dynamic page elements. These and some other features of HTML pages can’t be converted to HTML, so when choosing a html-to-pdf converter it’s important to take into account what HTML features it can handle.
Another factor is how you want to use the converter:
- Do you simply need to convert a single page?
- Or do you want to make an application that lets other people convert certain HTML documents to PDF?
- Would you prefer something you can download and install, or an online service?
- How much are you willing to pay for the HTML converter?
Finally, lets look at specific HTML to PDF converters. For the average user, PDFonFly is likely the best choice. It’s a free online service that takes a webpage URL and creates a matching PDF file for you to download. The only annoyance is having to enter a captcha, but that’s a small price to pay for a quick and painless HTML to PDF service. The conversion quality is very good – the colors and fonts look nearly as good as in a web browser, with a few minor layout glitches for some webpages. If you want to convert a lot of HTML documents to .pdf, take a look at html2pdf (a commercial online service, average quality) or XHTML2PDF (an open source Python library).