Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

How to get coordinates of a searched words 9 years 5 months ago #7612

  • abhishekjaju
  • abhishekjaju's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 40
  • Thank you received: 1
When I am searching "Android" text in whole PDF I am not able to add annotations correctly.

It only search first "Android" text on every page of the whole pdf.
I want to addURI to all Android Word in the PDF,
So please give example to seach all "Android" words in PDF and get cordinates of every particular "Android" text.
I used below code for achiving but I am not getting currect result


public void AddAnnonateURI() {
String str = "Android";
int pagesCount = m_doc.GetPageCount();
for (int i = 0; i < pagesCount; i++) {
Page currentPage = m_doc.GetPage(i);
currentPage.ObjsStart();
// Finder mFinder = new Finder();
Finder mFinder = currentPage.FindOpen(str, true, true);
if (mFinder != null) {
int finds = mFinder.GetCount();
int ichar = mFinder.GetFirstChar(0);
int ichar_end = ichar + str.trim().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] }, str);
for (int j = 0; j < finds; j++) {
// System.err.println("page" + (i + 1));
// int foundIndex = mFinder.GetFirstChar(j);
}
mFinder.Close();
}
currentPage.Close();
}
// m_reader.PDFSave();
}
The following user(s) said Thank You: Verducci
Last edit: by Nygashi.
The topic has been locked.
  • Page:
  • 1
  • 2
Powered by Kunena Forum