Tutorial :PDF Viewer Save dialog box shows source code file name as default



Question:

I am rendering a PDF correctly using SSRS SDK for PHP, and it is being displayed in viewer correctly. But, when I click the save button on the Adobe Reader, the dialog box shows the name of the source files name rather then the name I pass in via HTTP Header. here is my code:

header('Content-Type: application/pdf; filename="'.basename($reportName).'";');  header('Content-Disposition: inline; filename="'.basename($reportName).'";');    header("Content-length: ".(string)(strlen($result)));  header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2,                                             date("i"), date("s"),                                             date("m"), date("d"),                                             date("Y")))." GMT");    header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");  header("cache-control: max-age=1");  


Solution:1

Found solution. Tested in Chrome, Safari, IE8, IE7, IE6 Add the filename to end of URL

ex:

ShowPDF.php/Myfilename.pdf


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »