Open documents from path

Hello,

I’m trying to open viewer from document path. But viewer returns error “File not found”.

If i use like this i get error;

viewer.FilePath(@“C:\aaaa\ViewerCache\test.docx”)

But if i use like this i dont get error;

viewer.FilePath(“test.docx”)

Those both two scenerios i set storage path “C:\aaaa\ViewerCache”.

Can i use full path of document for view? Or they must be in storage path?

Hello,


Thank you for your request. You can’t use full file path because Viewer build the path for file by using the root path which you have set. Since that when you try to open document with path viewer.FilePath(@“C:\aaaa\ViewerCache\test.docx”) Viewer will try to open it via such path:
C:\aaaa\ViewerCache\test.docx\C:\aaaa\ViewerCache\test.docx

Simply use relative paths. For example if file is in the root storage - use only file name test.docx, if file is in the sub-folder under root storage, for example “myDocx” it will be viewer.FilePath("/myDocx/test.docx")

Best regards.

If i use with relative path, i cant reach network drives i guess or i have do lots of jobs.

I figured it out, I’m gonna open stream with specific path, that i want to reach. And give it to viewer. I can access every accessible path with that usage i guess.

Kind regards

Hi again,


Yes, the best way is to use the streams but also you can set network storage as root storage - simply add network storage as a network drive.

If you need more info about using network drive - check this documentation

Best regards.

Hello,

Thank you for your help, i’ll check the documentation.

Kind regards,