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
Solved

PDFfile save as dialog box with default file name in PHP

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

856 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