How to download a flle in PDF format

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
drors30
Forum Newbie
Posts: 10
Joined: Sat Jan 12, 2008 1:59 pm

How to download a flle in PDF format

Post by drors30 »

Hi,
I want to save a php file in PDF format by clicking a button and then save it to my local machine.
How can i achieve this ?

Thanks
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: How to download a flle in PDF format

Post by jimthunderbird »

I would first try to get the file content using:

$self_content = file_get_contents(__FILE__);

then will try to dump $self_content into PDF, you might want to check out http://www.fpdf.org/ on how to create PDF file in php.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: How to download a flle in PDF format

Post by Kieran Huggins »

If it's only for you, you could use Acrobat to "create PDF from webpage" (which often looks nasty) or you could print to PDF.
User avatar
jimthunderbird
Forum Contributor
Posts: 147
Joined: Tue Jul 04, 2006 3:59 am
Location: San Francisco, CA

Re: How to download a flle in PDF format

Post by jimthunderbird »

Kieran Huggins wrote:If it's only for you, you could use Acrobat to "create PDF from webpage" (which often looks nasty) or you could print to PDF.
Yes, and this reminds me of PrimoPDF(http://primopdf.com/)
Post Reply