How to convert a word file(docx) to pdf using asp.net c#.Please suggest me a free Api for this
i tried with 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))."
Code
Microsoft.Office.Interop.WordThis 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.

Ramesh PalanivelRank #372 · 6.8K reputationPosted Mar 8, 2017, 7:26 PM EST
Gnanavel SekarRank #333 · 7.5K reputationPosted Mar 8, 2017, 8:23 PM EST
VIBIN p48 reputationPosted Mar 8, 2017, 9:06 PM EST
Mohamed AbedallahRank #2,074 · 697 reputationPosted Mar 9, 2017, 6:54 AM EST
Since you don't want to use Microsoft Interop Word, I think you should consider using professional SDK. This code shows how you can convert DOCX to PDF using LEADTOOLS:
/*******************************************/
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.DocumentWriters;
using Leadtools.Svg;
using Leadtools.Documents;
using Leadtools.Caching;
using Leadtools.Annotations.Core;
using Leadtools.Forms.Ocr;
using Leadtools.Documents.Converters;
public void DocumentConverterExample()
{
using (DocumentConverter documentConverter = new DocumentConverter())
{
var inFile = @"c:\Leadtools.docx";
var outFile =@ "c:\output.pdf";
var format = DocumentFormat.Pdf;
var jobData = DocumentConverterJobs.CreateJobData(inFile, outFile, format);
jobData.JobName = "conversion job";
var job = documentConverter.Jobs.CreateJob(jobData);
documentConverter.Jobs.RunJob(job);
if (job.Status == DocumentConverterJobStatus.Success)
{
Console.WriteLine("Success");
}
else
{
Console.WriteLine("{0} Errors", job.Status);
foreach (var error in job.Errors)
{
Console.WriteLine(" {0} at {1}: {2}", error.Operation, error.InputDocumentPageNumber, error.Error.Message);
}
}
}
}
/*******************************************/
Tony Chen27 reputationPosted Nov 5, 2018, 10:56 PM EST
Smart Media24 reputationPosted Aug 16, 2019, 2:19 AM EDT
For converting DOCX to PDF even with placeholders, I have created a free "Report-From-DocX-HTML-To-PDF-Converter" library with .NET CORE under the MIT license, because I was so unnerved that no simple solution existed and all the commercial solutions were super expensive. You can find it here with an extensive description and an example project: https://github.com/smartinmedia/Net-Core-DocX-HTML-To-PDF-Converter
It can perform these conversions (alongside a template / report engine, which replaces placeholders):
You can add placeholders for:
Lisa White141 reputationPosted Mar 8, 2017, 8:15 PM EST