Detect if there is text somewhere in the PDF using Aspose.PDF for .NET - Crash with 50MB PDF file

Hi,
i have written some code, which checks, if there is text somewhere in the pdf. See here:
License license = new License();
license.SetLicense(“Aspose.Total.lic”);
Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(f);
int pagecount = pdf.Pages.Count;
bool textlayer = false;
foreach (Aspose.Pdf.Page pdfPage in pdf.Pages)
{
foreach (Operator pdfPageContent in pdfPage.Contents)
{
if (pdfPageContent.GetType().ToString().ToLower().Contains(“showtext”))
{
textlayer = true;
//…
}
}
}

Works.
BUT: I have a PDF from CAD-Drawing, which makes this code crash when it comes to the inner for–each (foreach (Operator pdfPageContent in pdfPage.Contents)). It takes a while and then “Out of memory exception”.
As far as i can see, the pdf consists of thousands of little artefacts, only one page. Adobe Acrobat needs about 30 sec to render the file - but aspose.pdf crashs.
I cannot share the file in public, because it’s from a customer

uli

@uboddenberg

You may please your sample file in private message so that we can test the scenario in our environment and address it accordingly. You can send a private message by clicking over username and pressing Blue Message Button. In case of larger file, you can please upload it to Dropbox or Google Drive and share the link in private message.

@uboddenberg

We were able to notice the issue with the file that you have shared in private message. We have logged an issue as PDFNET-48397 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.