Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
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.


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.
Posted
Updated 8-Mar-17 23:34pm
Comments
F-ES Sitecore 9-Mar-17 5:46am    
You're going to struggle to do this for free. Word is a proprietary format so anyone who writes code to access it and do it well is unlikely to give it away for free. There are some free doc readers\writers (DocX for example) but none that I know of support conversion to PDF. There are plenty of components that will do this (Spire.Doc, GemBox.Document) but none of them are free.

 
Share this answer
 
Comments
Member 11471318 9-Mar-17 1:51am    
This not working for me i allredy mentioned in my question without using word i need to convert it.Thanks for your replay.
please help
Maciej Los 9-Mar-17 1:57am    
"Not working for me" is not informative at all!
Seems you haven't read related articles, because an author of second article ("Convert...") provides a custom way to convert word document into pdf.
Congrats!
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.
 
Share this answer
 
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
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900