Issue in File Selection Change

Hello Support Team,

I m working on trial version of Document Viewer in MVC-4. After in chatting discussion with “Group Docs” Operator. I got a code to display Viewer by using Jquery. on First Time loading Viewer working fine, I am facing the Issue, after changing the file Selection to view different File in Viewer, Previous loaded file remains in Viewer, Newly Selected file does not appear in viewer, Although i m changing the path each & every time & then binding the code. Even Alert in Jquery showing me accurate path after File Selection. please check my below code & let me know the Issue to resolve, i shall be thankful to u
===================================================================
function GroupDocsViewer(FilePath)
{
////// Each Time Alert shows Right path (Changes File path), but viewer does not change File///////
alert(FilePath);
var localizedStrings = null;
var thumbsImageBase64Encoded = null; $(’#test’).groupdocsViewer({
localizedStrings: localizedStrings, thumbsImageBase64Encoded: thumbsImageBase64Encoded, filePath: FilePath, quality: 100,
showThumbnails: true, openThumbnails: false, initialZoom: 100, zoomToFitWidth: false, onlyShrinkLargePages: false,
zoomToFitHeight: false, width: 0, height: 0, backgroundColor: null, showFolderBrowser: true, showPrint: false, showDownload: false, showZoom: true,
showPaging: false, showViewerStyleControl: false, showSearch: true, preloadPagesCount: null, preloadPagesOnBrowserSide: false,
convertWordDocumentsCompletely: false, viewerStyle: 1, supportTextSelection: true, usePdfPrinting: false, toolbarButtonsBoxShadowStyle: null,
toolbarButtonsBoxShadowHoverStyle: null, thumbnailsContainerBackgroundColor: null, thumbnailsContainerBorderRightColor: null,
toolbarBorderBottomColor: null, toolbarInputFieldBorderColor: null, toolbarButtonBorderColor: null, toolbarButtonBorderHoverColor: null,
thumbnailsContainerWidth: 0, jqueryFileDownloadCookieName: ‘jqueryFileDownloadJSForGD’, showDownloadErrorsInPopup: false, showImageWidth: false,
showHeader: true, minimumImageWidth: 0, enableStandardErrorHandling: true, useHtmlBasedEngine: true, useImageBasedPrinting: true, fileDisplayName: null,
downloadPdfFile: true, searchForSeparateWords: false, preventTouchEventsBubbling: false, useInnerThumbnails: false,
watermarkText: ‘Watermark text’, watermarkColor: -2147443200, watermarkPosition: ‘Diagonal’, watermarkFontSize: 90,
printWithWatermark: true, supportPageReordering: false, searchHighlightColor: null, currentSearchHighlightColor: null,
treatPhrasesInDoubleQuotesAsExactPhrases: false, usePngImagesForHtmlBasedEngine: false, showOnePageInRow: true, loadAllPagesOnSearch: false,
useEmScaling: false, ignoreDocumentAbsence: false, supportPageRotation: false
});
}

Hello Faisal,

We are sorry to hear that you have this issue. I had a chat with you some time before. As I remember, you want to change document in the GroupDocs.Viewer using JavaScript, from client-side. Our developers will add this feature to the GroupDocs.Viewer widget in the near future, but now, at this moment, you need to perform document replacing by yourself and I’ll describe it now.

In general, for changing the document you need to completely remove the DIV where GroupDocs.Viewer control is present with all its content, and then recreate it and call the “groupdocsViewer” method one more time. Source code is below.





Change document





As you can see, there are two DIVs, one inside another, and a button (which in fact is a DIV too). When page is loading at first time ("$(document).ready"), ‘document1.pdf’ will be displayed. When user clicks the
Change document
button, DIV “test” will be removed and recreated, and “SetGroupDocsViewer” method will be invoked again, and ‘document2.doc’ will be displayed at this time.

If you will have more questions please feel free to contact us.