IOException with Aspose.Slides.Presentation

Hello

I have a Visual Studio 2005 WinForm project (C#), and have downloaded Aspose.Total. When I execute the code below, I get an IOException for the 2-nth button click on the call to SaveToPdf(). Any ideas on what the problem might be?

Thanks

Mike

Error: The process cannot access the file 'c:\tmp\foo.pdf' because it is being used by another process.

private void button1_Click(object sender, EventArgs e)
{
string sBaseDir = "c:\\tmp\\

string sInputFile = sBaseDir + "foo.ppt";

string sPDFOutputFile = sBaseDir + "foo.pdf";

Presentation pres = new Presentation(sInputFile);

pres.SaveToPdf(sPDFOutputFile);

PdfConverter converter = new PdfConverter();

converter.BindPdf(sPDFOutputFile);

converter.DoConvert();

int imageCount = 1;

while (converter.HasNextImage())
{
converter.GetNextImage(sBaseDir + imageCount + ".tiff", System.Drawing.Imaging.ImageFormat.Tiff);
imageCount++;
}
}


This message was posted using Page2Forum from Know Issues - Aspose.Slides for .NET and Java

Dear Mike,

Thanks for considering Aspose.Slides.

You should not get this error in latest version of Aspose.Slides 2.8.5.0.

Anyway, modify your line into this

FileStream fout = new FileStream(sPDFOutputFile, FileMode.Create, FileAccess.Write);
pres.SaveToPdf(sPDFOutputFile);
fout.Close();

Further, you don’t need Aspose.PDF to convert slide images into TIFF, you can directly save them in TIFF format.

Please see