Hello,
We have an issue with a specific PDF-File. Aspose.Pdf does not find any Textfragments on the attached PDF. The same function works on other files. We could not identify any problems with the PDF itself. I’ve added a working and a not working file so you can try to reproduce the issue.
Here is the Code Snippet we use:
        using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document("not_working.pdf"))
        {
            PdfFileInfo fileInfo = new PdfFileInfo(doc);
            int pageNumber = 1;
            var page = doc.Pages[pageNumber];
            
            float searchRectangleLLX = 0;
            float searchRectangleLLY = 0;
            var searchRectangleURX = fileInfo.GetPageWidth(pageNumber) - 1;
            var searchRectangleURY = fileInfo.GetPageHeight(pageNumber) - 1;
            var searchRectangle = new Aspose.Pdf.Rectangle(searchRectangleLLX, searchRectangleLLY, searchRectangleURX, searchRectangleURY);
            TextFragmentAbsorber textAbsorber = new TextFragmentAbsorber();
            textAbsorber.TextSearchOptions.LimitToPageBounds = true;
            textAbsorber.TextSearchOptions.Rectangle = searchRectangle;
            page.Accept(textAbsorber);
            TextFragmentCollection textFragments = textAbsorber.TextFragments;
        }
Some additional Information:
- We use Aspose.Pdf Version 20.9.0.0
 
not_working.pdf (1.9 MB)
working.pdf (245.2 KB)