I am trying to use the PowerPoint Automation Service to convert documents from .ppt to .jpg. However even though I am trying to follow the msdn example (which is a bit different), it doesn't seem to work.
Here is my code:
SPFile sourceFile = SPContext.Current.Web.GetFile(sourceURL);
SPFolder folder = sourceFile.ParentFolder;
Stream inputStream = sourceFile.OpenBinaryStream();
SPFileStream outputStream = new SPFileStream(SPContext.Current.Web, 1024);
PictureRequest request = new PictureRequest(inputStream,"ppt",PictureFormat.Jpg,outputStream);
IAsyncResult result = request.BeginConvert(SPServiceContext.GetContext(SPContext.Current.Site), null, null);
request.EndConvert(result);
folder.Files.Add("convertedFileName.jpg", outputStream, true);
Whenever I do this, in line "request.EndConvert(result)" I get the following exception:
"The specified document could not be converted."
System.Exception {Microsoft.Office.Server.PowerPoint.Conversion.ConversionException}
StackTrace: "at Microsoft.Office.Web.Common.AsyncResult`1.WaitForCompletion() at Microsoft.Office.Server.PowerPoint.Conversion.Request.EndConvert(IAsyncResult result)"
Does anybody have any idea how to investigate that error or possibly fix?