Click here to Skip to main content
15,115,960 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i need to create a pdf file and download it to my computer. So for that i am modified the tcpdf class and i clicked on generate pdf button. it is creating the pdf but it is not downloading the pdf. It is giving the Output in new tab like
"'L', 65549=>'L', 65550=>'L', 65551=>'L', 65552=>'L', 65553=>'L', 65554=>'L', 65555=>'L', 65556=>'L', 65557=>'L', 65558=>'L', 65559=>'L', 65560=>'L', 65561=>'L', 65562=>'L', 65563=>'L', 65564=>'L', 65565=>'L', 65566=>'L', 65567=>'L', 65568=>'L', 65569=>'L', 65570=>'L', 65571=>'L', 65572=>'L', 65573=>'L', 65574=>'L', 65576=>'L', 65577=>'L', 65578=>'L', 65579=>'L', 65580=>'L', 65581=>'L', 65582=>'L', 65583=>'L', 65584=>'L', 65585=>'L', 65586=>'L', 65587=>'L', 65588=>'L', 65589=>'L', 65590=>'L', 65591=>'L', 65592=>'L', 65593=>'L', 65594=>'L', 65596=>'L', 65597=>'L', 65599=>'L', 65600=>'L', 65601=>'L', 65602=>'L', 65603=>'L', 65604=>'L', 65605=>'L', 65606=>'L', 65607=>'L', 65608=>'L', 65609=>'L', 65610=>'L', 65611=>'L', 65612=>'L', 65613=>'L', 65616=>'L', 65617=>'L', 65618=>'L', 65619=>'L', 65620=>'L', 65621=>'L', 65622=>'L', 65623=>'L', 65624=>'L', 65625=>'L', 65626=>'L', 65627=>'L', 65628=>'L', 65629=>'L', 65664=>'L', 65665=>'L', 65666=>'L', 65667=>'L', 65668=>'L', 65669=>'L', 65670=>'L', 65671=>'L', 65672=>'L', 65673=>'L', 65674=>'L', 65675=>'L', 65676=>'L', 65677=>'L', 65678=>'L', 65679=>'L', 65680=>'L', 65681=>'L', 65682=>'L', 65683=>'L', 65684=>'L', 65685=>'L', 65686=>'L', 65687=>'L', 65688=>'L', 65689=>'L', 65690=>'L', 65691=>'L', 65692=>'L', 65693=>'L', 65694=>'L', 65695=>'L', 65696=>'L', 65697=>'L', 65698=>'L', 65699=>'L', 65700=>'L', 65701=>'L', 65702=>'L', 65703=>'L', 65704=>'L', 65705=>'L', 65706=>'L', 65707=>'L', 65708=>'L', 65709=>'L', 65710=>'L', 65711=>'L', 65712=>'L', 65713=>'L', 65714=>'L', 65715=>'L', 65716=>'L', 65717=>'L',"



What will i do .. Please tell me..
Posted

1 solution

please read about php header.
this is the code i use to download file
PHP
header("Pragma: public"); // required
	header("Expires: 0");
	header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
	header("Cache-Control: private",false); // required for certain browsers
	header("Content-Type: $ctype"); //$ctype="application/force-download";
	header("Content-Disposition: attachment; filename=".$base.";" );//$base="x.pdf"
	header("Content-Transfer-Encoding: binary");
	header("Content-Length: ".@filesize($filename));
	@readfile($rfilename);
	unlink($rfilename);//delete after download


and remember if you echo or send any other data your pdf file will be corrupted
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900