#include <jni.h>
#include <string>
#include <PDFKitten.h>

extern "C" JNIEXPORT jstring JNICALL
Java_com_mypdfmodule_MyPDFModule_extractText(JNIEnv* env, jobject thiz, jstring jFilePath) {
  const char* filePath = env->GetStringUTFChars(jFilePath, nullptr);

  std::string text = PDFKitten::extractText(filePath);

  env->ReleaseStringUTFChars(jFilePath, filePath);
  return env->NewStringUTF(text.c_str());
}
