Convert Office documents to Pdf
Convert docx to pdf
IConverter conveter = new DocumentConverterFactory().GetConverter(ContentType.DOCX);
var sourcePath = Path.Combine(Environment.CurrentDirectory, "docs", "Test.docx");
var targetPath = Path.Combine(Environment.CurrentDirectory, "docs", "Testdocx.pdf");
conveter.Convert(sourcePath, targetPath, false);
Convert xls to pdf
IConverter conveter = new DocumentConverterFactory().GetConverter(ContentType.XLS);
var sourcePath = Path.Combine(Environment.CurrentDirectory, "docs", "Test.xls");
var targetPath = Path.Combine(Environment.CurrentDirectory, "docs", "Testxls.pdf");
conveter.Convert(sourcePath, targetPath, false);
Convert ppt to pdf
IConverter conveter = new DocumentConverterFactory().GetConverter(ContentType.PPT);
var sourcePath = Path.Combine(Environment.CurrentDirectory, "docs", "Test.ppt");
var targetPath = Path.Combine(Environment.CurrentDirectory, "docs", "Testppt.pdf");
conveter.Convert(sourcePath, targetPath, false);
The 0x800A03EC Cannot access the file is arguably the worst error you can experience, as the given error message is completely misleading. To fix that, you have to the following:
Create the following new folders on your Windows Server + IIS machine: