I have the following code:
byte[] attachmentData = new byte[0];
List documentPages = new List();
int? totalPages = (int?)null;
if (!string.IsNullOrEmpty(adminPortalViewModel.FileName))
{
HttpPostedFileBase file = Request.Files[0];
Stream stream = file.InputStream;
if (adminPortalViewModel.MaterialType == "Document")
{
attachmentData = new byte[file.ContentLength + 1];
stream.Read(attachmentData, 0, file.ContentLength);
ViewerConfig config = new ViewerConfig();
ViewerHtmlHandler htmlHandler = new ViewerHtmlHandler(config);
HtmlOptions htmlOptions = new HtmlOptions();
htmlOptions.IsResourcesEmbedded = true;
htmlOptions.PdfOptions.EnablePreciseRendering = true;
List<PageHtml> pages = htmlHandler.GetPages(stream, htmlOptions);
totalPages = pages.Count();
documentPages = new List<DocumentPageData>();
foreach (PageHtml pageHtml in pages)
documentPages.Add(new DocumentPageData() { PageHtml = pageHtml.HtmlContent });
}
}
My exception is being throw on the line: List pages = htmlHandler.GetPages(stream, htmlOptions);
I’ve attached the file that is causing issues:
GroupDocs.Viewer.Exception.GroupDParticipantActivityReport.zip (9.5 KB)
ocsViewerException: ‘Object reference not set to an instance of an object.’