Reputation:
I have simple PDF file in my directory and I use fopen
to open PDF file. When I try to embed it on into html iframe
, the file is not showing up. I know I can specify the source as iframe
attribute but I want to do it using PHP.
<?php
$myfile = fopen("http://ipaddress/file.pdf", "r") or die("Unable to open file!");
fclose($myfile);
?>
<body>
<iframe src="<?php $myfile; ?>#toolbar=0&navpanes=0&scrollbar=0" width="1000" height="1000"></iframe>
</body>
Upvotes: 2
Views: 10941
Reputation: 4391
This should do the trick.
<body>
<iframe src="http://ipaddress/file.pdf" width="1000" height="1000"></iframe>
</body>
If the file is local you can put local file URL. But the file will not be accessible on internet. For example:
file:///D:/WebDesign/HTML/test/file.pdf
Upvotes: 2