[poppler] Fail to findText CPP

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Wed Jun 8 01:00:02 PDT 2011


Hi,

Excuse me, could you post a ready-to-compile snippet
to reproduce your issue? I have been away from Objective-C
programming about 10 years, so it's slightly difficult
to write the omitted part by myself.

Regards,
mpsuzuki

On Wed, 8 Jun 2011 16:39:01 +0900
Sun Ho Park <flyh21c at gmail.com> wrote:

>Hi, everyone on Poppler.
>
>I am all new to Poppler.
>These days I am trying to implement findText function using Objective C on
>the Mac.
>
>But I failed to implement it.
>
>My Code is as follows :
>
>
>
>
>//-----------start of code
>--------------------------------------------------//
>const char *arg_search = "turorial" ;
>
>ustring text = ustring::from_utf8(arg_search, -1) ;
>const size_t len = text.length();
>std::vector<Unicode> u(len);
>for (size_t i = 0; i < len; ++i) {
> u[i] = text[i];
>}
>
>
>
>......................
>......................
>
>
>
>int firstPage = 9 ;
>
>double sLeft, sTop, sRight, sBottom ;
>sLeft = sTop = 0.0 ;
>
>thePage = doc->getPage(firstPage) ;
>sRight  = thePage->getMediaWidth() ;
>sBottom = thePage->getMediaHeight() ;
>
>textOut = new TextOutputDev(NULL, gTrue, gFalse, gFalse);
>doc->displayPage(textOut, firstPage, resolution, resolution, 0, gFalse,
>gTrue, gFalse);
>textPage = textOut->takeText();
>
>
>
>/*
>textPage->getText(sLeft, sTop, sRight, sBottom) ;      -------------------->
>(1) works OK
>theWordList = textPage->makeWordList(gFalse) ;       -------------------->
>(2) works OK
>*/
>
>found = textPage->findText(&u[0], len, gTrue, gTrue, gFalse, gFalse, gTrue,
>gFalse, &sLeft, &sTop, &sRight, &sBottom) ;
>
>
>textPage->decRefCnt() ;
>//-----------end   of code
>--------------------------------------------------//
>
>
>the result of findText (found) is always false.
>
>Is there any mistake or ??
>
>
>
>the result of (1), and (2) is OK.
>
>But the result of findText is always false.
>
>Why ?
>
>I can find the reason any more.
>
>I guess the main problem seems to be conversion arg_search to Unicode used
>in findText(&u[0]..........................) .
>But I can not find out the reason and I can not point out what is wrong.
>I can not do anything more about this.
>
>
>Please help !!!!!!!!!!
>


More information about the poppler mailing list