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