Free Support Forum -

Wanted to render txt file from blob in MVC


I am trying to render the txt file as htmlview using groupdocs evaluation version. We need to preview a lots of documents and most of them working fine in this way. We are planning to buy the license once after the evaluation of this product.

But when I tried to render the .txt file using the following code , its hangs in between and unable to proceed. Please find below code.
string imageFilesPath = Path.Combine(imageFilesFolder, “page-{0}.html”);
storagePath = _configuration.GetSection(“StorageContainerAddress”)?.Value + “/” + storagePath;
using (Viewer viewer = new Viewer(() => GetRemoteFile(storagePath)))
MemoryPageStream pageStreamFactory = new MemoryPageStream(pages);

                    ViewInfo info = viewer.GetViewInfo(ViewInfoOptions.ForHtmlView());
                    pageCount = info.Pages.Count;
                    //HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(pageStreamFactory);
                    HtmlViewOptions options = HtmlViewOptions.ForEmbeddedResources(imageFilesPath);
                return new JsonResult(pageCount);
        } catch(Exception ex)

Highly Appreciate your immediate response. I am able to do this for pdf, jpg, png, dwg etc.


Please share following details and we’ll investigate this scenario:

  • Sample txt file
  • API version that you integrated in the project (e.g. 19.10, 20.1)

the version is 20.1.0
any txt file is fine. I am unable to open even a sample one I have created with simple text

1 Like


Can you please share a simple console application using that this issue could be reproduced at our end? We’ll appreciate your cooperation.