Skip to content

Commit

Permalink
mask core pdf (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
andiwand authored Feb 9, 2025
1 parent 2e5b2ce commit a4c45c8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/src/main/cpp/CoreWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jobject
jfieldID txtField = env->GetFieldID(optionsClass, "txt", "Z");
jboolean txt = env->GetBooleanField(options, txtField);

jfieldID pdfField = env->GetFieldID(optionsClass, "pdf", "Z");
jboolean pdf = env->GetBooleanField(options, pdfField);

jfieldID pagingField = env->GetFieldID(optionsClass, "paging", "Z");
jboolean paging = env->GetBooleanField(options, pagingField);

Expand Down Expand Up @@ -112,6 +115,11 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jobject
return result;
}

if (!pdf && file.file_type() == odr::FileType::portable_document_format) {
env->SetIntField(result, errorField, -5);
return result;
}

odr::HtmlConfig config;
config.editable = editable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public static class CoreOptions {

public boolean ooxml;
public boolean txt;
public boolean pdf;

public boolean editable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ public void loadSync(Options options) {
CoreWrapper.CoreOptions coreOptions = new CoreWrapper.CoreOptions();
coreOptions.inputPath = cacheFile.getPath();
coreOptions.outputPath = cacheDirectory.getPath();
coreOptions.ooxml = false;
coreOptions.txt = true;
coreOptions.pdf = false;

lastCoreOptions = coreOptions;

Expand Down

0 comments on commit a4c45c8

Please sign in to comment.