[poppler] Fail to findText CPP

Sun Ho Park flyh21c at gmail.com
Wed Jun 8 00:39:01 PDT 2011


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 !!!!!!!!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110608/99ba8287/attachment.htm>


More information about the poppler mailing list