在浏览器上的pdf视图,而不是下载到桌面 [英] pdf view on browser instead of download to desktop

查看:137
本文介绍了在浏览器上的pdf视图,而不是下载到桌面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<iframe src="http://docs.google.com/gview?url=http://example.com/test/pdf/ex.pdf; ?>&embedded=true" style="width:608px; height:700px;" frameborder="0"></iframe>




上面的iframe代码在浏览器上显示pdf.

但是我的问题是,我已经将pdf上传到数据库(BLOB)并能够下载pdf-链接类似于




The above iframe code, displays pdf on the browser.

But my problem is, I have uploaded the pdf to the database(BLOB) and to be able to download the pdf - the link would be something like

www.example.com/test/view.php?id=21 



并且如果我在iframe Google查看器中添加以上网址,它将永远无法识别出该参数.



and if i add above url in iframe google viewer, it never recognize is parameter.

<iframe src="http://docs.google.com/gview?url=http://example.com/test/view.php&id=21 ; ?>&embedded=true" style="width:608px; height:700px;" frameborder="0"></iframe




那么,使用相同的技术或其他方法在浏览器上查看pdf的最佳方法是什么-

以下代码下载了pdf




So what''s the best way to be able to view the pdf on the browser, using same technique or something else -

The below code downloads the pdf

header("Content-type: $this->type");
header("Content-Disposition: attachment; filename=$this->name");
echo $this->content;



我可以更改此代码中的任何内容,以强制其在同一浏览器中打开而不是下载吗?

谢谢



Is there anything i can change in this code to force it to open in the same browser instead of download?

Thanks

推荐答案

this-> type); 标头(内容处置:附件;文件名=
this->type"); header("Content-Disposition: attachment; filename=


此->名称"); echo
this->name"); echo


this-> content;
this->content;



我可以更改此代码中的任何内容,以强制其在同一浏览器中打开而不是下载吗?

谢谢



Is there anything i can change in this code to force it to open in the same browser instead of download?

Thanks


这篇关于在浏览器上的pdf视图,而不是下载到桌面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆