Skip to content

Commit a4c45c8

Browse files
authored
mask core pdf (#383)
1 parent 2e5b2ce commit a4c45c8

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

app/src/main/cpp/CoreWrapper.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jobject
6868
jfieldID txtField = env->GetFieldID(optionsClass, "txt", "Z");
6969
jboolean txt = env->GetBooleanField(options, txtField);
7070

71+
jfieldID pdfField = env->GetFieldID(optionsClass, "pdf", "Z");
72+
jboolean pdf = env->GetBooleanField(options, pdfField);
73+
7174
jfieldID pagingField = env->GetFieldID(optionsClass, "paging", "Z");
7275
jboolean paging = env->GetBooleanField(options, pagingField);
7376

@@ -112,6 +115,11 @@ Java_at_tomtasche_reader_background_CoreWrapper_parseNative(JNIEnv *env, jobject
112115
return result;
113116
}
114117

118+
if (!pdf && file.file_type() == odr::FileType::portable_document_format) {
119+
env->SetIntField(result, errorField, -5);
120+
return result;
121+
}
122+
115123
odr::HtmlConfig config;
116124
config.editable = editable;
117125

app/src/main/java/at/tomtasche/reader/background/CoreWrapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public static class CoreOptions {
8282

8383
public boolean ooxml;
8484
public boolean txt;
85+
public boolean pdf;
8586

8687
public boolean editable;
8788

app/src/main/java/at/tomtasche/reader/background/RawLoader.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ public void loadSync(Options options) {
140140
CoreWrapper.CoreOptions coreOptions = new CoreWrapper.CoreOptions();
141141
coreOptions.inputPath = cacheFile.getPath();
142142
coreOptions.outputPath = cacheDirectory.getPath();
143+
coreOptions.ooxml = false;
143144
coreOptions.txt = true;
145+
coreOptions.pdf = false;
144146

145147
lastCoreOptions = coreOptions;
146148

0 commit comments

Comments
 (0)