如何在我的本地网站(没有互联网)中实时预览 PDF 文件,该文件是保存在 Longblob 中的 PDF?我使用此脚本下载 PDF:
<?php
if(isset($_GET['id']))
{
include "../conn.php";
$query = "select * from file where id = '".$_GET['id']."'";
$result = mysql_query($query) or die (mysql_error);
$download = mysql_fetch_array($result);
$name = str_replace('%20', ' ',$download['file_name']);
$type = $download['file_type'];
$size = $download['file_size'];
$content = $download['file'];
header("Content-disposition: attachment; filename=\"".$name."\"");
header("Content-length: ".$size."");
header("Content-type: $type");
echo $content;
exit;
}
?>
我使用了几乎所有的开源 PDF 查看器插件,例如http://viewerjs.org,但未能显示想要的 PDF 文件。需要你们的帮助。。