Solved

PDFfile save as dialog box with default file name in PHP

Posted on 2008-10-12
3
525 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
Six Sigma Control Plans

615 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