如何在IE浏览器中显示xps文件 [英] How to show xps file in browser other then IE

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

问题描述

您好b $ b

我希望使用asp.net,c#4.0在浏览器中显示与PDF相同的XPS文件。

经过一些文章我开始知道即使两者都是固定文件格式(PDF和XPS),我们也无法呈现XPS文件与PDF格式文件相同。

请以最佳方式向我推荐。我不知道HTML5,所以如果可以使用HTML5那么请告诉我。



我尝试用下面的代码打开xps(与PDF相同):

Hi
I am looking to show a XPS file in browser same as PDF using asp.net, c#4.0.
After going through some article I came to know that even though both are fixed file format(PDF and XPS) we can not render XPS file same as we follow for PDF files.
please suggest me the best possible way. I don''t have knowledge of HTML5 so if it is possible using HTML5 then plz let me know.

I tried bellow code to open xps(same as for PDF):

protected void Page_Load(object sender, EventArgs e)
    {
        string pdfPath = Server.MapPath("~/xpstest.xps");
        WebClient client = new WebClient();
        Byte[] buffer = client.DownloadData(pdfPath);
        Response.ContentType = "application/vnd.ms-xpsdocument";
        Response.AddHeader("content-length", buffer.Length.ToString());
        Response.BinaryWrite(buffer);
    }



它帮助我在IE浏览器中打开xps,但我得到一个弹出窗口,将文件保存在其他浏览器中。



问候,

Prashant


It helps me to open xps in IE browser but I am getting a popup to save the file in other browsers.

Regards,
Prashant

推荐答案

据我所知,并非所有浏览器都支持这种格式,所以,不幸的是,你不能这样做



在某种程度上,原则上你可以将一些XPS数据映射到普通HTML (我不知道为什么HTML5可以提供帮助,特别是)并将XPS导出为HTML。原则上,这是可能的,因为XPS规范是开放的;这是ECMA-388标准:

http://en.wikipedia.org/wiki/Open_XML_Paper_Specification [ ^ ],

http://www.ecma-international.org/publications/standards/Ecma-388.htm [ ^ ]。



因为你可以得到格式的完整描述,你可以做到,但这只是一些特定的映射,而不是一对一的对应关系。这些格式的方法非常不同。 HTML是一个流文档,XPS非常严格,包含附着在纸张上的图形对齐。但是,由于大多数XPS文档实际上来自流文档(例如Word,LibreOffice等等),这种导出在很多情况下都会成功。



不幸的是,从第一次尝试开始,我找不到任何开源的即用型解决方案,但你可以尝试找到一些东西: http: //bit.ly/WHI3lW [ ^ ]。



-SA
To best of my knowledge, not all browsers support the format, so, unfortunately, you cannot do it.

To some extent, in principle, you can map some XPS data to "plain" HTML (I don''t know why did you thing that HTML5 can help, specifically) and "export" XPS to HTML. In principle, this is possible just because XPS specification is open; this is the ECMA-388 standard:
http://en.wikipedia.org/wiki/Open_XML_Paper_Specification[^],
http://www.ecma-international.org/publications/standards/Ecma-388.htm[^].

As you can get full description of the format, you can do it, but this is just some particular mapping, not one-to-one correspondence. The approaches of these formats are very different. HTML is a flow document, XPS is very rigid, contains the alignment of graphics attached to the pieces of paper. However, as most XPS documents are actually originated from flow documents (such as Word, LibreOffice and a lot more), such "export" would be successful in very many cases.

Unfortunately, from the first attempt, I could not find any open-source ready-to-use solutions, but you can try to find something: http://bit.ly/WHI3lW[^].

—SA


这篇关于如何在IE浏览器中显示xps文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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