在Web应用程序中显示PDF [英] Display PDF in Web Application

查看:116
本文介绍了在Web应用程序中显示PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我GOOGLE了这一点,这搜查通过SO和其他网站看(我一直在这个问题上几个小时,现在读),但我似乎仍不能找到满意的解决方案,似乎是什么一个简单的,常见的编程问题。

让我现场设置:


        
  • 我有一个网站/网络应用程序,允许用户搜索一个SQL Server库。

  •     
  • 最相关的搜索结果的文件是PDF文件。

  •     
  • 的PDF文件存储在SQL Server数据库中的BLOB内。

  •     
  • 我希望能够从数据库中动态拉PDF文件,并​​显示给用户。

  •     
  • 在以preserve用户的搜索进度,我想我会在另一个浏览器窗口/标签中打开文件

  •     
  • 我已经想通了如何将PDF到服务器保存在指定的目录。

  •     
  • 我的不要希望用户看到的文件路径。

  •     
  • 在合理范围内,我想在所有主要的浏览器有效的解决方案:

  •     

              
    1. 的Internet Explorer

    2.         
    3. 火狐

    4.         

    5.         
    6. Safari浏览器(包括iPhone / iPad的移动Safari浏览器)

    7.     

        
  • 我preFER不买一个第三方组件,但我愿意在必要走这条路。

  •     
  • 我不认为我要发送的文件下载(我想我已经找到了如何做),因为这是不是失败的iPhone / iPad的?

到目前为止,我已经尝试了各种解决方案有一些基本的问题,毛病:


        
  • 使用的iFrame似乎在iPhone上惨败/ iPad的

  •     
  • 使用Server.Transfer的(我使用ASP.NET)显示乱码,而不是PDF

  •     
  • 我试过了几个演示的第三方解决方案,但他们臭呢!

我不能看着办吧!我真的桌面开​​发者,这是 EASY 在Windows!为什么要与网络这么难?

我是愚蠢的,这确实是一个简单的运动,或者是这个基本任务真的那么难?

请帮我指出了正确的方向!

谢谢!


解决方案

此链接可能对你有用,

<一个href=\"http://nilangshah.word$p$pss.com/2007/05/28/successfully-stream-a-pdf-to-browser-through-https/\" rel=\"nofollow\">http://nilangshah.word$p$pss.com/2007/05/28/successfully-stream-a-pdf-to-browser-through-https/

您可以通过有目标speccifying =_空白为PDF链接在新标签打开。在博客中提到的ByteArray中从DB你的BLOB。希望这有助于。

I have googled this, searched this, looked through SO and other sites (I've been trying to read on this issue for hours now), but I still can't seem to find a satisfactory solution to what seems to be a simple, common programming issue.

Let me set the scene:

  • I've got a website/web application that allows the user to search a SQL Server library.
  • Most of the documents related to the search results are PDF files.
  • The PDF files are stored inside of the SQL Server database a BLOBs.
  • I want to be able to dynamically pull a PDF from the database and display it to the user.
  • In order to preserve the user's search progress, I think I'd like to open the file in another browser window/tab
  • I've figured out how to save the PDF to the server in a specified directory.
  • I DON'T want the user to see the path to the file.
  • Within reason, I want a solution that works in all major browsers:
    1. Internet Explorer
    2. FireFox
    3. Chrome
    4. Safari (including iPhone/iPad Mobile Safari)

  • I'd prefer not to buy a 3rd party component, but I'm willing to go that route if necessary.
  • I don't think I want to send the file as a download (which I think I've figured out how to do), because wouldn't this fail on iPhone/iPad?

Every solution I've tried so far has some basic problems wrong with it:

  • Using iFrames seems to fail miserably on iPhones/iPad
  • Using Server.Transfer (I'm using ASP.NET) shows gibberish instead of PDF
  • I've tried a couple of demo 3rd party solutions, but they stink, too!

I can't figure it out! I'm really a desktop developer, and this was EASY in Windows! Why is it so hard with the web?

Am I stupid and this is really an easy exercise, or is this basic task really that hard?

Please help point me in the right direction!

Thanks!!!

解决方案

This link might be useful to you,

http://nilangshah.wordpress.com/2007/05/28/successfully-stream-a-pdf-to-browser-through-https/

You can have pdf opened in a new tab by speccifying target="_blank" for the link. ByteArray mentioned in the blog is your BLOB from the DB. Hope this helps.

这篇关于在Web应用程序中显示PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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