Home >Backend Development >PHP Tutorial >求php显示pdf的解决方案

求php显示pdf的解决方案

WBOY
WBOYOriginal
2016-06-23 14:23:041307browse

我的需求是在a页面展示远程服务器上的pdf文件,代码如下:

<?php$fileName = "abcd.pdf";header("Content-Type: application/pdf");header('Content-Disposition: inline; filename*="utf8\'\''.$fileName.'"');ob_start();readfile("http://www.xxx.com/pdf/xyz.pdf");$content = ob_get_contents();ob_end_clean();        echo $content;


问题是:
1、在php中读取远程pdf,速度比较慢;
2、在一些不支持pdf阅读的浏览器,会提示下载文件,这时filename会有乱码;


回复讨论(解决方案)

读取速度慢,可以后台读取缓存在本地
没有pdf阅读器比较麻烦

把inline;改成outline;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn