OutOfMemory Exception counting PDF tables


#1

I have a small program that is trying to count the number of tables in a pdf. However, I keep getting an OutOfMemory exception. I have attached the pdf. I am using Aspose.PDF 19.8.0.0 any help would be appreciated

.brokentable.pdf (990.2 KB)


#2

@optimalosg

Thank you for contacting support.

Would you please share SSCCE code as well so that we may try to reproduce and investigate it in our environment.


#3

Farhan,

below is a small program will show the problem with the previously attached pdf. You will need to supply your own Aspose.Total.lic file. When I was messing with the license file, I commented out the licensing code and the program ran through, displaying there were 8 tables. I’m not sure what this means. If you need anything else, let me know.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aspose.Pdf;
using Aspose.Pdf.Text;

namespace AsposeTableTest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            License license = new License();
            license.SetLicense("Aspose.Total.lic");

            string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string fileName = "brokentable.pdf";

            Console.WriteLine("File: {0} - {1}", fileName, DateTime.Now);
            using (StreamReader sr = new StreamReader(fileName))
            {
                Document doc = new Document(sr.BaseStream);

                TableAbsorber absorber = new TableAbsorber();

                foreach (var page in doc.Pages)
                {
                    absorber.Visit(page);
                }

                Console.WriteLine("Tables: {0}", absorber.TableList.Count);
            }

            Console.WriteLine("{0} Finished", DateTime.Now);
            Console.ReadLine();
        }
    }
}

#4

@optimalosg

We have been able to reproduce the issue and have been able to reproduce it in our environment. A ticket with ID has been logged in our issue management system for further investigation and resolution.

About unlicensed testing, you were facing Evaluation Version Limitations so 8 tables were somehow counted from first four pages of your PDF document. We will let you know as soon as any further update will be available in this regard.