Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Consistent Out of Memory errors splitting PDF into TIFFs

$
0
0

Hello, 


we've recently upgraded to latest version of Aspose.Pdf component (10.0) to try to solve this out of memory issues when splitting PDFs into TIFFs, but we're still seeing these issues (Since version 8). Please see the call stack below:

 Inner Exception: Out of memory.   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)   at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit)   at  .˜ .ˆ (Bitmap srcBitmap, Bitmap& destBitmap, BitmapData& srcBitmapData, BitmapData& destBitmapData, PixelFormat newFormat)   at  .˜ .Get1BppImage(Bitmap )   at  .˜ .ˆˆ (Bitmap , Int32 , Int32 )   at  .˜ .AddImage(Bitmap )   at Aspose.Pdf.Devices.TiffDevice.Process(Document document, Int32 fromPage, Int32 toPage, Stream output)   at Aspose.Pdf.Devices.DocumentDevice.Process(Document document, Int32 fromPage, Int32 toPage, String outputFileName)

Our code does the following: 

//License stuff omitted                

Aspose.Pdf.Document f = new Aspose.Pdf.Document(pdfPath);

                Resolution resolution = new Resolution(Convert.ToInt32(Business.System.ConfigurationManager.GetSystemConfig(ConfigKey.AsposeTIFFResolution).Value));

                TiffSettings tiffSettings = new TiffSettings();

                tiffSettings.Compression = CompressionType.None;

                tiffSettings.Depth = ColorDepth.Format4bpp;

                tiffSettings.SkipBlankPages = false;

                TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);


                if (f.Pages.Count > 0)

                {


                    int numpages = f.Pages.Count;

                    for (int i = 1; i <= numpages; i++)

                    {

                        tiffDevice.Process(f, i, i, destinationFolderPath + @"\" + Path.GetFileNameWithoutExtension(pdfPath) + "_" + (i + 1) + ".tiff");

                    }


            

                }

            

                f.Dispose();

                f = null;


After a day or so of running or so in high traffic environment it seems like there is a memory leak since it accumulates and eventually starts throwing out of memory errors. Cycling IIS fixes it, but it's happening on 6 of our production servers and creates outages for users and we can't be cycling IIS during business hours and we keep doing it 4-5 times a day.

Please advise as to next course of action

 Thank you!


Viewing all articles
Browse latest Browse all 3131

Trending Articles