异步可插拔协议和嵌入式ActiveX控件(例如PDF) [英] Asynchronous Pluggable Protocols and embedded ActiveX controls (e.g. PDF)

查看:100
本文介绍了异步可插拔协议和嵌入式ActiveX控件(例如PDF)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个APP从磁盘上的文件读取并将原始数据解密到内存流中,然后传递给客户端。这对于任何文本或图像文件都很有效,但我似乎无法让它工作

用于PDF文件。我检查了流,并且解密后的数据是正确写入MemoryStream的(我可以将内存流转储到APP中的
磁盘并打开它),但是我甚至无法在浏览器窗口中打开Acrobat

activeX控件。浏览器显示

状态栏中的''从网站下载'',同时数据被解密,然后只是坐在那里(未冻结),没有

显示任何错误或任何内容。


我认为这与需要设置MIME类型有关,

我是在这个过程的不同阶段尝试了好几次,但是好像没有做任何事情的b $ b。如果我尝试对MIME类型

''application / pdf'进行硬编码,那么一切都会像往常一样显示出来,导致

我相信我是做错了。 (不应该有任何文件

键入''application / pdf''导致Acrobat阅读器打开,然后当读者看到它时抛出

错误这不是一个有效的PDF格式?)我是什么?b $ b缺少什么?


如果有帮助我可以发布我的代码。任何建议都会非常值得赞赏,并且可能会因为敲打

墙而引起很大的轰动。谢谢。

I have an APP that reads from a file on disk and decrypts the raw data
into the memory stream that then gets passed to the client. This works
great for any text or image files, but I can''t seem to get it working
at all for PDF files. I checked the stream, and the decrypted data is
written properly to the MemoryStream (I can dump the memory stream to
disk in the APP and open it fine), but I can''t even get the Acrobat
activeX control to open in the browser window. The browser displays
the ''downloading from site'' in the status bar while the data is
decrypted, then just sits there (not frozen) afterward, without
displaying any errors or any content.

I figured this had something to do with needing to set the MIME type,
which I tried several times, at different points in the process, but
that doesn''t seem to do anything. If I try to hardcode a MIME type of
''application/pdf'', everything still displays as it always does, leading
me to believe that I''m doing something wrong. (Shouldn''t any file
typed as ''application/pdf'' cause the Acrobat reader to open, then throw
an error when the reader see that it''s not a valid pdf?) What am I
missing?

I can post my code if that will help. Any suggestions will be greatly
appreciated and probably save my head from a lot of banging against a
wall. Thanks.

推荐答案

< ig ******* @ hunter.com>在消息中写道

news:11 ********************** @ g14g2000cwa.googlegr oups.com
<ig*******@hunter.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com
我有一个APP从磁盘上的文件中读取并将原始数据解密到内存流中,然后传递给客户端。这对于任何文本或图像文件都很有用,但我似乎无法获得它完全适用于PDF文件。我检查了流,然后将解密后的数据正确写入MemoryStream(我可以将内存流转储到APP中的磁盘并打开它),但我不能甚至让Acrobat activeX控件在浏览器窗口中打开。
I have an APP that reads from a file on disk and decrypts the raw data
into the memory stream that then gets passed to the client. This
works great for any text or image files, but I can''t seem to get it
working at all for PDF files. I checked the stream, and the
decrypted data is written properly to the MemoryStream (I can dump
the memory stream to disk in the APP and open it fine), but I can''t
even get the Acrobat activeX control to open in the browser window.




你是否尊重BINDF_NEEDFILE标志?当客户端指定此标志时,您必须在包含

响应的硬盘驱动器上提供该文件的名称。一些客户,其中的Actobat Reader,如果没有

这样的文件就不能工作。

-

带着美好的祝福,

Igor Tandetnik


有足够的推力,猪飞得很好。但是,这不是一个好主意。很难确定他们将要去哪里,而且当他们飞行时,坐在他们下面可能会很危险

。 - RFC 1925



Do you honor BINDF_NEEDFILE flag? When the client specifies this flag,
you must provide a name of the file on hard drive containing the
response. Some clients, Actobat Reader among them, don''t work without
such a file.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Igor,


感谢您的快速回复,我在帖子中看到了您的名字。 ve $ / $
一直在关注。


我很确定这就是问题(这会影响保存

文件到磁盘使用''目标保存为''?)但我还没有能够确定如何处理该标志的
。我在哪里可以检查它是否已设置,然后

然后返回磁盘上文件的位置?


文件我是获取已经以加密的

格式存储在本地。我是否可以简单地将路径传递给文件,或者

我是否必须为Acrobat Reader创建一个缓存的,未加密的版本来支付
句柄?更一般地说,缓存的对象是通过协议处理还是通过开放客户端作为常规文件读取?


谢谢,


Ian Garrison

Igor,

Thanks for your quick reply, I see your name all over the posts I''ve
been looking at.

I''m pretty sure that''s the problem (would that also affect saving the
file to disk using ''save target as''?) but I haven''t been able to figure
out how to handle that flag. Where can I check to see if it''s set, and
then return the location of the file on disk?

The files I''m getting are already stored locally in an encrypted
format. Would I be able to simply pass the path to the file as is, or
do I have to create a cached, unencrypted version for Acrobat Reader to
handle? More generally, will the cached objects be processed through
the protocol or read as a regular file by the opening client?

Thanks,

Ian Garrison


ig *******@hunter.com 写道:
我很确定这是问题(这也会影响将
文件保存到磁盘使用''目标保存为''?)但我还没有能够弄明白如何处理该标志。我在哪里可以检查它是否已设置,然后返回磁盘上文件的位置?


该标志由IInternetBindInfo :: GetBindInfo以及

其他标志和BINDINFO结构返回。 APP通常在开始时首先调用




您使用
报告文件名
IInternetProtocolSink :: ReportProgress(BINDSTATUS_C ACHEFILENAMEAVAILABLE)。

该文件不必在浏览器缓存中,它可以在

文件系统中的任何位置。

文件我收到的已经以加密的格式存储在本地。我是否能够简单地将路径传递给文件,或者我是否必须为Acrobat Reader创建一个缓存的未加密版本来处理?


后者。它不必被缓存,无论这意味着什么。

更一般地说,缓存的对象是通过协议处理还是通过开放读取为常规文件客户端?
I''m pretty sure that''s the problem (would that also affect saving the
file to disk using ''save target as''?) but I haven''t been able to
figure out how to handle that flag. Where can I check to see if it''s
set, and then return the location of the file on disk?
The flag is returned by IInternetBindInfo::GetBindInfo, together with
other flags and BINDINFO structure. An APP normally calls it first thing
in Start.

You report the file name with
IInternetProtocolSink::ReportProgress(BINDSTATUS_C ACHEFILENAMEAVAILABLE).
The file does not have to be in the browser cache, it can be anywhere in
the file system.
The files I''m getting are already stored locally in an encrypted
format. Would I be able to simply pass the path to the file as is, or
do I have to create a cached, unencrypted version for Acrobat Reader
to handle?
The latter. It doesn''t have to be "cached", whatever that means.
More generally, will the cached objects be processed
through the protocol or read as a regular file by the opening client?




作为常规文件读取。这就是BINDF_NEEDFILE的重点。一个客户

满足于使用IInternetProtocol :: Read不会设置

这个标志。只有想要访问该文件的客户才能直接设置它。

-

有了最好的祝福,

Igor Tandetnik


有足够的推力,猪飞得很好。但是,这不是一个好主意。很难确定他们将要去哪里,而且当他们飞行时,坐在他们下面可能会很危险

。 - RFC 1925



Read as regular file. That''s the whole point of BINDF_NEEDFILE. A client
that is content with using IInternetProtocol::Read exclusively won''t set
this flag. Only clients that want to access the file directly set it.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


这篇关于异步可插拔协议和嵌入式ActiveX控件(例如PDF)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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