@@ -302,40 +302,26 @@ protected XMPMeta createXmpMetadata() throws XMPException {
302
302
continue ;
303
303
value = ((PdfString ) obj ).toUnicodeString ();
304
304
if (PdfName .Title .equals (key )) {
305
- if (!IsXmpMetaHasLocalizedText (xmpMeta , XMPConst .NS_DC , PdfConst .Title )) {
306
- xmpMeta .setLocalizedText (XMPConst .NS_DC , PdfConst .Title , XMPConst .X_DEFAULT , XMPConst .X_DEFAULT , value );
307
- }
305
+ xmpMeta .setLocalizedText (XMPConst .NS_DC , PdfConst .Title , XMPConst .X_DEFAULT , XMPConst .X_DEFAULT , value );
308
306
} else if (PdfName .Author .equals (key )) {
309
307
xmpMeta .appendArrayItem (XMPConst .NS_DC , PdfConst .Creator , new PropertyOptions (PropertyOptions .ARRAY_ORDERED ), value , null );
310
308
} else if (PdfName .Subject .equals (key )) {
311
- if (!IsXmpMetaHasLocalizedText (xmpMeta , XMPConst .NS_DC , PdfConst .Description )) {
312
- xmpMeta .setLocalizedText (XMPConst .NS_DC , PdfConst .Description , XMPConst .X_DEFAULT , XMPConst .X_DEFAULT , value );
313
- }
309
+ xmpMeta .setLocalizedText (XMPConst .NS_DC , PdfConst .Description , XMPConst .X_DEFAULT , XMPConst .X_DEFAULT , value );
314
310
} else if (PdfName .Keywords .equals (key )) {
315
311
for (String v : value .split (",|;" )) {
316
312
if (v .trim ().length () > 0 ) {
317
313
xmpMeta .appendArrayItem (XMPConst .NS_DC , PdfConst .Subject , new PropertyOptions (PropertyOptions .ARRAY ), v .trim (), null );
318
314
}
319
315
}
320
- if (!isXmpMetaHasProperty (xmpMeta , XMPConst .NS_PDF , PdfConst .Keywords )) {
321
- xmpMeta .setProperty (XMPConst .NS_PDF , PdfConst .Keywords , value );
322
- }
316
+ xmpMeta .setProperty (XMPConst .NS_PDF , PdfConst .Keywords , value );
323
317
} else if (PdfName .Creator .equals (key )) {
324
- if (!isXmpMetaHasProperty (xmpMeta , XMPConst .NS_PDF , PdfConst .CreatorTool )) {
325
- xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .CreatorTool , value );
326
- }
318
+ xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .CreatorTool , value );
327
319
} else if (PdfName .Producer .equals (key )) {
328
- if (!isXmpMetaHasProperty (xmpMeta , XMPConst .NS_PDF , PdfConst .Producer )) {
329
- xmpMeta .setProperty (XMPConst .NS_PDF , PdfConst .Producer , value );
330
- }
320
+ xmpMeta .setProperty (XMPConst .NS_PDF , PdfConst .Producer , value );
331
321
} else if (PdfName .CreationDate .equals (key )) {
332
- if (!isXmpMetaHasProperty (xmpMeta , XMPConst .NS_XMP , PdfConst .CreateDate )) {
333
- xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .CreateDate , PdfDate .getW3CDate (value ));
334
- }
322
+ xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .CreateDate , PdfDate .getW3CDate (value ));
335
323
} else if (PdfName .ModDate .equals (key )) {
336
- if (!isXmpMetaHasProperty (xmpMeta , XMPConst .NS_XMP , PdfConst .ModifyDate )) {
337
- xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .ModifyDate , PdfDate .getW3CDate (value ));
338
- }
324
+ xmpMeta .setProperty (XMPConst .NS_XMP , PdfConst .ModifyDate , PdfDate .getW3CDate (value ));
339
325
}
340
326
}
341
327
}
@@ -1698,10 +1684,6 @@ private static boolean isXmpMetaHasProperty(XMPMeta xmpMeta, String schemaNS, St
1698
1684
return xmpMeta .getProperty (schemaNS , propName ) != null ;
1699
1685
}
1700
1686
1701
- private static boolean IsXmpMetaHasLocalizedText (XMPMeta xmpMeta , String schemaNS , String altTextName ) throws XMPException {
1702
- return xmpMeta .getLocalizedText (schemaNS , altTextName , XMPConst .X_DEFAULT , XMPConst .X_DEFAULT ) != null ;
1703
- }
1704
-
1705
1687
@ SuppressWarnings ("unused" )
1706
1688
private byte [] getSerializedBytes () {
1707
1689
ByteArrayOutputStream bos = null ;
0 commit comments