Pre-populate cache

Hi,
Is there a specific way in the API to generate the cache or we have to do it using the ViewerHtmlHandler.GetPages method (for html rendering) and save the result?

Thanks in advance,
Juan

@jsouteras8,


Thanks for using GroupDocs.Viewer for .NET.

If you have set ViewerConfig.UseCache to true then you can simply call ViewerHtmlHandler.GetPages to populate the cache for the source document automatically. It doesn’t require you to save the HTML pages manually using the code. The below sample code serves this purpose:


<table class=“highlight tab-size js-file-line-container” data-tab-size=“8” style=“box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; tab-size: 8; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, “Segoe UI”, Helvetica, Arial, sans-serif, “Apple Color Emoji”, “Segoe UI Emoji”, “Segoe UI Symbol”; font-size: 14px; background-color: rgb(255, 255, 255);”><td id=“file-tmp-cs-L1” class=“blob-num js-line-number” data-line-number=“1” style=“box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: SFMono-Regular, Consolas, “Liberation Mono”, Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rgba(27, 31, 35, 0.3); text-align: right; white-space: nowrap; vertical-align: top; cursor: pointer; user-select: none;”><td id=“file-tmp-cs-LC1” class=“blob-code blob-code-inner js-file-line” style=“box-sizing: border-box; padding: 0px 10px; position: relative; line-height: 20px; vertical-align: top; overflow: visible; font-family: SFMono-Regular, Consolas, “Liberation Mono”, Menlo, Courier, monospace; word-wrap: normal; white-space: pre;”>ViewerConfig config = new ViewerConfig();
config.StoragePath = “D:/Storage”;
config.UseCache = true;

ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
string guid = input.xlsx;
List<PageHtml> Pages = htmlHandler.GetPages(guid);



Hope it helps.

Warm Regards

@jsouteras8,


You are always welcome.

Warm Regards