Solved

PDFfile save as dialog box with default file name in PHP

Posted on 2008-10-12
3
523 Views
Last Modified: 2013-11-13
Hello
        I have created  PDF files when i click a link (in PHP) for show data . I need an option to show the save as dialog box with default file name which i give when i open the PDF file link. Can you please  help me for this issue?

Thanks in advance.
define('FPDF_FONTPATH','font/');
	require('html2fpdf.php');
 
        $temp = "Test";
 
	$pdf = new HTML2FPDF();
	$pdf->SetAutoPageBreak(true);
	$pdf->AcceptPageBreak();
	$pdf->AddPage('L');
	$pdf->SetFont('Arial','',8);
	$pdf->WriteHTML($temp);
	$pdf->Output();

Open in new window

0
Comment
Question by:tgunduz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:lightit
ID: 22706262
Hello tgunduz,

This isn't possible without any extra activeX tools, or java client side implementation


Greetz
0
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 500 total points
ID: 22728206
This is a PDF file you make, right?  The expert above is right you can't force the download or control what the file name will be but there is a way to have the browser prompt for it to be saved and have the file name filled with what you want.
An example of the code to do this can be seen at http://elouai.com/force-download.php .  Of course you would just need the PDF type and have other changes because of the specific use.  In the header that has Content-disposition there is a setting for filename and that is where you can provide something to fill the Save Dialog that appears.
There is no way to force either though.  At least not from PHP (or any server language) or any client side script.  An applet or ActiveX object could do this.
Let me know how this helps or if you have a question.
bol
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question