we are having problems with image files that are blocked by the process of our web application.
After several tests we are almost sure that this is often caused by the export process in Word and PDF (spire.doc) in this point:
- Code: Select all
p_prod_foto_desc.AppendPicture(System.Drawing.Image.FromFile(path_foto));
We have therefore better to rewrite the method to be able to impose the release of the resource:
- Code: Select all
Image im = System.Drawing.Image.FromFile(path_foto);
p_prod_foto_desc.AppendPicture(im);
im.Dispose();
The problem is that the method "Dispose ()" does go wrong your library (exporting both in word and in pdf):
Exception Details: System.ArgumentException: Parameter is not valid.
Source Error: document.SaveToFile(codice_offerta.Replace("/", "_").Replace(".", "") + ".docx", FileFormat.Docx2010, Response, HttpContentType.Attachment);
We need to use this method in order to avoid that the application takes locked system resources (image file). Or you have some alternative method to achieve the same result? Thanks