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.Wordbut 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.
Smart MediaPosted Aug 16, 2019, 6:19 AM
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:
Tony ChenPosted Nov 6, 2018, 3:56 AM
Mohamed AbedallahPosted Mar 9, 2017, 11:54 AM
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);
}
}
}
}
/*******************************************/
VIBIN pPosted Mar 9, 2017, 2:06 AM
Gnanavel SekarPosted Mar 9, 2017, 1:23 AM
Lisa WhitePosted Mar 9, 2017, 1:15 AM
Ramesh PalanivelPosted Mar 9, 2017, 12:26 AM