Zoom and Thumnail trigger from Code

Hi,


We have a document management application where users can preview documents for which we are using GroupDocs viewer for .NET(Licensed).

We have our documents in a shared location so before previewing we download the document locally in the application location (MVC Web application) and then generate the preview. As we don’t want to keep loading up the application we delete the downloaded local copy of document in the documentLoadCompleted.groupdocs event.

The issue is zoom and Thumbnail do not work after this as I think those use the document to create the different sized images which is deleted.

Are there any methods which can be called from our code to generate all the possible zoom images and thumbnails before user actually tries for it so that we can delete the file and user zoom still works. If this is not possible then is it possible to have preview working folder as a shared location, in that case we don’t have to download local copy and there is no issue with the deletion of the document as well.

Thanks,
Dhivya

Hello Dhivya,


Thank you for the request. Yes, you can use shared storage as a root storage for the Viewer. To set it as a root storage you should use such code:

Viewer.SetRootStoragePath("\PC-NAME\shared folder name");

Thank you.

Hi,


Thanks for the reply. I have a shared location for files but files are inside multiple different folders in this location. How does that going to work?

Thanks,
Dhivya

Hello Dhivya,


Thank you for coming back. Since you have several folders inside the root storage you just need to add folder name to the path in the “.FilePath()” property of the widget.

For example let say you have “my awesome documents” folder inside the root storage and file called “test.pdf” inside this folder. To view this pdf you should use such code:
.FilePath("/my awesome documents/test.pdf")

Thank you.

Hi,


I am initializing the viewer in javascript using the below code. so do I need to say the file path in the first mentioned parameter of filePath?

$(’#ControlName").groupdocsViewer({
filePath: data.fileName,
docViewerId: ‘doc_viewer’ + tabName,
PreloadPagesCount: 1,
quality: 100, showThumbnails: true, openThumbnails: false,
initialZoom: 100, zoomToFitWidth: true, zoomToFitHeight: false,
width: 0, height: 0, backgroundColor: ‘’, showFolderBrowser: false, showPrint: true,
showDownload: false, showZoom: true, showPaging: true, showViewerStyleControl: false, showSearch: true,
viewerStyle: 1, supportTextSelection: true, usePdfPrinting: true,
localizedStrings: localizedStrings, thumbsImageBase64Encoded: thumbsImageBase64Encoded,
toolbarButtonsBoxShadowStyle: ‘0 1px 0 rgba(200, 0, 0, 0.2) inset, 0 1px 0 rgba(200, 0, 0, 0.15)’,
toolbarButtonsBoxShadowHoverStyle: ‘0 1px 0 rgba(160, 0, 0, 0.4) inset,0 1px 0 rgba(160, 0, 0, 0.3)’,
thumbnailsContainerBackgroundColor: ‘’, thumbnailsContainerBorderRightColor: ‘’, toolbarBorderBottomColor: ‘’,
toolbarInputFieldBorderColor: ‘’, toolbarButtonBorderColor: ‘’, toolbarButtonBorderHoverColor: ‘’,
thumbnailsContainerWidth: 0, useBrowserCache: false,
showDownloadErrorsInPopup: true, showImageWidth: false, showHeader: true, minimumImageWidth: 0,
enableStandardErrorHandling: true, useHtmlBasedEngine: false, fileDisplayName: ‘’
});

Thanks,
Dhivya

Hello Dhivya,


Yes, in such case you should set to the value of the data.fileName the path as I showed earlier.

Thank you.

Thanks for the quick reply.


I have tried that and I see the following error in the console and the loader continues to show loading…

Uncaught TypeError: Cannot read property ‘code’ of null (GroupDocsViewer.all.js in line code:b.data.code)

Thanks,
Dhivya

Hi again,


Please investigate attached code example. This example will show how to view the document from sub folder (sub folder name is test)

Also please compare your code of the Viewer with code from the example - we recommend you to use code from the example.

Please share with us which browser you use and it’s version.

Also please check if you can view documents stored in the root of the root storage.

Thank you.

Hi,


Thanks very much. There was issue with backslash and forward slash which was causing the issue which is fixed now. it is working perfectly now.

Thanks,
Dhivya

Hello Dhivya,


We glad to hear that the issue is resolved now.

Thank you.