Is it possible to “destroy” existed viewer? If I’m not mistaken an open viewer holds some resources. Let’s suppose that I want to release these resources. How can I do it?
Hello Igor,
Thank you for your request. You can destroy existed Viewer via JavaScript. Simply remove div with Viewer using this JS code:
containerElement.groupdocsViewer("destroy");
containerElement.remove();
Error you get means that you don't have rights to create file in network storage. Please set user rights to read/write for this folder
Also If you have any additional questions please feel free to get back in touch.
Hi Pavel,
Thank you for the additional info. We had concluded from your question that you are asking about resource disposing that GroupDocs.Viewer holds, not about cleaning a HTML page. If I understood you correctly, the following text is an answer. If no, please clarify your request.
Assuming that GroupDocs.Viewer holds only the latest current cache for the current document, the document that is displaying at this moment. Any other resources, all other cache and even target documents themselves, can be removed, replaced, renamed and so on - GroupDocs.Viewer doesn’t need them.
In answer to your second question - no, you have not. In order to create temp folder with all subfolders and cache files within them GroupDocs.Viewer requires permission to create, read, write and so on.
If you are using ASP.NET Development Server, aka Cassini, make sure that you are running MS Visual Studio with Administrator rights.
If you are using IIS - check the permission for the project folder. In order to resolve this issue and allow access to this folder please fulfill the following steps:
1. Open your IIS manager.
2. Right click on your web-site → Edit permissions → Security tab.
3. Add full access for Users group. .
If this does not help you, you can also change the identity of your application pool. Change the identity to a user or account which definitely has all the necessary permissions for the “inetpub” folder and all its subfolders (if you are hosting your web-site in the “inetpub” folder, of course).
Hope it helps. If you have more questions please feel free to contact us.
Hi Igor,
hi,
p.s. On a somewhat unrelated note, these GroupDocs forums don’t seem to be behaving too well for me when using the latest version of Firefox - they’re showing incorrect information about who has the last post in the thread/topic, and clicking ‘Reply’ button seemed to take me to the main forum page…
Hi Greg,
Thank you for your interest in GroupDocs. You can remove cache of GroupDocs.Viewer using method “public void RemoveOldEntries(TimeSpan olderThan)” that is located in the class “DocumentCache” (Description of GroupDocs.Viewer DocumentCache class). If you want to remove “temp” folder at all, you should do it by yourself using a “Directory.Delete” method. If you want to leave “temp” folder, but to remove all its content, you can follow these suggestions: How to delete all files and folders in a directory?
If you will have more questions please feel free to contact us.
hi Denis,
thanks for your response on the forum Earlier today I was doing a bit of experimenting with setting the following two config items to point to different locations: “DocumentViewerRootStoragePath” and “DocumentViewerWorkingDirectoryPath” After separating the two out, looks like the path pointed to by DocumentViewerRootStoragePath will contain ‘temp’ folder and vs.bin file, while the path pointed to by DocumentViewerWorkingDirectoryPath will contain the two folders (Cache, Processing). So, am I understanding correctly that the API call you mentioned in your forum response - “RemoveOldEntries”, will be removing older-than-time-period only b elow the folder referenced by DocumentViewerWorkingDirectoryPath config option (i.e. old ? While the folder below DocumentViewerRootStoragePath (e.g. ‘temp’) needs to be manually cleaned up by the consumer application?
This message was posted using Email2Forum by denisgvardionov.
Hi Greg,
In general, you are right. The main idea behind the separation of "RootStoragePath" and "WorkingDirectoryPath" is to locate target documents that should be viewed apart from the GroupDocs.Viewer's internal mechanics (like the "Cache" and "Processing" subfolders in the WorkingDirectoryPath folder). One location for target documents, and another for the things that should not matter to the end-user.
One more thing that you should take into accout is the fact that GroupDocs.Viewer can handle documents not only as files in the "RootStoragePath" folder, but also as byte streams (which implements System.IO.Stream) and web resources. So in order to handle these documents, GroupDocs.Viewer creates a "temp" subfolder inside the "RootStoragePath" folder and there the "FromStream" and "FromUrl" sub-subfolders. Finally, when clicking the "Open file" button (located in the top left corner of the GroupDocs.Viewer's web interface), you will be able to browse all documents from the "RootStoragePath" folder and all other documents that were received from streams and/or web resources.
On the other hand, the "WorkingDirectoryPath" folder is "hidden" from you, you can manage it only indirectly using GroupDocs.Viewer's methods. The "RemoveOldEntries" method cleans out the old cache in the "WorkingDirectoryPath" folder, but it doesn't clean the folder structure - only files. If you want to remove the "WorkingDirectoryPath" folder itself with all its content, use the standard .NET System.IO methods that I mentioned in the previous post. Removing cache-related folders in OK, it doesn't "hurt" the GroupDocs.Viewer; it will recreate them if they don't exist.