Click here to Skip to main content
16,022,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a sample of PDF that looks like this
https://i.stack.imgur.com/VDp9I.png[^]

However, unfortunately, the rectarray comes back as null. I tried BOX instead of RECT, but rectarray also comes back as null
C#
PdfReader reader = new PdfReader(inFileName);

        for (int i = 1; i <= reader.NumberOfPages; ++i)
        {
            strPageNumber = i.ToString();
            if (intCommentCount >= 5)
            {
                break;
            }

            PdfDictionary pagedic = reader.GetPageN(i);

            var thing = reader.GetPageContent(i);
            string converted = Encoding.UTF8.GetString(thing, 0, thing.Length);
            PdfArray rectarray = (PdfArray)PdfReader.GetPdfObject(pagedic.Get(PdfName.RECT));

            if (rectarray == null || rectarray.Size == 0)
            {
                continue;
            }
         }
What is the way to collect BOX/RECTANGLE objects from the PDF using C# iTextSharp

Thank you in advance

What I have tried:

I tried BOX instead of RECT, but rectarray also comes back as null
Posted
Updated 25-Mar-20 3:33am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900