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 cached stream as you need. To do this you should use .Stream() property of the Viewer instead of…FilePath() . For example it will looks next:
.Stream(null, fileName, fileExtension, fileDisplayName, true, streamCreator)

As you can see you should set bull as the first parameter, switch to true the “useCachedStreamContentsIfPossible” parameter and you should set “streamCreator” parameter. For more info about it please check this documentation (scroll down to this section).

Best regards.