How to generate PDF file so it can be downloaded?

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

exphp
New php-forum User
New php-forum User
Posts: 10
Joined: Thu Nov 10, 2011 11:15 pm

How to generate PDF file so it can be downloaded?

Postby exphp » Sat Jan 19, 2013 9:12 pm

Hello everyone.
I have a problem to generate PDF file using FPDF and PHP.
I'll not ask you how to create the pdf file, but I need help to generate a link to PDF file so it can be downloaded automatically.

I mean like this:
I already created a php page that create PDF file, name: report.php. I must open the report.php page to see the pdf file then click "Save" or press Ctrl + S to save the PDF file. Now I need to generate report.php become report.pdf automatically so the pdf file can be downloaded automatically.

For example, if I click a button "Generate Link", so the value will be:
echo "<a href='report.pdf' title='download pdf file'>Download PDF File</a>";
not
echo "<a href='report.php' title='download pdf file'>Download PDF File</a>";

Do you have any ideas or solution for this case? :help:
I really appreciate it.
Thanks.

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 4 guests