Login/Logout | Profile | Help |
Last 1|Days | Search | Topics
PHP

Hitguj » Technology » Programming » PHP « Previous Next »

Dhumketu
Friday, March 02, 2007 - 12:53 pm:   Edit Post Delete Post Print Post  Link to this message

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.)

Ajay
Friday, March 02, 2007 - 3:27 pm:   Edit Post Delete Post Print Post  Link to this message

There is already pdf library builtin as part of php
http://us3.php.net/pdf

Also you can check fpdf
http://www.fpdf.org/

And also R&OS PDF class
http://www.ros.co.nz/pdf/

and check this article
Creating PDF files in PHP

http://www.zend.com/zend/spotlight/creatingpdfmay1.php



Dhumketu
Friday, March 02, 2007 - 5:19 pm:   Edit Post Delete Post Print Post  Link to this message

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.


Ajay
Friday, March 02, 2007 - 5:46 pm:   Edit Post Delete Post Print Post  Link to this message

I think this is what you need perhaps?
http://www.rustyparts.com/pdf.php

Dhulekar
Sunday, March 04, 2007 - 12:15 am:   Edit Post Delete Post Print Post  Link to this message

You may try pdf995 on "
http://www.software995.com/"
This site also has encription available.
So enjoy free s/w.

Prasadp77
Sunday, March 04, 2007 - 12:00 pm:   Edit Post Delete Post Print Post  Link to this message

Bullzip pdf printer at
http://www.bullzip.com/products/pdf/info.php

Dhumketu
Monday, March 05, 2007 - 7:25 am:   Edit Post Delete Post Print Post  Link to this message

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.

Shonoo
Monday, March 05, 2007 - 4:39 pm:   Edit Post Delete Post Print Post  Link to this message

ती ghost script नावाची एक भानगड आहे ती बघितलीत का? बर्‍याच वर्षांपूर्वी client server applications लिहिताना ती वापरत असू.
http://www.gnu.org/software/ghostscript/ghostscript.html

Dhumketu
Tuesday, March 06, 2007 - 4:36 am:   Edit Post Delete Post Print Post  Link to this message

GhostScript requires some scripts to be installed on server side. Now if i am hosting the website on some service provider's server, then its difficult for me to install such components.

I found something interesting yesterday
http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.html
After reviewing I found that, it requires server side installations :-(

Dhumketu
Thursday, March 15, 2007 - 4:35 am:   Edit Post Delete Post Print Post  Link to this message

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.

चोखंदळ ग्राहक
महाराष्ट्र धर्म वाढवावा
व्यक्तिपासून वल्लीपर्यंत
पांढर्‍यावरचे काळे
गावातल्या गावात
तंत्रलेल्या मंत्रबनात
आरोह अवरोह
शुभंकरोती कल्याणम्
विखुरलेले मोती


हितगुज गणेशोत्सव २००६





Topics | Last Day | Tree View | Search | User List | Help/Instructions | Content Policy | Notify moderators