PdfiumAndroid icon indicating copy to clipboard operation
PdfiumAndroid copied to clipboard

Here's the C code that I use to get the text.

Open cortobass opened this issue 9 years ago • 1 comments

JNI_FUNC(jstring, PdfiumCore, textGetText)(JNI_ARGS, jint textpage, jint nStart, jint nCount){

FPDF_TEXTPAGE pTextPage = reinterpret_cast<FPDF_TEXTPAGE>(textpage);
FPDF_WCHAR* pBuff = new FPDF_WCHAR[nCount+1];

int ret = FPDFText_GetText(pTextPage, nStart, nCount, pBuff);
if(ret == 0){
    LOGE("FPDFText_GetText: FPDFText_GetText did not return success");

}

jstring Text = env->NewString(pBuff, ret-1); delete pBuff; return Text; }

cortobass avatar Aug 07 '16 13:08 cortobass