public class XmpPackage extends XmpMetadataContainer
Represents base abstraction for XMP package.
Learn more
This example demonstrates how to add a custom XMP package to a file of any supported format.
try (Metadata metadata = new Metadata(Constants.InputJpeg)) { IXmp root = (IXmp) metadata.getRootPackage(); XmpPacketWrapper packet = new XmpPacketWrapper(); XmpPackage custom = new XmpPackage("gd", "https://groupdocs.com"); custom.set("gd:Copyright", "Copyright (C) 2011-2022 GroupDocs. All Rights Reserved."); custom.set("gd:CreationDate", new Date()); custom.set("gd:Company", XmpArray.from(new String[]{"Aspose", "GroupDocs"}, XmpArrayType.Ordered)); packet.addPackage(custom); root.setXmpPackage(packet); metadata.save(Constants.OutputJpeg); }
Constructor and Description |
---|
XmpPackage(String prefix,
String namespaceUri)
Initializes a new instance of the
XmpPackage class. |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all XMP properties.
|
String |
getNamespaceUri()
Gets the namespace URI.
|
String |
getPrefix()
Gets the xmlns prefix.
|
String |
getXmlNamespace()
Gets the XML namespace.
|
String |
getXmpRepresentation()
Converts the XMP value to the XML representation.
|
boolean |
remove(String name)
Removes the property with the specified name.
|
void |
set(String name,
boolean value)
Sets boolean property.
|
void |
set(String name,
Date value)
Sets
DateTime property. |
void |
set(String name,
double value)
Sets double property.
|
void |
set(String name,
int value)
Sets integer property.
|
void |
set(String name,
String value)
Sets string property.
|
void |
set(String name,
XmpArray value)
Sets the value inherited from
XmpArray . |
void |
set(String name,
XmpComplexType value)
Sets the value inherited from
XmpComplexType . |
void |
set(String name,
XmpValueBase value)
Sets the value inherited from
XmpValueBase . |
addProperties, contains, findProperties, get_Item, getCount, getKeys, getKnowPropertyDescriptors, getMetadataType, getPropertyDescriptors, iterator, removeProperties, sanitize, setProperties, updateProperties
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public final String getPrefix()
Gets the xmlns prefix.
public final String getNamespaceUri()
Gets the namespace URI.
public final String getXmlNamespace()
Gets the XML namespace.
public void set(String name, String value)
Sets string property.
name
- XMP metadata property name.value
- XMP metadata property value.public final void set(String name, int value)
Sets integer property.
name
- XMP metadata property name.value
- XMP metadata property value.public final void set(String name, boolean value)
Sets boolean property.
name
- XMP metadata property name.value
- XMP metadata property value.public final void set(String name, Date value)
Sets DateTime
property.
name
- XMP metadata property name.value
- XMP metadata property value.public final void set(String name, double value)
Sets double property.
name
- XMP metadata property name.value
- XMP metadata property value.public final boolean remove(String name)
Removes the property with the specified name.
name
- XMP metadata property name.public final void clear()
Removes all XMP properties.
public final void set(String name, XmpValueBase value)
Sets the value inherited from XmpValueBase
.
name
- XMP metadata property name.value
- XMP metadata property value.public void set(String name, XmpComplexType value)
Sets the value inherited from XmpComplexType
.
name
- XMP metadata property name.value
- XMP metadata property value.public void set(String name, XmpArray value)
Sets the value inherited from XmpArray
.
name
- XMP metadata property name.value
- XMP metadata property value.public String getXmpRepresentation()
Converts the XMP value to the XML representation.
getXmpRepresentation
in interface IXmpType
getXmpRepresentation
in class XmpMetadataContainer
string
representation of the XMP value.