客户端 Microsoft Word 到 PDF 转换 - 如何在 MVC3 中进行?

发布于 2024-12-29 23:30:10 字数 163 浏览 2 评论 0原文

我的页面上有一个文件上传控件。当用户在控件中选择 .DOC/DOCX 文件时,我需要在页面上以 PDF 格式显示所选文件。

我可以像往常一样使用嵌入标签显示 PDF,但是我需要遵循的顺序是什么?

我正在使用 ASP.NET MVC3。我可以使用 javacript 执行此操作吗?

I have a file upload control on my page. When a user selects a .DOC/DOCX file in the control, I need to show the selected file on the page but in PDF format.

I can show the PDF using embed tag as usual, but what should be the sequence be that I need to follow here?

I am using ASP.NET MVC3. Can I perform this using javacript?

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

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

发布评论

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

评论(1

千仐 2025-01-05 23:30:10

使用 JavaScript 将 DOCX 文件转换为 PDF 可能有点困难,我不会冒险涉足这个领域。因此,一旦文件上传到服务器上,您就可以使用一些标准库来执行转换。有一些库,例如 Aspose.Words (商业但非常可靠)或DocX(免费)这将允许您执行此操作。文件转换为 PDF 后,您可以将其存储在服务器上并返回其位置,以便客户端可以构建 标记动态指向它并将其内联显示为预览。

Converting a DOCX file to PDF using javascript might be a little tough and a territory I wouldn't venture into. So once the file is being uploaded on the server you could use some standard library that will perform the conversion. There are some libraries such as Aspose.Words (commercial but very reliable) or DocX (free) which will allow you to do this. Once the file is converted into a PDF you could store it on the server and return its location so that the client can build an <iframe> or <object> tag dynamically pointing to it and show it inline as a preview.

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