我们在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.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 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转换器。我听说有些人尝试混合的结果。