We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

TextFragmentAbsorber returns fragment with wrong rectangle


I have a PDF file and text inside, when I try to find this text TextFragmentAbsorber returns fragment and its rectangle has offset on Y coordinate. And wnen I set BackgroundColor for returned fragment - I have highlighting in a wrong place.

Can you help us?

This code we have:

class Program
    static void Main(string[] args)
        System.Console.WriteLine("Hello Aspose!");
        License license = new License();
        using (var licenseStream = System.IO.File.OpenRead("Aspose.Pdf.lic"))

        using (Document pdfDocument = new Document("test.pdf"))
            var fragmentsAbsorber = new TextFragmentAbsorber("ISO/IEC Directives, Part 1");

            System.Console.WriteLine($"Found: {fragmentsAbsorber.TextFragments.Count}");

            if (fragmentsAbsorber.TextFragments.Count == 0)
                System.Console.WriteLine("Nothing was found...");

            var fragment = fragmentsAbsorber.TextFragments[1];
            fragment.TextState.DrawTextRectangleBorder = true;
            fragment.TextState.BackgroundColor = Color.Coral;


the file with text is here: test.pdf (154.9 KB)


Thanks for contacting support.

We were able to reproduce the issue in our environment while using Aspose.PDF for .NET 20.4 and have logged it as PDFNET-47950 in our issue tracking system. We will further look into its details and keep you informed with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thank you @asad.ali.

Waiting for comments.

Can I see details of PDFNET-47950 ticket somewhere?


The ticket has been attached to this thread where you can see its status. Along with that we will also keep you informed with the progress on investigation against it.

1 Like