如何在客户端浏览器中预览表示文件内容的字节数组?

发布于 2024-11-04 02:50:49 字数 290 浏览 1 评论 0原文

我们需要与文档管理系统进行交互,该系统将文件(主要是 PDF 和 DOC 和 DOCX)保存为字节数组,并保存其文件扩展名。
因此,我们需要构建一个文件查看器,在客户端浏览器中显示文件。
我们考虑将 DOC 文件转换为 PDF 并在浏览器中预览转换后的文件,其他人考虑将字节数组转换为 HTML(这个解决方案对我们来说是一个大问题,因为我们不知道如何做到这一点,也不知道它是否可用) 并传输渲染的 html。
但我们并不认为这些解决方案是最好的跨浏览器解决方案。

那么,有没有办法实现这样的功能呢?哪个必须是跨浏览器解决方案?

We are in a need to interact with a Document Management Systems which saves file (mostly PDF & DOC & DOCX) as an array of bytes and saves also its file extension.
So, we need to build a file viewer which display files in client's browser.
We think of converting DOC files into PDF and preview converted file in browser, others think of converting array of bytes to HTML (this solution is a big question for us as we don't know how to do this and if this is available or not) and transfer rendered html.
But we don't think that these solutions are the best and cross browser solutions.

So, is there any way to do such functionality? which must be a cross browser solution?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

剩余の解释 2024-11-11 02:50:49

您必须回答的第一个问题是用户是否需要能够编辑文档。如果是这样,那么您最好的“查看器”将是 Word 和 Adob​​e 客户端应用程序。请注意,在这种情况下,您还需要让用户能够上传(并可能签入)已编辑的文档。

如果用户只需要读取权限,那么您当然可以在他们的浏览器中向他们显示文件的图像或 PDF。如果您选择 PDF 路线,使用 Adob​​e reader 会省钱,但用户体验会“更笨重”。

如果您想为用户提供只读视图,您需要将 .doc 文件“渲染”为 PDF、TIFF、PNG 或其他格式。我不建议在浏览器中执行此操作,除非您的所有文档都非常简单。

如果您的用户需要一个基于 Web 的界面来显示所有呈现的 .doc 和 .pdf 文件,那么您可能需要考虑使用 java 或基于 activex 的文档查看小程序。 Daeja 是此类查看器最受欢迎的供应商,它甚至使您的用户能够对文档进行注释。

还有一点注意。渲染 .doc 文件可能是一个非常昂贵、繁琐且容易出错的过程。我在多家公司的许多系统上工作过,都尝试过这种方法,但无论我们做了什么或花了多少钱,它的效果从来都不是很好。

祝你好运!

汤姆普尔

The first question you have to answer is whether the users need to be able to edit the documents. If so, then your best "viewer" is going to be a the Word and Adobe client apps. Please note that in this case, you will also need to give the users the ability to upload (and possibly check-in) the edited documents.

If the users just need read access, then you can certainly just show them an image or PDF of the file in their browser. If you go the PDF route, you will save money using Adobe reader, but it will be a "clunkier" user experience.

If you want to give your users a read-only view, you will need to "render" .doc files into PDF's or TIFF's or PNG's or whatever. I don't recommend doing this in the browser unless ALL of your documents are VERY simple.

If you users require a single, web-based interface for all of their rendered .doc and .pdf files, then you may want to consider using an java or activex-based document viewing applet. Daeja is the most popular vendor for this type of viewer, and it even gives your users the ability to annotate documents.

One more note. Rendering .doc files can be a very expensive, cumbersome, and error-prone process. I've worked on numerous systems at multiple companies that have tried this, and no matter what we did or how much we spent, it never worked terribly well.

Good luck!

Tom Purl

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文