Brendan Tompkins has a nice post on printing a web page as a PDF using webSuperGoo's ABCPdf component.  The example is written in C#, but shouldn't be too hard to translate.

 So what’s the solution to your website printing problems at least until you can guarantee that the majority of your users will be using a print-friendly browser?  Simple, when a user makes a print request on your site, dynamically create PDF documents on the fly making sure to include all of your users page state, and output that PDF document to the browser

Full article at http://codebetter.com/blogs/brendan.tompkins/archive/2006/05/22/145267.aspx.