src/main/jni/src/PdfUtils.cpp
// Check if the last pdfium command failed and if so, forward the error to java via an exception. If
// this function returns true an exception is pending.
Check if the last pdfium command failed and if so, forward the error to java via an exception. If
this function returns true an exception is pending.
Check if the last pdfium command failed and if so forward the error to java via an exception . If this function returns true an exception is pending .
bool forwardPdfiumError(JNIEnv *env) {
        long error = FPDF_GetLastError();
        switch (error) {
            case FPDF_ERR_SUCCESS:
                return false;
            case FPDF_ERR_FILE:
                jniThrowException(env, "java/io/IOException", "file not found or cannot be opened");
                break;
            case FPDF_ERR_FORMAT:
                jniThrowException(env, "java/io/IOException",
                                  "file not in PDF format or corrupted");
                break;
            case FPDF_ERR_PASSWORD:
                jniThrowException(env, "java/lang/SecurityException",
                                  "password required or incorrect password");
                break;
            case FPDF_ERR_SECURITY:
                jniThrowException(env, "java/lang/SecurityException",
                                  "unsupported security scheme");
                break;
            case FPDF_ERR_PAGE:
                jniThrowException(env, "java/io/IOException", "page not found or content error");
                break;
            case FPDF_ERR_UNKNOWN:
            default:
                jniThrowException(env, "java/lang/Exception", "unknown error");
        }
        return true;
    }
bool forwardPdfiumError ( JNIEnv * env ) { long error = FPDF_GetLastError ( ) ; switch ( error ) { case FPDF_ERR_SUCCESS : return false ; case FPDF_ERR_FILE : jniThrowException ( env , " " , " " ) ; break ; case FPDF_ERR_FORMAT : jniThrowException ( env , " " , " " ) ; break ; case FPDF_ERR_PASSWORD : jniThrowException ( env , " " , " " ) ; break ; case FPDF_ERR_SECURITY : jniThrowException ( env , " " , " " ) ; break ; case FPDF_ERR_PAGE : jniThrowException ( env , " " , " " ) ; break ; case FPDF_ERR_UNKNOWN : default : jniThrowException ( env , " " , " " ) ; } return true ; }
Check if the last pdfium command failed and if so, forward the error to java via an exception.
Check if the last pdfium command failed and if so forward the error to java via an exception .