displaying a pdf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Perhaps someone can tell me what I'm doing wrong.  I did some ( a lot) 
looking around for hints on this and here is what I have compiled.  It 
doesn't work - just goes to a white, blank page and sits.  I don't know if I 
need all the html parts or even if I have placed my php in the right areas.

BTW - all I want to do is use a menu option to take me to a page that shows 
the pdf.  My menu (a js thing) won't let me use an <a> element, so I'm 
trying to just build a php page that I can go to and display the doc 
automacitcally without the user having to click on something..

[code begins]
<?php
session_start();
$root = $_SERVER['DOCUMENT_ROOT'];
$pdfname='/pdfs/myfile.pdf';
$length = filesize($pdfname);
//
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=".$pdfname);
header("Content-Length: ".$length);
//
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
</head>
<body>
<?
readfile=$pdfname;
?>
</body>
</html>
[code ends]

Thanks in advance! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux