We have files coming from multiple directories, so how do we change filesDirectory on every call to viewer?
################################################
# GroupDocs.Viewer configurations
################################################
viewer:
# Files directory path
# Absolute path to files directory
filesDirectory: 'DocumentSamples/Viewer'
Hi @supahoops
Might you provide more details? What code you are using?
@supahoops
I’m sorry for the delayed response. You can change a directory in a server-side action in ViewerApiController that returns a config for the UI.
[HttpGet]
[Route("loadConfig")]
public ViewerConfiguration LoadConfig()
{
var config = globalConfiguration.Viewer;
config.SetFilesDirectory("My-Directory");
return config;
}
1 Like
Thank you for your reply, We are testing above solution you provide. However we got another query. Documents are rendering slightly defferently in IE. GroupDocs-in-chrome.PNG (83.7 KB)
GroupDocs-in-IE11.PNG (81.9 KB)
In IE 11 broswer, check box are not rendering. Can you help us please?
Thanks
Hi there also can we pass file path in to below action ? so can determine what filesDirectory should be as below example
@supahoops
Sure, you can set any config option here including DefaultDocument
e.g.
[HttpGet]
[Route("loadConfig")]
public ViewerConfiguration LoadConfig()
{
var config = globalConfiguration.Viewer;
config.SetFilesDirectory("My-Directory");
config.SetDefaultDocument("default.doc");
return config;
}
If you look at my previous query, we want to pass in file path that will determine what FilesDirectory should be. Is that possible ?
var fileDir = filePath.Contains(“SecureDataFiles”) ? “\SecureDataFile\Files” : “\share\DataFile\Files”
@supahoops
Sure, you can decide on what folder to use directly in the API controller as this is a main place where all request go through e.g. check the GetDocumentPage method. In general, it doesn’t matter what path you see at UI as the server decides where it would read the resources.
Thank you for your reply, we will try that. Your MVC example works fine with IIS express but when we try to work with IIS we are not able to make it work
image.png (9.1 KB)
@supahoops
Thank you for your response. For the new issue I’ve created the separate topic Document viewer MVC example does not work in IIS.