Is there any open-source sdk that I can use in an ASP.Net application to convert any office document to pdf. (I specifically need to convert a DOCX to PDF, but would like the ability to convert Excel and powerpoint files too).
I know that I could use Office automation using code shown below, but I don't want to use Office automation, as its not recommended for use in non-interactive applicationsKB257757
I have found that Aspose has a component that can be used for this (paid solution), but I was wondering if there were any open-source solutions out there.
//reference: Microsoft.Office.Interop.Word.dll
//using Word = Microsoft.Office.Interop.Word;
public static void Convert(string documentFilePath, string outputPath)
{
var ap = new Word.Application {Visible = false};
var document = ap.Documents.Open(documentFilePath);
document.ExportAsFixedFormat(outputPath,
WdExportFormat.wdExportFormatPDF,
OptimizeFor: WdExportOptimizeFor.wdExportOptimizeForPrint,
BitmapMissingFonts: true, DocStructureTags: false);
document.Close();
}
NOTE: I have seen some people recommend using OpenXML for this. But OpenXML does not provide you any method to convert an Office document to a PDF document.