We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Windows temp folder fills up with pdf copies when using PDFViewer to upload files

I am using v15.2460.0.40 of the Syncfusion PDFViewer in a .Net MVC environment. My c:\windows\temp folder is being filled with (an example for naming convention) Syncfusion_PDFviewer_11c30e66-a5a4-4535-6791220ff6f4 files. It makes a direct copy of the file I am uploading to a different directory (in order to view and page through), then when I close the document, my file is removed from my initialized folder I set up, but remains in the c:\windows\temp directory. As a result it is filling up my hard drive and I have to manually delete those files regularly.
Is there a setting to either change where these temp files will be uploaded to or is there a setting in IIS to not upload these files or at least remove them after the viewer is closed?
I plan to move to an AZURE cloud environment, so my administration will be hands off. I remember having to give full permissions to this path in order to use the Syncfusion PDFViewer when we launched this site with this control.
If I need to add more information, let me know.

3 Replies

RT Ramya Thirugnanam Syncfusion Team April 3, 2019 08:39 AM UTC

Hi Eric, 
Thanks for contacting Syncfusion support. 
We have exposed an API to specify the temporary file directory with the desired file location. Kindly, upgrade to our latest Essential Studio release version to work with this API using the below link, 
Please find the API details from the below,  
The property “CachePath” is exposed in the server side of the PDF Viewer control. kindly use the below code in the PDFViewerController.cs to specify the temporary file location. 
public object Load(Dictionary<stringstring> jsonResult)  
            PdfViewerHelper helper = new PdfViewerHelper();  
            //load the multiple document from client side   
            if (jsonResult.ContainsKey("newFileName"))  
                PdfViewerHelper.CachePath = HttpContext.Current.Server.MapPath("~/Data");//Store the cache data in the data folder of the sample.  
                var name = jsonResult["newFileName"];  
                var pdfName = name.ToString();  
                helper.Load(HttpContext.Current.Server.MapPath("~/Data/" + pdfName));  
                if (jsonResult.ContainsKey("isInitialLoading"))  
                    PdfViewerHelper.CachePath = HttpContext.Current.Server.MapPath("~/Data");");//store the cache data in the data folder.  
                   helper.Load((HttpContext.Current.Server.MapPath("~/Data/HTTP Succinctly.pdf")));  
            string output = JsonConvert.SerializeObject(helper.ProcessPdf(jsonResult));  
            return output;  
Note: If the provided path is not valid the cache files will be stored in the default location.  
Also, the PDF document data which is stored in the temp location can be removed from the cache using the below code in the server side,  
Code example:  
string[] files = Directory.GetFiles(System.IO.Path.GetTempPath());  
            foreach (string tempFile in files)  
                FileInfo fileInfo = new FileInfo(tempFile);  
                if (fileInfo.Extension == ".txt" && fileInfo.Name.Contains("Syncfusion_PDFviewer_"))  
Ramya T  

ER Eric Robbins April 3, 2019 03:29 PM UTC

Thank you Ramya,

We will update our PDFViewer dll's and employ this new method to our codebase.

RT Ramya Thirugnanam Syncfusion Team April 4, 2019 05:24 AM UTC

Hi Eric,  
Thanks for your update. 
Ramya T 

Live Chat Icon For mobile
Up arrow icon