Click here to Skip to main content
14,494,314 members
Rate this:
Please Sign up or sign in to vote.
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
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100