We have noticed that when we use the PDF concatenate functionality there are temporary files left in the Windowx/Temp folder. Although the file sizes are 0 bytes windows has a limit of 65565 files allowed in this folder and when it hits this limit aspose can no longer write any no files to this so falls over. Can you tell me if this is a bug in aspose with these files being left over or is there a way to clean them up when we have finished concatenating a pdf?
Hi Graeme,
Thanks for the quick reply. After testing it is happening on a number of different windows environments and also different versions of Aspose. It is the concatenate function that is falling over when the limit is met in the folder which says to me that the concatenate method is trying to write a file into the temp directory. Is there anything we could be doing that could cause the file to be left over, i.e. not closing a memory stream or something like that?
It is important to note that we only get these empty temporary files left behind when the code is running in an ASP.NET application running under IIS (we use both IIS 7 on Windows Server 2008 and IIS 7.5 on Windows 7 and Windows Server 2008 R2).
We do not have this problem when the same code is running in a unit test, a console application, or if you are using Visual Studio Web Development Server or IIS Express. Please find our code below which replicates the issue.
{
var pdf = new Aspose.Pdf.Pdf();
var section = pdf.Sections.Add();
section.Paragraphs.Add(new Text(content));
var stream = new MemoryStream();
pdf.Save(stream);
return stream;
}
var pdf1 = CreatePdfStream(“first”);
var pdf2 = CreatePdfStream(“second”);
using (var result = new MemoryStream())
{
var pdfEditor = new Aspose.Pdf.Kit.PdfFileEditor();
pdfEditor.Concatenate(pdf1, pdf2, result); // Empty temporary files created here and not deleted eg “tmp3E59.tmp” in “C:\Windows\Temp”
}
Hi Graeme,
Can you confirm you are using IIS and not the Web Development platform to test this scenario (the default when you create a new project is the web development server).
We have further tracked this down to the licence key. If we set the licence key at startup then the temporary file is left behind. If we dont use a licence key we get a watermark but the temporary file is removed.
Hi Graeme,
Is there any update on this at all?
Hi Graeme,
Have you tried it with and without the licence file?
Hi Graeme,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
We further checked your issue with and without license on different machines and still we are unable to reproduce the problem.
Also, you are using some old version of Aspose.Pdf for .NET and Aspose.Pdf.Kit for .NET. I would suggest you to download and try the latest merged version of Aspose.Pdf for .NET v7.5 (with all features of Aspose.Pdf.Kit for .NET merged under Aspose.Pdf.Facades namespace) and try it. Please check the following links to update you code.
Migration from earlier versions of Aspose.Pdf for .NET
If you still face any issue, please send us your sample application to reproduce the issue. This will help us in narrowing down the cause.
Sorry for the inconvenience,
Hi Graeme,