The code below can convert pptx file to pdf without any problem.
try
{
//Opens the specified presentation
IPresentation presentation = Presentation.Open(@"D:\YUs\Test\pp2.pptx");
presentation.ChartToImageConverter = new ChartToImageConverter();
presentation.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Best;
PresentationToPdfConverterSettings settings = new PresentationToPdfConverterSettings();
settings.ShowHiddenSlides = true;
PdfDocument doc = PresentationToPdfConverter.Convert(presentation, settings);
doc.Save(@"D:\YUs\Test\pp2.pdf");
doc.Close();
}
catch (Exception err)
{
Response.Write("error when saving presentation file: " + err.ToString() + "<br/><br/><br/>");
}
but when I tried to use the code to convert .ppt file, it returns this error:
Syncfusion.Compression.Zip.ZipException: Zip exception.Can't locate end of central directory record. Possible wrong file format or archive is corrupt. at Syncfusion.Compression.Zip.ZipArchive.Open(Stream stream, Boolean closeStream) at Syncfusion.Presentation.FileDataHolder.Open(Stream stream) at Syncfusion.Presentation.Presentation.SetArchieveItems(Stream stream) at Syncfusion.Presentation.Presentation.ParseDocument(Stream fileStream) at Syncfusion.Presentation.Presentation.OpenAsStream(Stream stream) at Syncfusion.Presentation.Presentation.Open(String fileName) at PUBLIC_ConvertOfficeToPdfNetOffice.Page_Load(Object sender, EventArgs e) in d:\ConvertOfficeToPdfNetOffice.aspx.cs:line 30
I've tried with many different PPT file but it will always return the same error.
Syncfusion Essential Presentation library only supports manipulating PPTX files and that's why you are getting this error when trying to load PPT files. We should have made the error message clearer and we will make this change.
We will also log a feature request for support PPT files in the future.