searching for some utility/library (free source) for pdf creation

Submitted by आनंद on 4 August, 2008 - 02:01

I am searching for some utility/library (free source) for pdf creation.
The requirement is to get the contents of current displayed page and convert it to pdf.
The language is PHP.
The user scenerio would be
1. User hits a link which does some computation and provides him/her results in the browser as a html page.
2. The HTML page has a button, which says "Download as PDF"
3. Once user clicks it, the contents of the page gets converted to PDF and user gets the dialog for saving it.

The requirement is not to save any temporary document (the generated html or pdf) on server side.
I could get the utilities which can convert if html page path is given, but none of them were useful for above scenerio (as it would require to save temporary html file).

Can anyone guide or point me to such code snippet/library?

(I thought to open a new thread in "Looking For" for "Code Snippets". If many people can see such thread as a help, we can open it.)

Groups audience: 
Group content visibility: 
Public - accessible to all site users

Thank you for the response.
I went through all the links, but all require to set text, column font etc. information.
Only One library requires the file to be present somewhere. As I do not want to store the file on server, it won't be helpful much.
Let me give the reason why I am interested in the html page output first in browser & then pdf. I have the html template already with me. It is like XHTML. It is big template. Neither, I want to touch it nor I want to replicate all the contents in pdf creation logic thro' SetText, CreateTable etc... I shall only set the values in it and send to browser.
I would have saved it at some temp location, but such report generation will be huge in number and sys admin has to clean all such temp files on regular basic.
Anyway, thanks again for the links. I may find some more info while navigating through them.

To Admin, Thanks for creating new topic for programming. Hope this will help people.

Thanks to all for the tips.
Seems that rustyparts is a good one. I have to see how ps2pdf can be installed on web hosting service.

http://pdml.sourceforge.net/ This can convert html pages to pdf. One has to change html to pdml tag. But this does not support much styles (CSS)

I also tried fdf, but it gets downloaded with reference to original pdf.

html2pdf from http://www.tufat.com/s_html2ps_html2pdf.htm is also one good utility (Thanks to them who have suggested this one). This solved my problem. This can support many styles (not all though).

Now I am trying to convert pdf files to HTML file. No good convertor is available which gives perfect styling of original pdf.