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

前端之家收集整理的这篇文章主要介绍了在ASP.NET中将MS Word文档转换为PDF前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
已经有类似的问题被问到,但没有什么像我的,所以在这里。

我们在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.

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

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

原文链接:https://www.f2er.com/aspnet/252333.html

猜你在找的asp.Net相关文章