如何在asp.net Web应用程序中以编程方式将.docs文件转换为PDF? [英] How to convert.docs files to PDF programmatically in asp.net web application?
本文介绍了如何在asp.net Web应用程序中以编程方式将.docs文件转换为PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C#代码:如何在asp.net Web应用程序中以编程方式将.docs文件转换为PDF?
C# code: How to convert.docs files to PDF programmatically in asp.net web application?
推荐答案
使用 iTextSharp [ ^ ]。
C#或.Net不支持任何PDF转换。您需要使用第三方组件。
iTextSharp [< a href =http://sourceforge.net/projects/itextsharp/target =_ blanktitle =新窗口> ^ ]是一个免费的图书馆,可以为您完成。
你也可以使用 Aspose [ ^ ]。它虽然付了。
C# or .Net for that matter does not support any PDF conversion. You need to use third party components.
iTextSharp[^] is a free library which does it for you.
You can also use Aspose[^]. It's paid though.
如果您有MS 2007(带有XPS和PDF插件)或MS2010,您可以使用SaveAs方法直接将doc / docx文件保存为pdf。 br $>
If you have a MS 2007(with XPS and PDF addon) or MS2010, you can directly save the doc/docx files to pdf using the "SaveAs" method.
object filename = Path.GetTempPath() + @"\test.pdf";
object fileFormat = WdSaveFormat.wdFormatPDF;
oDoc.SaveAs(ref filename, ref fileFormat, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing);
object save = false;
oDoc.Close(ref save, oMissing, oMissing);
这篇关于如何在asp.net Web应用程序中以编程方式将.docs文件转换为PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文