[英]Embed PDF file in the html from /var/www/pdf/ directory
我想將PDF文件從/ var / www / pdf /目錄嵌入到我的網站中。 我的網頁托管在/var/www/html/portal/index.php。 我嘗試了以下方法
1)使用嵌入
2)使用iframe
<iframe src="../../pdf/ebook.pdf" width="900" height="750" frameborder="0" allowfullscreen></iframe>
3)使用對象
<object data="../../pdf/ebook.pdf#scrollbar=0&toolbar=0&navpanes=0" width="900" height="750" type="application/pdf">
<p>PDF cannot be displayed</p>
</object>
它們都不起作用,但是如果我將pdf文件放在/ var / www / html / pdf /文件夾中,則可以正常工作。
根據我的要求,我無法將文件保存在Web目錄中,因為公眾無需登錄我的Web門戶即可直接使用URL訪問PDF文件。 谷歌還可以從公共搜索中索引我的PDF文件
請幫我嵌入pdf
提前致謝
我發現使用php腳本的解決方案
header("Content-type: application/pdf");
header("Content-Disposition: inline; filename=filename.pdf");
@readfile('../../pdf/ebook.pdf');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.