简体   繁体   中英

read pdf in php embeded

I am developing a web site in php I want to show a PDF file in my website. I am found this code :

$file = 'Digital.pdf';
$filename = 'Digital.pdf';
header('Content-type: application/pdf');
header('Content-Disposition: inline;    filename="'.$filename.'"');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
@readfile($file);

when I use this code I have a message box from IDM show to Download the file. Not only this code I have same issue when I use iframe tage. How to fix this ?

use this

<iframe src="./my/folder/path/<?php echo $file ?>"></iframe>

You can use these atributes

  1. Width
  2. Height
  3. sandbox
  4. srcdoc

HTML <iframe> Tag

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM