0

I want to download complete webpage using MIME code. I am using

header("Content-type:application/msword");
header("Content-Disposition:attachment; Filename=$profile_id.doc");

to download webpage in MS Word and I am trying:

header("Content-type:application/pdf");
header("Content-Disposition:attachment; Filename=$profile_id.pdf");

to download webpage in PDF, but the PDF one is not working. Please tell me how to do so...thanks :)

I think that this code is deprecated now. Please let me know th substitute code of this

rekire
  • 47,260
  • 30
  • 167
  • 264

1 Answers1

0

Try:


header('Content-Type:application/pdf');
header('Content-Disposition:attachment; filename="'.$profile_id.'.pdf"');

Edited: Try, something like:


$file = $profile_id.".pdf";
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Type: application/octetstream');
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header('Content-Disposition:attachment; filename="'.$profile_id.'.pdf"');


Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
  • @OP: Yes, or wrap the variable in {} so the parser can see which bits are meant to be a variable :) – halfer Mar 05 '12 at 12:18
  • Sudhir sir...i tried it... header("Content-Disposition:attachment; Filename=$profile_id.pdf"); is working properly but not "header('Content-Type:application/pdf');" – Developing Developer Mar 05 '12 at 12:22