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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

143727 Apr 2,2019 09:56 PM UTC Apr 4,2019 05:24 AM UTC ASP.NET MVC - EJ 2 3
loading
Tags: PDF Viewer
Eric Robbins
Asked On April 2, 2019 10:47 PM UTC

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.

Ramya Thirugnanam [Syncfusion]
Replied On 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));  
            }  
            else  
            {  
                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_"))  
                {  
                   fileInfo.Delete();  
                }  
            }  
 
 
Regards,  
Ramya T  


Eric Robbins
Replied On 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.



Ramya Thirugnanam [Syncfusion]
Replied On April 4, 2019 05:24 AM UTC

Hi Eric,  
 
Thanks for your update. 
 
Regards, 
Ramya T 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon