Skip to content

Commit cd5cad3

Browse files
Expose processAnnotation option
1 parent 89f5095 commit cd5cad3

4 files changed

Lines changed: 20 additions & 3 deletions

File tree

UpcomingReleaseNotes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Expose processAnnotation option.
2+
3+
It is off by default, but if turned on, allows converting annotations too, along with the original pdf document.

pdf2htmlEX/src/main/cpp/pdf2htmlEX.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ Java_com_viliussutkus89_android_pdf2htmlex_pdf2htmlEX_call_1pdf2htmlEX(JNIEnv *e
7575
jboolean enableDrm,
7676
jstring backgroundFormat_,
7777
jboolean enableEmbedFont,
78-
jboolean enableEmbedExternalFont
78+
jboolean enableEmbedExternalFont,
79+
jboolean processAnnotation
7980
) {
8081
CCharGC dataDir(env, dataDir_);
8182
CCharGC popplerDir(env, popplerDir_);
@@ -96,6 +97,7 @@ Java_com_viliussutkus89_android_pdf2htmlex_pdf2htmlEX_call_1pdf2htmlEX(JNIEnv *e
9697
converter.setOutputFilename(outputFile.c_str());
9798
converter.setEmbedFont(enableEmbedFont == JNI_TRUE);
9899
converter.setEmbedExternalFont(enableEmbedExternalFont == JNI_TRUE);
100+
converter.setProcessAnnotation(processAnnotation == JNI_TRUE);
99101

100102
if (!backgroundFormat.isEmpty()) {
101103
converter.setBackgroundImageFormat(backgroundFormat.c_str());

pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class pdf2htmlEX {
5151
private boolean p_drm = true;
5252
private boolean p_embedFont = true;
5353
private boolean p_embedExternalFont = true;
54+
private boolean p_processAnnotation = false;
5455
private String p_backgroundFormat = "";
5556

5657
boolean p_wasPasswordEntered = false;
@@ -180,6 +181,11 @@ public pdf2htmlEX setEmbedExternalFont(boolean embedExternalFont) {
180181
return this;
181182
}
182183

184+
public pdf2htmlEX setProcessAnnotation(boolean processAnnotation) {
185+
this.p_processAnnotation = processAnnotation;
186+
return this;
187+
}
188+
183189
/**
184190
* @param backgroundFormat: png (default), jpg or svg
185191
*/
@@ -244,11 +250,12 @@ int convert_MakeTheActualCall(File outputHtml) throws IOException {
244250
m_poppler_dataDir.getAbsolutePath(), m_pdf2htmlEX_tmpDir.getAbsolutePath(),
245251
this.p_inputPDF.getAbsolutePath(), outputHtml.getAbsolutePath(),
246252
this.p_ownerPassword, this.p_userPassword, this.p_outline, this.p_drm,
247-
this.p_backgroundFormat, this.p_embedFont, this.p_embedExternalFont
253+
this.p_backgroundFormat, this.p_embedFont, this.p_embedExternalFont,
254+
this.p_processAnnotation
248255
);
249256
}
250257

251-
private native int call_pdf2htmlEX(String dataDir, String popplerDir, String tmpDir, String inputFile, String outputFile, String ownerPassword, String userPassword, boolean outline, boolean drm, String backgroundFormat, boolean embedFont, boolean embedExternalFont);
258+
private native int call_pdf2htmlEX(String dataDir, String popplerDir, String tmpDir, String inputFile, String outputFile, String ownerPassword, String userPassword, boolean outline, boolean drm, String backgroundFormat, boolean embedFont, boolean embedExternalFont, boolean processAnnotation);
252259

253260
// Because Java cannot setenv for the current process
254261
private static native void set_environment_value(String key, String value);

pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX_exe.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ public pdf2htmlEX setEmbedExternalFont(boolean embedExternalFont) {
133133
return this;
134134
}
135135

136+
public pdf2htmlEX setProcessAnnotation(boolean processAnnotation) {
137+
this.m_arguments.put("--process-annotation", processAnnotation ? "1" : "0");
138+
return this;
139+
}
140+
136141
/**
137142
* @param backgroundFormat: png (default), jpg or svg
138143
*/

0 commit comments

Comments
 (0)