|
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.
|
|
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!
|
|
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?
|
|
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!
|
|