Skip to content

Commit d877557

Browse files
Thomas TaschauerViliusSutkus89
authored andcommitted
expose settings for embed-font and embed-external-font
1 parent fb0be82 commit d877557

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

pdf2htmlEX/src/main/cpp/pdf2htmlEX.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ Java_com_viliussutkus89_android_pdf2htmlex_pdf2htmlEX_call_1pdf2htmlEX(JNIEnv *e
7373
jstring userPassword_,
7474
jboolean enableOutline,
7575
jboolean enableDrm,
76-
jstring backgroundFormat_
76+
jstring backgroundFormat_,
77+
jboolean enableEmbedFont,
78+
jboolean enableEmbedExternalFont
7779
) {
7880
CCharGC dataDir(env, dataDir_);
7981
CCharGC popplerDir(env, popplerDir_);
@@ -92,6 +94,8 @@ Java_com_viliussutkus89_android_pdf2htmlex_pdf2htmlEX_call_1pdf2htmlEX(JNIEnv *e
9294
converter.setTMPDir(tmpDir.c_str());
9395
converter.setInputFilename(inputFile.c_str());
9496
converter.setOutputFilename(outputFile.c_str());
97+
converter.setEmbedFont(enableEmbedFont == JNI_TRUE);
98+
converter.setEmbedExternalFont(enableEmbedExternalFont == JNI_TRUE);
9599

96100
if (!backgroundFormat.isEmpty()) {
97101
converter.setBackgroundImageFormat(backgroundFormat.c_str());

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public final class pdf2htmlEX {
4444
private String p_userPassword = "";
4545
private boolean p_outline = true;
4646
private boolean p_drm = true;
47+
private boolean p_embedFont = true;
48+
private boolean p_embedExternalFont = true;
4749
private String p_backgroundFormat = "";
4850

4951
public static class ConversionFailedException extends Exception {
@@ -141,6 +143,16 @@ public pdf2htmlEX setDRM(@NonNull boolean enableDRM) {
141143
return this;
142144
}
143145

146+
public pdf2htmlEX setEmbedFont(@NonNull boolean embedFont) {
147+
this.p_embedFont = embedFont;
148+
return this;
149+
}
150+
151+
public pdf2htmlEX setEmbedExternalFont(@NonNull boolean embedExternalFont) {
152+
this.p_embedExternalFont = embedExternalFont;
153+
return this;
154+
}
155+
144156
/**
145157
* @param backgroundFormat: png (default), jpg or svg
146158
*/
@@ -178,7 +190,7 @@ public File convert() throws IOException, ConversionFailedException {
178190
m_poppler_dataDir.getAbsolutePath(), m_pdf2htmlEX_tmpDir.getAbsolutePath(),
179191
this.p_inputPDF.getAbsolutePath(), outputHtml.getAbsolutePath(),
180192
this.p_ownerPassword, this.p_userPassword, this.p_outline, this.p_drm,
181-
this.p_backgroundFormat
193+
this.p_backgroundFormat, this.p_embedFont, this.p_embedExternalFont
182194
);
183195

184196
// retVal values defined in pdf2htmlEX.cc
@@ -199,7 +211,7 @@ public File convert() throws IOException, ConversionFailedException {
199211
return outputHtml;
200212
}
201213

202-
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);
214+
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);
203215

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

0 commit comments

Comments
 (0)