如何在完全下载PDF文件之前将其显示在网络浏览器中 [英] How to get a pdf to display in a web browser before it's fully downloaded

查看:117
本文介绍了如何在完全下载PDF文件之前将其显示在网络浏览器中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个一直在努力将缓慢的pdf文件加载到网络上的客户. 我的客户有一些非常大的pdf文件,差不多10 Mb.他们最多需要3-4分钟才能下载.在加载整个文件之前,这些文件将不会显示. 我们和他们已经看到了其他站点的pdf一次加载一页,因此最终用户可以开始查看文件,因为页面的其余部分仍在后台加载.给人一种页面加载速度更快的错觉.

I have a client that's been struggling with slow loading pdf files on the web. My client has some very large pdf files that are almost 10 Mb. They take upwards of 3-4 minutes to download. The files will not display until the whole file is loaded. We and they have seen other's sites where the pdfs load one page at a time, so the end user can start looking at the file as the rest of the page is still loading in the background. Gives the illusion that the page has loaded faster.

根据他们看到的文档,如果在创建pdf文件时选中了针对快速Web视图进行了优化",则IIS 6应该自动执行此操作.它被选中,并且该文件仍然不会一次加载一个页面.

According to the documentation they see, IIS 6 should automatically do this if the pdf file is created with "Optimized for fast web view" checked. It is checked, and the file will still not load a page at a time.

他们已经搜索并发现,如果文件保存正确,IIS将自动执行此操作.

They have searched and found nothing other than IIS will do this automatically if the file is saved correctly.

他们如何串流" pdf?这是因为pdf是以特殊方式保存的吗?这是处理下载的Java脚本吗?还是在IIS中需要进行更改?

How can they "stream" the pdf? Is this because the pdf's were saved in a special way? Is this a java script that handles the download? Or is there a change that needs to happen in IIS?

谢谢

更新: 文件开始如下:

Update: The file starts out like this:

%PDF-1.4
%âãÏÓ
171 0 obj << 0/Linearized 1

线性化了吗?

不是从aspx/asp页面提供PDF文档. (它只是直接发布到网站上并链接到).

The PDF document isn't being served up from an aspx/asp page. (It's just posted directly to the site and linked to).

推荐答案

您需要对PDF进行线化处理,并且不信任IIS为您完成此操作.

You need to lineraize the PDF and not trust IIS to do this for you.

有许多应用程序可以为您完成此任务.我曾经使用过CVision(压缩是首屈一指的,但是许可和SDK却很麻烦),还有一些更便宜的替代品此处,但我不知道它们的工作情况如何.

There are a number of apps that will do this for you. I have used CVision (thier compression is 2nd to none, but the licensing and SDK are a pain), there is also some cheaper alternatives here, but I dont know how well they work.

要澄清托尼的观点...(我认为)

To clarify Tony's point... (I think)

如果您实际使用过这些工具并且pdf已线性化,请尝试将PDF转换为字节数组,然后将Response.Write()字节数组(带有内容标头等)转换为客户端(在新的浏览器窗口或框架)

If you have actually used these tools and your pdf is linearized, try converting the PDF to a byte array and Response.Write() the byte array (with content headers, etc) to the client (in a new browser window or frame)

这篇关于如何在完全下载PDF文件之前将其显示在网络浏览器中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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