DocumentCache problem

Hi,

when uploading document, we are creating Cache with MemoryStream:
var dc = new DocumentCache(Server.MapPath(ConfigurationManager.AppSettings["document_groupdocs_licence_path"]),
Server.MapPath(ConfigurationManager.AppSettings["document_root_storage_path"]));

var bytes = Convert.FromBase64String(docContent);
var ms = new MemoryStream(bytes) {Position = 0};

dc.GenerateHtml(ms, filename, fileextension, true, null, null, false, true, false, true);

That works fine.

But when previewing that file, we are using:
FilePath(filename);

but that doesn't work.
How the View should look like , to preview already cached document generated with stream?
(we are using asp.net mvc)

Thanks.

Hello,

Thank you for the request. Yes, you can view a cached stream as you need. To do this you should use the .Stream() property of the Viewer instead of .FilePath(). For example, it will look like this:

.Stream(null, fileName, fileExtension, fileDisplayName, true, streamCreator)

As you can see, you should set null as the first parameter, switch the useCachedStreamContentsIfPossible parameter to true, and provide a streamCreator parameter. For more info, please check the documentation (scroll down to the “this section” link: http://prntscr.com/8rh0po).

Best regards.