如何使用ASP.NET C#将word文件(docx)转换为pdf [英] How to convert a word file(docx) to pdf using ASP.NET C#

查看:295
本文介绍了如何使用ASP.NET C#将word文件(docx)转换为pdf的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

How to convert a word file(docx) to pdf using asp.net c#.Please suggest me a free Api for this
i tried with
Microsoft.Office.Interop.Word
but failed some error is coming "COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
This will solved by installing word2007 addiin "saveaspdf".but problem is that i cant install this on server.
 
so please help me with a another option to convert word file to pdf with any free api Refference (dll).with out using Microsoft.Office.Interop.Word.

< br $> b $ b

我的尝试:





What I have tried:

i tried with
Microsoft.Office.Interop.Word
but failed some error is coming "COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."
This will solved by installing word2007 addiin "saveaspdf".but problem is that i cant install this on server.

推荐答案

之前一直在问......

如何在C#中将word文档转换为pdf [ ^ ]

将Word文档转换为ASP.NET服务器上的PDF [ ^ ]



试试!
It has been asking before...
How to convert word document to pdf in C#[^]
Convert Word-Documents to PDF on an ASP.NET Server[^]

Try!


一点点搜索引导你此解决方案 [ ^ 。虽然它是一个Java组件,但NuGet带来了在.NET中使用它所需的一切。
A little bit of searching leads you to this solution[^]. While it's a Java component, the NuGet brings in everything you need to get this working in .NET.


嗨。,



请看一下这个链接



如何在C#中将word文档转换为pdf [ ^ ]



Hi.,

Please have a look at this link

How to convert word document to pdf in C#[^]

public Microsoft.Office.Interop.Word.Document wordDocument { get; set; }







Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();
           wordDocument = appWord.Documents.Open(@"C:\Users\Desktop\test.docx");
           wordDocument.ExportAsFixedFormat(@"C:\Users\Desktop\test11.pdf", WdExportFormat.wdExportFormatPDF);





谢谢



Thanks


这篇关于如何使用ASP.NET C#将word文件(docx)转换为pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆