We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting excel file containing images to pdf leaves temp files hanging around

Hi I’m converting an excel file to pdf using the following code:

workbook.Save(xmlFile, FileFormatType.AsposePdf);
Pdf pdf = new Pdf();
pdf.BindXML(xmlFile, null);
pdf.PageSetup.PageHeight = PageSize.LetterHeight;
pdf.PageSetup.PageWidth = PageSize.LetterWidth;

pdf.Save(pdfNames[i]);

if (File.Exists(xmlFile)) {
File.Delete(xmlFile);
}

I’m noticing that if the excel file contains images, that temporary files are being left around by this code. The files have names like: 470691200tmp854.xml_img0.jpg

Short of writing code to clean this directory periodically is there anyway to remove the files created by this process? This code is going to be running in a server environment where potentially thousands of pdf documents will be created daily and disk space is going to get eaten up rather quickly, and clearly this is unacceptable.

Thanks,

Adam

Hi Adam,

You can use the following property to remove these temporary images:

objPdf.IsImagesInXmlDeleteNeeded = true;

If you need any further help, please do let us know.

Regards,