Anyone who’s spent time looking for solutions to allow their Web site visitors to convert pages to PDF has most likely discovered that the majority of the tools available for doing so are lacking in one way or another. Trying to build one in PHP from scratch is an extremely daunting and unsatisfying task. Using a pre-built library in PHP always seems to carry with it some disappointment (most of the time related to either the CSS implementation or the usage of images on your pages) and using a hosted solution usually means long processing and waiting times or does not allow for any decent customization.
However, a new hosted resource has come onto the scene that seems to do an extremely effective job, allows for a great deal of customization and is fast and efficient. A team known as OpenTracker has put together a resource called PDFmyURL. On the surface, PDFmyURL looks like just another site that allows visitors to enter a URL and get a PDF of that page in return. Even in that task, PDFmyURL does a much better job than most of its competitors (there are a few other sites that claim to allow users to do that, but many of them require you to save the page in Microsoft’s packaged HTML format before you can convert the page). However, by clicking a small link on the PDFmyURL home page, you can expand a list of advanced options that show you some code you can place on your own Web site to seamlessly allow your visitors to convert your pages to PDF.
You can take the simple route and simply include a link to PDFmyURL that will return a PDF version of your page.
For example if you add this piece to anchor on your site, it will return you
If you want a more advanced method, PDFmyURL also includes some information about converting your page to PDF and using WGet on your server to transfer that new PDF to your own Web server. From there, the possibilities are nearly endless.
In the advanced options, you’ll also find a great deal of information about customizing the PDF output. You can specify paper size and orientation, you can add headers and footers, you can create a table of contents, use a custom style sheet and more.
The PDFmyURL application does a really good job of converting pages to PDF. It seems to handle images and CSS extremely well with very few hiccups. If you’re looking for a solution that will allow you to add a “Convert to PDF” button or link to your Web pages, I would highly recommend investigating PDFmyURL. I only hope that OpenTracker will eventually either open the source to this great tool or provide an enterprise edition that can be installed and run on a local server.