Solved

PDFfile save as dialog box with default file name in PHP

Posted on 2008-10-12
3
508 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
Comment Utility
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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now