Not all of the functionality I’ve been adding to this site recently involves JavaScript and the DOM. I’ve also added a new PHP script.
If you go to the permalink for any journal entry you’ll see a new link (after the old “email a friend” link) prompting a PDF download. This points to a PHP script that takes the content of the journal entry, formats it very simply (no links or images) and spits it back out as a PDF. Perhaps more usefully, the download option also appears on the index page of the articles section so you can download any article as a PDF.
The nice thing about having the PDF files generated on the fly like this, rather than creating them in some software and then uploading them, is that any changes I make to the source (XML for the journal, HTML for the articles) is automatically carried over to the generated PDF.
I’ve never played around much with making PDFs before and I had a lot of fun refining the PHP script and getting it to do just what I wanted.
Speaking of having fun with PHP, Mark Liyanage has released a nice one-click installer of PHP5 for OS X. It comes complete with the PDF library.