Skip to content

Commit b45316f

Browse files
author
Adrian Daerr
committed
Extend XMP Privacy Filtering to the DocumentInformation section of the PDF
1 parent 0e6f094 commit b45316f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/net/sf/jabref/util/XMPUtil.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,10 +983,22 @@ public static void writeDocumentInformation(PDDocument document,
983983
if (database != null)
984984
entry = database.resolveForStrings(entry, false);
985985

986+
// Query privacy filter settings
987+
JabRefPreferences prefs = JabRefPreferences.getInstance();
988+
boolean useXmpPrivacyFilter =
989+
prefs.getBoolean("useXmpPrivacyFilter");
990+
// Fields for which not to write XMP data later on:
991+
TreeSet<String> filters = new TreeSet<String>(Arrays.asList(prefs.getStringArray(JabRefPreferences.XMP_PRIVACY_FILTERS)));
992+
986993
// Set all the values including key and entryType
987994
Set<String> fields = entry.getAllFields();
988995

989996
for (String field : fields){
997+
998+
if (useXmpPrivacyFilter && filters.contains(field)) {
999+
continue;
1000+
}
1001+
9901002
if (field.equals("author")) {
9911003
di.setAuthor(entry.getField("author"));
9921004
} else if (field.equals("title")) {

0 commit comments

Comments
 (0)