tags:

views:

31

answers:

1

hi, i wana open pdf file using php ,it works well but it prompt me for downloading that file in specified folder.. what i want to do is just by clicking a link pdf file get open without prompting for download.. anyone have idea about it?? thanx in advance.. below z the code

php code:

$mypdf = PDF_new();
PDF_open_file($mypdf, "");
PDF_begin_page($mypdf, 595, 842);
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
PDF_setfont($mypdf, $myfont, 10);
PDF_show_xy($mypdf, "hello my first pdf converted file", 50, 750);
PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);


PDF_end_page($mypdf);
PDF_close($mypdf);

$mybuf = PDF_get_buffer($mypdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: $mylen");
header("Content-Disposition: inline; filename=gen01.pdf");
print $mybuf;

PDF_delete($mypdf);

.....................................
html code:


<html>
<body>
Click here to see pdf file <a href="gen01.php" target="_blank">pdf1</a>
</body>
</html>
+1  A: 

Remove header("Content-Disposition: inline; filename=gen01.pdf"); But if the visitor doesn't have a PDF Reader associated with the 'application/pdf' mime-type, the browser WILL download the file.

bogdanvursu
bundle ov thanx.. it works
Sahar