0

I am using tcpdf to generate a pdf file via php, and I am setting the headers accordingly so that when the php file is opened in browser, it displays as a pdf.

Now in another page I have a hyperlink pointing to this php file, and in Firefox, when someone right clicks this link and uses "Save As", the file saves as a pdf document. On IE however, it saves with a php file extension containing garbage value(pdf encoded content). Is there any way for IE to recognize the php as a pdf document?

4

2 に答える 2

0

使用していることを確認してください

header('Content-type: application/pdf')

あなたの出力で。

于 2012-06-15T09:27:35.040 に答える
0

次のヘッダーが設定されていることを確認してください。

header("Content-type: application-download");
header("Content-Length: $size");
header("Content-Disposition: attachment; filename=MyPDF.pdf");
header("Content-Transfer-Encoding: binary");
于 2012-06-15T09:28:50.663 に答える