Issue in GroupDocs viewer - Sharepoint project

Hi,


I have integrated group docs viewer in sharepoint successfully and I am currently using temporary license. But from last two days I am facing issues in below line execution.

License lic = new License();

I have attached screen shot regarding the error.

Things I already tried:
1) Created one console app and is working fine in it.
2) Created another demo sharepoint project, but didn’t worked.
3) Restarted my VM, but didn’t worked.

It was all working fine previously, but now it is failing and throwing error related to “GroupDocs.foundation” not found.

Can you please suggest a solution in this.

Thanks,
Jayesh



Hi Jayesh,


Thanks for using GroupDocs.Viewer for .NET.

From the exception message, I guess you need to set deployment target as “WebApplication” in Package.package. Please see the attached screenshot for how to change deployment target. This should help you to get rid of this issue. Please try and share your feedback.

Have a nice weekend ahead.

Warm Regards

Hi Usman,


Thanks for your response. As per your mentioned suggestion the error related to license gone but now another error is coming up. I have attached screen shot for the same.

Thanks,
Jayesh

Hi Jayesh,


Thanks for posting your issue.

The error message you sent in screenshot is related to reference of GroupDocs.Viewer assembly. This type of issue often occurs when the reference is added for a different version of the API and application is using assembly of some other version. Please try to remove the reference entry for GroupDocs.Viewer and delete associated assembly files from your project and add reference again manually. Please try and check if the issue is vanished.

We shall be waiting for your response.

Warm Regards

Hi Usman,


Thanks for your support.

This issue resolved only by upgrading to 3.4.0 from 3.3.0 version.

I am having another query regarding the temp folder and files which created in storage path. For the mechanism to delete this temp folder and files, I came around below links for the same topic:

http://www.groupdocs.com/docs/display/viewernet/Description+of+GroupDocs.Viewer+DocumentCache+class

http://www.groupdocs.com/docs/display/viewernet/Removing+Cache+Files

But when I tried to use “<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; line-height: 17.3333px; white-space: pre; background-color: rgb(255, 255, 255);”>viewerImageHandler.ClearCache(OlderThanDays);” showing me error(screen shot is attached for the same). And same thing happens with the “<span style=“color: rgb(51, 51, 51); font-family: “Courier New”, Courier, monospace; font-size: 12.6667px; line-height: 1.3; background-color: rgb(255, 255, 255);”>DocumentCache<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; line-height: 17.3333px; white-space: pre; background-color: rgb(255, 255, 255);”>” class.

Please guide through how to implement deletion of temp folder and files. Also I wanted to know the best practice to implement the same.

Is the “cache” or creation of “temp folders/files” are same thing?

Thanks,
Jayesh



Hi Jayesh,


Its good to know that your issue is resolved.

Please note that ClearCache() method receives TimeSpan as parameter. Try below code to clear cache files older than specified days.

viewerImageHandler.ClearCache(TimeSpan.FromDays(1));

Secondly, GroupDocs.Viewer API uses temp folder as default cache directory if you don’t set cache path in configuration. Both, cache folder in configuration and temp folder, are used for same purpose.

If you have any further questions, please let us know.

Warm Regards

Hi Usman,


The error I mentioned regarding ClearCache() is that there is no such method found in ViewerImageHandler class.

Thanks,
Jayesh

Hi Jayesh,


We apologize for inconvenience.

Please make sure that you are using GroupDocs.Viewer for .NET 3.3.0 or greater. However, we are also investigating your issue at our end and shall get back to you shortly. Please stay tuned with us.

Warm Regards

Hi Usman,


Thanks for your constant support.

I wanted to know whether the issue I mentioned in our previous conversation regarding “ClearCache() not found” is resolved or not.

Secondly I have another question regarding the printing of document. Actually I want to directly print document (not using the print button in Viewer) even though the document is not loaded in groupdocs viewer. So is there any method provided so that I can directly Print the document or any callback function that can print the document after the document is loaded in viewer.

Thanks,
Jayesh

Hi Jayesh,


I have investigated your issue related to ClearCache method but could not reproduce it at my end. There could be two possible reasons behind this issue

  1. You are using API version lesser than 3.3.0.
  2. You are passing invalid NoOfDays parameter inside ClearCache method.

Please note that the API provides two methods to clear cache files.

  • ClearCache() - Clears all files in the cache directory
  • ClearCache(TimeSpan.FromDays()) - Clears files older than specified days.

For your convenience, I have also attached screenshots of implementation of both methods.

Secondly, printing feature in SharePoint plugin is implemented with the help of jQuery. The API does not provide specific method to print the files. However, it provides ViewerHandler.GetFile method with print settings which is implemented in the plugin for printing purpose. You can check GetPdfPrintUrl method in default.aspx.cs and GetFile.aspx.cs in the SharePoint plugin’s source code to understand its working. As the plugin is open sourced, you can also modify/enhance the functionality according to your own requirements.

If you have any further questions, please let us know.

Warm Regards

Hi Usman,


Thanks for your good and constant support.

I am facing a new issue in GroupDocs Viewer.

Using your online app “Containerize.IdentityServer - Single sign-on to access all applications and services of Aspose Pty Ltd.” when tried to view corrupted excel file it shows error popup having message “The file is corrupted”. I have attached the screen shot for the same.

But when I view the same file in sample MVC and Sharepoint project it is not showing any kind of error popup.

Thanks,
Jayesh

Hi Jayesh,


Thanks for sharing your issue with us.

Unfortunately, this feature is not yet implemented in sample front end applications. However, I am logging your request in GitHub issues for the implementation of this feature. We shall look into it and in case of any update, we will inform you here. You can also follow https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/issues/71 for further updates.

In case of any confusion, please feel free to let us know.

Warm Regards

Hi Jayesh,


Your requested feature, logged in GitHub issues as https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/issues/71 has been implemented. Please download latest source code and share your feedback.

Warm Regards

Hi Usman,


I have integrated GroupDocs-Viewer in SharePoint custom webpart solution. I am facing some issue realted to ClearCache functionality. Attached are the screen shots for the same.

I have passed “TimeSpan.FromDays(1)” as parameter in ClearCache method, still older files are not deleted when the method is called. It is not throwing any kind of error. Although this functionlity is working perectly when running MVC sample project.

Thanks,
Jayesh

Hi Jayesh,

Thanks for providing the details of the issue.

We investigated your issue and successfully reproduced it in SharePoint WebPart solution. The issue has been logged and as soon as we get any updates on it, we will notify your here.

Have a nice day.
Warm Regards

Hi Usman,


1) Is there any update on ClearCache functionality?

2) For the issue “[MVC-10012] : Implementation of Popup Messages in Case of Exceptions · Issue #71 · groupdocs-viewer/GroupDocs.Viewer-for-.NET · GitHub” you have an update for MVC version. Is this change implemented for SharePoint plugin
https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/tree/master/Plugins/GroupDocs_Viewer_SharePoint

Thanks,
Jayesh

Hi Jayesh,


Thanks for coming back to us.

Currently, we don’t have any updates and as soon as we have any, we will inform you.

We appreciate your cooperation and patience.

Warm Regards

Hi Jayesh,


Thanks for being patient.

The SharePoint plugin for GroupDocs.Viewer for .NET has been updated on GitHub and clear cache feature is working as expected. Please download the updated source code and share your feedback with us.

2) For the issue “[MVC-10012] : Implementation of Popup Messages in Case of Exceptions · Issue #71 · groupdocs-viewer/GroupDocs.Viewer-for-.NET · GitHub” you have an update for MVC version. Is this change implemented for SharePoint plugin


This feature is not yet implemented in SharePoint plugin. However, I have logged your request in GitHub issues as https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/issues/106. We will look into it and once the feature is implemented, we’ll notify you. You can also keep track of the issue in case of further updates.

In case of any confusion, please feel free to write us.

Warm Regards

Hi Usman,


Thanks for the update.

Clear Cache feature is working fine now. Files under temp folder gets deleted based on TimeSpan parameter.

I have one concern related to the to files which are generated at the Storage folder level (as highlighted in attached screenshot). Is there any mechanism to delete this file? Because in real business scenario there will be lots of file after a long time.

Thanks,
Jayesh

Hi Jayesh,


Thanks for sharing the feedback with us.

The API does not provide any builtin function to delete files from the storage folder. You can delete these files manually or by using some code. There is a workaround in which you can use ClearCache function to remove cache files as well as the other files in the storage by using the same folder for both. However, in this case, each time when you remove cache files, all the other files in storage folder will also be removed. Following code snippet uses same folder for storage directory and for the cache directory as well.

<span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>private<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> <span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>static<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> <span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>string<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> _storagePath = HttpContext.Current.Server.MapPath(<span class=“pl-s” style=“box-sizing: border-box; color: rgb(24, 54, 145); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>"~/_layouts/15/GroupDocs-Viewer-SharePoint/Storage/"<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>);
<span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>private<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> <span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>static<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> <span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>string<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> _tempPath = HttpContext.Current.Server.MapPath(<span class=“pl-s” style=“box-sizing: border-box; color: rgb(24, 54, 145); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>"~/_layouts/15/GroupDocs-Viewer-SharePoint/Storage/"<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>);
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>
Configuration settings:

<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>_config = <span class=“pl-k” style=“box-sizing: border-box; color: rgb(167, 29, 93); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>new<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> ViewerConfig
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>{
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> StoragePath = _storagePath,
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> CachePath = _tempPath,
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”> UseCache = <span class=“pl-c1” style=“box-sizing: border-box; color: rgb(0, 134, 179); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>true
<span style=“color: rgb(51, 51, 51); font-family: Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; white-space: pre; background-color: rgb(255, 255, 255);”>};

In case of any confusion, please do let us know.

Warm Regards