Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

How to get coordinates of a searched words

More
IP: 192.168.0.71 11 years 3 months ago #7568 by abhishekjaju
I am trying hard to get coordinates of a searched word in a PDF page.
For example I have searched a word adobe in a pdf page, now I am not able to get the coordinates of this searched word.
I need to add a annotation to this search word and without getting the coordinates I am not able to add annotation to this searched word.
More
IP: 192.168.0.158 11 years 3 months ago #7574 by nermeen
You can implement it yourself using:

www.androidpdf.mobi/documentation/javado...ml#GetFirstChar(int)
www.androidpdf.mobi/documentation/javado...html#ObjsGetCharRect (int, float[])

The first method will return the index of the first char, you need to pass that index to the second method, and the second method will fill the float[] with the rect of that char...
Then you need to do the same for the last char..and calculate the coordinates of the whole word.
More
IP: 192.168.0.71 11 years 3 months ago #7581 by abhishekjaju
How to get the index of the last character.
More
IP: 192.168.0.71 11 years 3 months ago #7582 by radaee
same length to the serch key word, in unicodes.
More
IP: 192.168.0.71 11 years 3 months ago - 11 years 3 months ago #7584 by abhishekjaju
Can you please explain with a example.
I am getting a error.
I am getting the Index of first character of the word , then I am adding the searched word length to find index of last character.
But the above method is giving a error.
Last edit: 11 years 3 months ago by Nygashi.
More
IP: 192.168.0.158 11 years 3 months ago #7585 by nermeen
this is an example of searching a word and adding annotation to it:
Code:
Page currentPage = m_doc.GetPage(page); currentPage.ObjsStart(); String str = "radaee"; Finder mFinder = currentPage.FindOpen(str, false, false); if( mFinder != null ) { int ichar = mFinder.GetFirstChar(0); int ichar_end = ichar + str.length() - 1; float rect[] = new float[4]; float rect_end[] = new float[4]; currentPage.ObjsGetCharRect(ichar, rect); currentPage.ObjsGetCharRect(ichar_end, rect_end); //currentPage.AddAnnotMarkup(ichar, ichar_end, 0); currentPage.AddAnnotURI(new float[]{rect[0], rect[1], rect_end[2], rect_end[3]}, "http://www.androidpdf.mobi"); //rerender the page to see the annotation }
Time to create page: 0.430 seconds
Powered by Kunena Forum