iText 7 7.1.8 API
|
Utility methods for XMP. More...
Static Public Member Functions |
|
static String | CatenateArrayItems (XMPMeta xmp, String schemaNS, String arrayName, String separator, String quotes, bool allowCommas) |
Create a single edit string from an array of strings. More... |
|
static void | SeparateArrayItems (XMPMeta xmp, String schemaNS, String arrayName, String catedStr, PropertyOptions arrayOptions, bool preserveCommas) |
Separate a single edit string into an array of strings. More... |
|
static void | RemoveProperties (XMPMeta xmp, String schemaNS, String propName, bool doAllProperties, bool includeAliases) |
Remove multiple properties from an XMP object. More... |
|
static void | AppendProperties (XMPMeta source, XMPMeta dest, bool doAllProperties, bool replaceOldValues) |
Alias without the new option More... |
|
static void | AppendProperties (XMPMeta source, XMPMeta dest, bool doAllProperties, bool replaceOldValues, bool deleteEmptyValues) |
Append properties from one XMP object to another. More... |
|
static bool | ConvertToBoolean (String value) |
Convert from string to Boolean. More... |
|
static String | ConvertFromBoolean (bool value) |
Convert from boolean to string. More... |
|
static int | ConvertToInteger (String rawValue) |
Converts a string value to an More... |
|
static String | ConvertFromInteger (int value) |
Convert from int to string. More... |
|
static long | ConvertToLong (String rawValue) |
Converts a string value to a More... |
|
static String | ConvertFromLong (long value) |
Convert from long to string. More... |
|
static double | ConvertToDouble (String rawValue) |
Converts a string value to a More... |
|
static String | ConvertFromDouble (double value) |
Convert from long to string. More... |
|
static XMPDateTime | ConvertToDate (String rawValue) |
Converts a string value to an More... |
|
static String | ConvertFromDate (XMPDateTime value) |
Convert from More... |
|
static String | EncodeBase64 (byte[] buffer) |
Convert from a byte array to a base64 encoded string. More... |
|
static byte[] | DecodeBase64 (String base64String) |
Decode from Base64 encoded string to raw data. More... |
|
Utility methods for XMP.
Utility methods for XMP. I included only those that are different from the Java default conversion utilities.
|
inlinestatic |
Alias without the new option
deleteEmptyValues
.
source | The source XMP object. |
dest | The destination XMP object. |
doAllProperties | Do internal properties in addition to external properties. |
replaceOldValues | Replace the values of existing properties. |
XMPException | Forwards the Exceptions from the metadata processing |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Append properties from one XMP object to another.
Append properties from one XMP object to another.
XMPUtils::appendProperties was created to support the File Info dialog's Append button, and has been been generalized somewhat from those specific needs. It appends information from one XMP object (source) to another (dest). The default operation is to append only external properties that do not already exist in the destination. The flag
can be used to operate on all properties, external and internal. The flag
option can be used to replace the values of existing properties. The notion of external versus internal applies only to top level properties. The keep-or-replace-old notion applies within structs and arrays as described below.
The detailed behavior is defined by the following pseudo-code:
appendProperties ( sourceXMP, destXMP, doAllProperties, replaceOldValues, deleteEmptyValues ): for all source schema (top level namespaces): for all top level properties in sourceSchema: if doAllProperties or prop is external: appendSubtree ( sourceNode, destSchema, replaceOldValues, deleteEmptyValues ) appendSubtree ( sourceNode, destParent, replaceOldValues, deleteEmptyValues ): if deleteEmptyValues and source value is empty: delete the corresponding child from destParent else if sourceNode not in destParent (by name): copy sourceNode's subtree to destParent else if replaceOld: delete subtree from destParent copy sourceNode's subtree to destParent else: // Already exists in dest and not replacing, merge structs and arrays if sourceNode and destNode forms differ: return, leave the destNode alone else if form is a struct: for each field in sourceNode: AppendSubtree ( sourceNode.field, destNode, replaceOldValues ) else if form is an alt-text array: copy new items by "xml:lang" value into the destination else if form is an array: copy new items by value into the destination, ignoring order and duplicates
Note: appendProperties can be expensive if replaceOldValues is not passed and the XMP contains large arrays. The array item checking described above is n-squared. Each source item is checked to see if it already exists in the destination, without regard to order or duplicates.
Simple items are compared by value and "xml:lang" qualifier, other qualifiers are ignored. Structs are recursively compared by field names, without regard to field order. Arrays are compared by recursively comparing all items.
source | The source XMP object. |
dest | The destination XMP object. |
doAllProperties | Do internal properties in addition to external properties. |
replaceOldValues | Replace the values of existing properties. |
deleteEmptyValues | Delete destination values if source property is empty. |
XMPException | Forwards the Exceptions from the metadata processing |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Create a single edit string from an array of strings.
xmp | The XMP object containing the array to be catenated. |
schemaNS | The schema namespace URI for the array. Must not be null or the empty string. |
arrayName | The name of the array. May be a general path expression, must not be null or the empty string. Each item in the array must be a simple string value. |
separator | The string to be used to separate the items in the catenated string. Defaults to "; ", ASCII semicolon and space (U+003B, U+0020). |
quotes | The characters to be used as quotes around array items that contain a separator. Defaults to '"' |
allowCommas | Option flag to control the catenation. |
XMPException | Forwards the Exceptions from the metadata processing |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Convert from boolean to string.
value | a boolean value |
|
inlinestatic |
Convert from
XMPDateTime
to string.
value | an
XMPDateTime
|
|
inlinestatic |
Convert from long to string.
value | a long value |
|
inlinestatic |
Convert from int to string.
value | an int value |
|
inlinestatic |
Convert from long to string.
value | a long value |
|
inlinestatic |
Convert from string to Boolean.
value | The string representation of the Boolean. |
XMPException | If an empty string is passed. |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Converts a string value to an
rawValue | the string value |
XMPException | If the
rawValue
null
|
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Converts a string value to a
double
.
rawValue | the string value |
XMPException | If the
rawValue
null
|
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Converts a string value to an
int
.
rawValue | the string value |
XMPException | If the
rawValue
null
|
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Converts a string value to a
long
.
rawValue | the string value |
XMPException | If the
rawValue
null
|
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Decode from Base64 encoded string to raw data.
base64String | a base64 encoded string |
XMPException | Thrown if the given string is not property base64 encoded |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Convert from a byte array to a base64 encoded string.
buffer | the byte array to be converted |
|
inlinestatic |
Remove multiple properties from an XMP object.
Remove multiple properties from an XMP object. RemoveProperties was created to support the File Info dialog's Delete button, and has been been generalized somewhat from those specific needs. It operates in one of three main modes depending on the schemaNS and propName parameters:
It is an error to pass an empty
and non-empty
.
xmp | The XMP object containing the properties to be removed. |
schemaNS | Optional schema namespace URI for the properties to be removed. |
propName | Optional path expression for the property to be removed. |
doAllProperties | Option flag to control the deletion: do internal properties in addition to external properties. |
includeAliases | Option flag to control the deletion: Include aliases in the "named schema" case above. Note: Currently not supported. |
XMPException | Forwards the Exceptions from the metadata processing |
iText.Kernel.XMP.XMPException |
|
inlinestatic |
Separate a single edit string into an array of strings.
xmp | The XMP object containing the array to be updated. |
schemaNS | The schema namespace URI for the array. Must not be null or the empty string. |
arrayName | The name of the array. May be a general path expression, must not be null or the empty string. Each item in the array must be a simple string value. |
catedStr | The string to be separated into the array items. |
arrayOptions | Option flags to control the separation. |
preserveCommas | Flag if commas shall be preserved |
XMPException | Forwards the Exceptions from the metadata processing |
iText.Kernel.XMP.XMPException |