When I generate PDF's that uses image data, the used images seems to stay "in use". Is there a way to be sure that the PDF component releases the images?
Sometimes we delete temp files after we have generated the PDF, but the images seem to stay locked.
<error>
The process cannot access the file 'some_filepath' because it is being used by another process.
</error>
Release of used images
Re: Release of used images
Support · Jan 8, 2008Hello,
All the resources will be released after the PDF is generated and drawn. You can delete the files after saving the PDF to disk without any problem. Please make sure that your application is not using these resources which is causing this error. We are able to delete the image file after adding it to the PDF. Following is the code we used.
Document doc = new Document();
Page page = new Page();
ImageData idata = ImageData.GetImage(@"C:\Temp\test.png");
Image image = new Image(idata, 0, 0, 0.1f);
page.Elements.Add(image);
File.Delete(@"C:\Temp\test.png");
doc.Pages.Add(page);
doc.DrawToWeb();
Thanks,
ceTe Software Support Team.