加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

在ASP.NET中将MS Word文档转换为PDF

发布时间:2020-12-16 00:27:48 所属栏目:asp.Net 来源:网络整理
导读:已经有类似的问题被问到,但没有什么像我的,所以在这里。 我们在ASP.NET Web服务器上收集了Microsoft Word文档,其合并字段的值由于用户表单提交而被填写。字段合并后,服务器必须将文档转换为PDF,并将其流式传输到浏览器。我们的第一个倾向是使用Visual S
已经有类似的问题被问到,但没有什么像我的,所以在这里。

我们在ASP.NET Web服务器上收集了Microsoft Word文档,其合并字段的值由于用户表单提交而被填写。字段合并后,服务器必须将文档转换为PDF,并将其流式传输到浏览器。我们的第一个倾向是使用Visual Studio Tools for Office API;然而,我们遇到了this warning from Microsoft:

Microsoft does not currently recommend,and does not support,Automation of Microsoft Office applications from any unattended,non-interactive client application or component (including ASP,ASP.NET,DCOM,and NT Services),because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

看起来场景操作可以使用Open XML SDK完成,但是什么是最好的方式将Word 2007文档转换为PDF而不打开Word?最佳解决方案是低成本,可扩展,内存占用空间小,易于部署,并具有.NET API。

解决方法

这不是开放源码,但是Aspose有几个可以做到这一点的产品,

Aspose.Pdf.Kit

Aspose.Pdf.Kit is a non-graphical PDF? document manipulation component that enables both .NET and Java developers to manage existing PDF files as well as manage form fields embedded within PDF files. Aspose.Pdf is perfect for creating new PDF files; however,developers often need to edit already existing PDF documents. Aspose.Pdf.Kit allows them to do just that. Aspose.Pdf.Kit allows developers to create powerful applications for merging data directly into PDF documents as well as for updating and managing PDF documents. Aspose.Pdf.Kit is a wonderful product and works great with the rest of our PDF products.

和Aspose.pdf

Aspose.Pdf is a non-graphical PDF? document reporting component that enables either .NET or Java applications to create PDF documents from scratch without utilizing Adobe Acrobat?. Aspose.Pdf is very affordably priced and offers a wealth of strong features including: compression,tables,graphs,images,hyperlinks,security and custom fonts. Aspose.Pdf supports the creation of PDF files through API,XML templates and XSL-FO files. Aspose.Pdf is very easy to use and is provided with 14 fully featured demos written in both C# and Visual Basic.

查看API和demos.您可以免费下载一个DLL来尝试。我以前都用过,他们的工作很棒。

还有iTextSharp是iText的一个C#端口,一个Java PDF转换器。我听说有些人尝试混合的结果。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读