Search text and draw rectangle problem

Some other discussions. Feel free to post anything here !
Post Reply
Posts: 1
Joined: Wed Nov 06, 2013 10:28 am

Search text and draw rectangle problem

Post by pexpoo » Wed Nov 06, 2013 10:46 am

Hi all,

1.I have tried to search text in all pages
2.then draw rectangle (highlight search text)
3.and save to new PDF.

My problem is some of PDF files rectangle position are not correct.But many PDF files are correct.

And I think GdPicturePDF.SearchText method give me correct left and top.

I use GdPicture .Please help.

Code: Select all

                    GdPicturePDF gdPDF = new GdPicturePDF();

                    MemStream = new MemoryStream(ContentBytes);

                    if (gdPDF.LoadFromStream(MemStream) == GdPictureStatus.OK)
                        int pageCount = gdPDF.GetPageCount();

                        for (int i = 1; i <= pageCount; i++)
                            bool found;
                            int Occur = 1;

                                float left = 0, top = 0, width = 0, height = 0;

                                // Search
                                found = gdPDF.SearchText(searchWord, Occur, false, true, ref left, ref top, ref width, ref height);

                                if (found)


                                    gdPDF.SetLineColor(0, 0, 255);
                                    gdPDF.DrawRectangle(left, top, width, height, false, true);

                            } while (found);

Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: Search text and draw rectangle problem

Post by Cedric » Thu Dec 05, 2013 12:34 pm

As you probably know GdPicture.NET 8 branch has been discontinued for quite some time and the PDF text extraction has been greatly enhanced since then.
The only thing I can suggest is to try the latest revision of GdPicture.NET 10 to check if the result is correct and if not, open a support ticket with the needed information for us to investigate.


Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest