I'm getting the following exception when trying to integrate Foxit PDF Sdk with my .net core web application.
[Office to PDF conversion error]: (For Office-to-PDF conversion only) Office COM has not been initialized successfully.
I tried the PDF conversion code in a console application then it was working fine. I have tried both .doc and .docx file types and the exception occurs on both files.
This is the conversion logic I used according to the developer guide.
using foxit.common;
using foxit.pdf;
using System.IO;
// Conver Word file to PDF file.
string word_file_path = @"E:\FilesInput\file-doc.doc";
string saved_pdf_path = @"E:\FilesOutput\file-doc.pdf";
try
{
using (foxit.addon.conversion.Word2PDFSettingData word_convert_setting_data = new foxit.addon.conversion.Word2PDFSettingData())
{
foxit.addon.conversion.Convert.FromWord(word_file_path, "", saved_pdf_path, word_convert_setting_data);
}
}
catch (Exception e)
{
Console.WriteLine("Exception :", e);
}
Please help me understand what the issue here is. Any help is much appreciated.
Thanks
The Considerations for server-side Automation of Office article states the following:
If you deal with Open XML documents only consider using the Open XML SDK, read more about that in the Welcome to the Open XML SDK 2.5 for Office article. If you need to process binary formats you may consider using any third-party components designed for the server-side execution.