We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Out of Memory Error Creating PDF

Hello,

We are getting this error on a fast computer with 2GB RAM running XP.

Version of PDF Assembly is 4.202.0.27

The image is a bit large at 3600x3600, however GDI+ should not be the limiting factor on this.

Please help, thank you.


===================================
Out of Memory Exception at
System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement) at System.Drawing.Image.FromFile(String
filename) at
Syncfusion.Pdf.Implementation.Utilities.Utils.TryLoadImage(String fileName) at Syncfusion.Pdf.Implementation.Utilities.PDFImagesFactory.CreateImage(String
imgPath) at
Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location, String fileName, SizeF destination, IPDFGraphicState properties, RectangleF
clipRectangle) at
Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location,
String fileName, SizeF destination)

10 Replies

DK Dhivya K Syncfusion Team November 15, 2006 01:09 PM UTC

Hi,

Thank you for your interest in Essential PDF. I tried creating a sample with 3600x3600 png image.I am afraid. I was unable to reproduce the issue.

Here is the sample for your reference
image.zip


Could you please provide me the image type[jpg or Tiff] or sample image with which you are able to reproduce this issue.This will help me investigating further on this issue.

Regards.
Dhivya.


LW Lee Whitney November 29, 2006 12:55 AM UTC

Hi Dhivya,

It seems this is the problem with SyncFusion PDF:

When creating a PDF document, every time a image is added it is loaded in memory and kept there until the document is completed.

So for example, if a 100 page document is created, and a large image is added to each page, then SyncFusion tries to keep all 100 images in memory at once.

This leads to out of memory errors, because .NET bitmaps (which Syncfusion uses) cannot take advantage of virtual memory.

To reproduce this problem, add new pages in a loop and draw a large .JPG on each page. When stepping through in the debugger you can see the memory is not released until the document is closed.

So my questions are now:

1) Is my understanding of the problem correct?

2) Is there anyway that the amount of memory can be reduced for many page documents?

This issue is quite urgent to our customers.

Thank you.

>Hi,

Thank you for your interest in Essential PDF. I tried creating a sample with 3600x3600 png image.I am afraid. I was unable to reproduce the issue.

Here is the sample for your reference
image.zip


Could you please provide me the image type[jpg or Tiff] or sample image with which you are able to reproduce this issue.This will help me investigating further on this issue.

Regards.
Dhivya.


AD Administrator Syncfusion Team November 29, 2006 06:24 PM UTC

Hi,

I tried creating a sample with 3600x3600 png image. In which, the image is drawn on every page up to hundred page. Hence, I am afraid. I was unable to reproduce the issue.

Here is the sample for your reference.
image.zip

Could you please take a look at this and let me if the problem still exists.

Regards,
Prakash.


JU Justin November 1, 2007 09:45 AM UTC

Hello,
This error can occur even when the image size is 0 bytes. i,e the file has a name and extension as *.jpg, but when you try to create a file from the path. the application throws this error. You can try for the images, what iam sending now.

>Hello,

We are getting this error on a fast computer with 2GB RAM running XP.

Version of PDF Assembly is 4.202.0.27

The image is a bit large at 3600x3600, however GDI+ should not be the limiting factor on this.

Please help, thank you.


===================================
Out of Memory Exception at
System.Drawing.Image.FromFile(String filename, Boolean
useEmbeddedColorManagement) at System.Drawing.Image.FromFile(String
filename) at
Syncfusion.Pdf.Implementation.Utilities.Utils.TryLoadImage(String fileName) at Syncfusion.Pdf.Implementation.Utilities.PDFImagesFactory.CreateImage(String
imgPath) at
Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location, String fileName, SizeF destination, IPDFGraphicState properties, RectangleF
clipRectangle) at
Syncfusion.Pdf.Implementation.Objects.PDFGraphics.DrawImage(PointF location,
String fileName, SizeF destination)


33301.zip


RS Rajarajeswari S Syncfusion Team November 6, 2007 08:37 AM UTC



Hi,

As this is suspected to be a defect, we have created a new Direct-Trac Incident ID 38863. Please follow this incident to get more information regarding the issue.

Regards,
Raji



JL Johan Lindvall June 4, 2010 08:10 AM UTC

Has this been fixed? I believe we are seeing the same (or a very similar) issue with 8.2.0.18.


PJ Pravin Joshua D Syncfusion Team June 8, 2010 08:49 AM UTC

Hi Johan,

On further analysis of this issue its found that it is not the bug of Essential PDF. Even if we use .Net image class, it will also raise OutOfMemory exception. Since we are using .Net image class to render the image into Pdf, we are getting the exception which is raised by .Net.

To confirm this, please try the code as given below:

string path=@"..\..\App_Data\image2.jpg";
Image im = Image.FromFile(path);

This will raise outOfMemory exception and so this is not the issue of Pdf. This is the default behavior of .NET. Please have a look at the sample from the below link which illustrates this:

Sample:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=CS-1166061123.zip

Please let us know if you have any questions.

Regards,
Pravin.


JL Johan Lindvall June 8, 2010 12:28 PM UTC

Pravin,

There seems to be a misunderstanding - the sample you just posted throws an OutOfMemoryException because the file is invalid (0 bytes long). This is not the issue we are seeing.

We are seeing the issue LW posted at 11/28/2006 7:55:41 PM, where SyncFusion PDF keeps all images in memory until the document is completed. Is this still the case?



JL Johan Lindvall June 10, 2010 11:00 AM UTC

I have opened Direct-Trac 68851 regarding this problem.


PJ Pravin Joshua D Syncfusion Team July 2, 2010 04:19 AM UTC

Hi Johan,

Thank you for the update. We will continue our follow up in the mentioned direct trac incident.

Regards,
Pravin.

Loader.
Live Chat Icon For mobile
Up arrow icon