HTML to PDF

I have a form in the web query open of which an agent is called. I am generating HTML in this agent and then storing this html in the rich text field on this form. So when the form loads in browser i get a display of the HTML generated, but instead of getting a display in Internet Explorer i want the contents to be opened in a PDF file. Is there any way in which i can write this HTML code to an PDF file or open it using a PDF file through the agent itself. Or atleast tell me the way in which i can write the HTML to pdf. Please it is very urgent. Thanks.