We have requirement to convert uploaded PPT or PPTX files into image files. We developed this working locally with following (POC code):
Application pptApplication = new Application();
Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = pptApplication.Presentations.Open2007(filePath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
List<string> files = new List<string>();
for (int i = 1; i <= pptPresentation.Slides.Count; i++)
{
pptPresentation.SaveCopyAs(serverPath + randomId, PpSaveAsFileType.ppSaveAsPNG, MsoTriState.msoTrue);
files.Add(root + "Uploads/Slide" + i + ".PNG");
}
pptPresentation.Close();
Now when this code is deployed on Windows Server 2012 R2, I receive following error:
This error looks like some access permissions issue and when I googled I found several solutions which I tried with no luck, here's some of them:
Install office on server - not make any sense to have office on server :( well I installed and still getting same issue.
Install office Interop Assemblies on server - i can't find this assembly for windows server 2012, the one i found here https://www.microsoft.com/en-us/download/details.aspx?id=3508 is not supported for 2012 and when I installed it doesn't work.
Tried this solution https://stackoverflow.com/a/30117146 as well
We can't switch to paid solutions like Aspose, Spire etc
Any help on this thread is highly appreciated. Thanks.