开发者

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

开发者 https://www.devze.com 2023-01-07 17:53 出处:网络
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

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");

hea开发者_StackOverflowder("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("cache-control: max-age=1");


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

ex:

ShowPDF.php/Myfilename.pdf

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号