Jpeg is not working - out of memory exception


#1

Hi,

We are using .NET Viewer control API version 3.3.0 and we are using ViewerHtmlHandler.
Now we are getting Out of memory exception when trying to preview jpeg image.

https://1drv.ms/i/s!Ahok18PFwl0JnC1J3Ze0vSvp0dec (4.8 MB)

I would appreciate your prompt answer as we are in production.

Kind Regards,
Novak


#2

@deric,

Thanks for using GroupDocs.Viewer for .NET. Would you please share with us the minimal code that you are using to render the provided image file? We look forward to hearing from you.


#3

Hi,

It is also breaking on your demo example solution for this version of .NET GroupDocs control.
Basically the code looks like:

var htmlConfig = new ViewerConfig
{
StoragePath = this.storagePath,
TempPath = this.tempPath,
UseCache = true
};

this.htmlHandler = new ViewerHtmlHandler(htmlConfig);

var result = new ViewDocumentResponse
{
pageCss = new string[] { },
lic = true,
pdfDownloadUrl = this.documentViewerService.GetPdfDownloadUrl(request, antiCsrf),
pdfPrintUrl = this.documentViewerService.GetPdfPrintUrl(request, antiCsrf),
url = this.documentViewerService.GetFileUrl(request),
path = request.Path,
name = fileName
};

var docInfo = this.htmlHandler.GetDocumentInfo(new DocumentInfoOptions(request.Path));
// This line is breaking with Out of memory exception.


#4

@deric,

We investigated the issue but unable to reproduce it at our end using GroupDocs.Viewer for .NET 3.3.0 or greater. The OutOfMemory exception is usually thrown when there is not enough memory to continue the execution of a process or program. Therefore, the possibility is there that your application is unable to find the required amount of contiguous memory to execute DocumentInfoOptions function for this particular file. You can try to address this exception by recompiling your app to target a 64-bit platform. For more details on this exception and its causes, please read this article.

We have also noticed that you are using a quite older version of GroupDocs.Viewer for .NET. We recommend you to please upgrade the API to its latest version for a better and improved experience. Hope it helps.


#5

Thanks for your reply.
We are planning to migrate to newer version but at the moment we need to use this old version.
The problem is that for this image (~5 MB) your engine is creating 70MB html document in Temp folder.
That is our problem with this version of control.
Can we resolve this somehow with this old version ?


#6

@deric,

Thanks for your response. In fact, when rendering the JPEG image files in HTML based rendering, the images are saved in PNG format. Usually, an image in PNG format is bigger in size (or size on disk) as compared to one in JPEG format. Therefore, in your case, the resultant HTML becomes bigger in size. I am afraid that currently, we don’t have any workaround for this, however, we have a plan to add an option in any of the upcoming versions of the API which would allow you specifying output image format (either JPEG or PNG) when rendering images as HTML. When this feature will be available, we’ll notify you here.


#7

@deric

The issue of getting a bigger sized HTML document for Jpeg images has been fixed in this update.