Viewer is not rendering all pages on Azure deployment. It works fine when running local the first debug time through, then the local also stops rendering any page after 1. Rendering pages also takes a significant amount of time using embedded resources.
Please provide accurate sample code to render an entire document, regardless of type to the viewer. We do not have the option to use pagination or cache as these are classified documents, and the URLs cannot be exposed publicly so all data must be sent back via the API.
It appears as though sometimes the logic to returnValue += Encoding.UTF8.GetString(bytes) only gets called once, and does not iterate through the streams pages. This is inconsistent as other times it does. What am I doing wrong?
using (MemoryStream fileStream = new MemoryStream())
{
await cloudBlockBlob.DownloadToStreamAsync(fileStream, accessCondition, blobRequestOptions, operationContext);
fileStream.Position = 0;
fileStream.Flush();
cloudBlobContainer = null;
cloudBlockBlob = null;
fileStream.Position = 0;
fileStream.Flush();
LoadOptions loadOptions = new LoadOptions(FileType.FromExtension(Path.GetExtension(attachment.FilePath)));
using (Viewer viewer = new Viewer(fileStream, loadOptions))
{
HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources(
(_) => new MemoryStream(),
(int pageNumber, Stream pageStream) =>
{
var bytes = ((MemoryStream)pageStream).ToArray();
returnValue += Encoding.UTF8.GetString(bytes);
});
viewOptions.Minify = true;
viewOptions.RenderToSinglePage = false;
viewOptions.SpreadsheetOptions = SpreadsheetOptions.ForOnePagePerSheet();
viewOptions.SpreadsheetOptions.SkipEmptyColumns = true;
viewOptions.SpreadsheetOptions.SkipEmptyRows = true;
viewOptions.SpreadsheetOptions.RenderGridLines = true;
viewOptions.SpreadsheetOptions.RenderHeadings = true;
viewOptions.SpreadsheetOptions.TextOverflowMode = TextOverflowMode.AutoFitColumn;
viewOptions.RenderResponsive = true;
viewer.View(viewOptions);
}
}
**********************
This Topic is created by vladimir.litvinchik using Email to Topic tool.