You might want to take a look at wkhtmltopdf. Its an HTML to PDF converter based on the webkit HTML engine that underlays Safari and most other OS X applications that display HTML, as well as the Google Chrome browser among other applications. Its built to be a command-line based utility, and should be easy enough to tweak and recompile given the ability to build apps based on the Qt framework.
I don't recall what exactly it does with links in the page, but it does a decent job of converting the text including CSS formatting to pretty good looking PDF.
And its free...
Edit: Also, a full copy of Acrobat has had this ability since at least Acrobat 3 or 4 (i.e. a long time). However, you have to buy full Acrobat, because Reader doesn't have the feature. It supports two modes of conversion: automatic and ad-hoc. Automatic mode walks the provided URL and retrieves everything it can reach from there. Since that could easily involve retrieving the entire Web, it has a control on the number of hops it is allowed to get away from the original page. The ad-hoc mode lets you browse from page to page, and as you click links it retrieves the page, adds it to the growing PDF document, and rewrites the links to refer to the PDF file instead of the web.
Acrobat's PDF creation is generally the best of show, except for this case. It really doesn't handle enough of the CSS spec to get things to work out right. I've often had best results by setting the page layout to landscape, but even then, its clunky.
Edit 2: I removed Opera from the list of users of webkit and added a link to the webkit project page. Thanks to Dan Walker for the correction.