Welcome Guest Search | Active Topics | Sign In | Register

A generic error occurred in GDI+, JPEG Image to MemoryStream Options
Matt Scott
Posted: Friday, October 2, 2015 6:32:43 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
Hi, we're intermittently getting a crash when certain images (normally 1MB+) are included in a web page we are trying to create a PDF from.

We're using HtmlToPDF version 5.0.80.2.

The error is "A generic error occurred in GDI+, JPEG Image to MemoryStream".

My question is is there a fix and if not is there a way of handling the error rather than it crashing the page / service?

Thanks in advance, Matt.
eo_support
Posted: Friday, October 2, 2015 9:58:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

This is a known issue of GDI+ that most likely occurs on Windows 7 or older systems when we tries to save image in JPEG format (PDF's built-in image format). We have applied various workaround in our latest build but it can still occur even though much less frequently. You can do the following to reduce the chances of hitting this error:

1. Make sure your image is already in JPEG format;
2. Make sure you do not set HtmlToPdf.Options.JpegQualityLevel;

These two would cause the image data to be copied as is thus skipping the JPEG encoding part. You can also upgrade to the latest build and see if it helps. In the long run we are planing to completely remove the dependency on GDI+ so that we will be able have full control over such issues.

Thanks!
Matt Scott
Posted: Friday, October 2, 2015 10:04:54 AM
Rank: Member
Groups: Member

Joined: 10/3/2014
Posts: 14
I see, thanks for getting back to me.
I can confirm we are not setting JpegQualityLevel.
It does seem to occur more on PNG images now you mention it, I presume this means all images are converted to JPEG for PDFs then?
eo_support
Posted: Friday, October 2, 2015 10:36:06 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Yes. All images are converted to JPEG since JPEG is the internal image format for PDF.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.