PdfXmpMetadata
Inheritance: java.lang.Object, com.aspose.pdf.facades.Facade com.aspose.pdf.facades.SaveableFacade com.aspose.pdf.facades.PdfXmpMetadata, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade com.aspose.pdf.facades.PdfXmpMetadata, com.aspose.pdf.facades.SaveableFacade, com.aspose.pdf.facades.PdfXmpMetadata
All Implemented Interfaces: com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair< String, XmpValue », com.aspose.ms.System.Collections.Generic.IGenericDictionary< String, XmpValue >, com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.ms.System.Collections.Generic.KeyValuePair< String, XmpValue », com.aspose.ms.System.Collections.IEnumerable<com.aspose.ms.System.Collections.Generic.KeyValuePair< String, XmpValue », com.aspose.ms.System.IDisposable, IFacade, ISaveableFacade, Closeable, AutoCloseable, Iterable <com.aspose.ms.System.Collections.Generic.KeyValuePair< String, XmpValue »
public final class PdfXmpMetadata extends SaveableFacade implements com.aspose.ms.System.Collections.Generic.IGenericDictionary< String , XmpValue >
Class for manipulation with XMP metadata.
Constructors
| Constructor | Description |
|---|---|
| PdfXmpMetadata | Constructor for PdfXmpMetadata. PdfXmlMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); |
| PdfXmpMetadata | Constructor for PdfXmpMetadata. PdfXmlMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); |
Methods
| Method | Description |
|---|---|
| add | Adds extension field into metadata. |
| addItem | Adds value to XMP metadata. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.add(DefaultMetadataProperties.Nickname, “name1”); xmp.save(TestSettings.getOutputFile(“XMP_AddedValue.pdf”)); |
| addItem | Adds pair with key and value into the dictionary. |
| addItem | Adds new element to the dictionary object. |
| addItem | Adds new element to the dictionary object. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.add(“xmp:Nickname”, “Nickname1”); |
| clear | Removes all elements from the object. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.clear(); |
| contains | Checks if dictionary contains the specified property. |
| contains | Checks if dictionary contains the specified key. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.add(“xmp:Nickname”, “Nickname1”); if (!xmp.contains(“xmp:Nickname”)) System.out.println(“Key does not exists”); |
| containsItem | Checks does specified key-value pair is contained in the dictionary. |
| containsKey | Determines does this dictionary contasins specified key. |
| copyToTArray | Copy metadata into array. |
| get_Item | Gets value by key. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); System.out.println(pxm.get_Item(“xmp:Nickname”)); |
| getByDefaultMetadataProperties | Gets value of XMP metadata by key. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); System.out.println(pxm.get_Item(DefaultMetadataProperties.CreatorTool)); |
| getExtensionFields | Gets the dictionary of extension fields. |
| getKeys | Gets keys from the dictionary. |
| getNamespaceURIByPrefix | Gets namespace URI by prefix. PdfXmpMetadata xmp = new PdfXmpMetadata(“input.pdf”); System.out.println(xmp.getNamespaceURIByPrefix(“xmp”)); |
| getPrefixByNamespaceURI | Gets the prefix by namespace URI. PdfXmpMetadata xmp = new PdfXmpMetadata(“input.pdf”); System.out.println(xmp.getPrefixByNamespaceURI(“http://ns.adobe.com/xap/1.0/")); |
| getSyncRoot | Gets synchroniztion object of the collection. |
| getValues | Gets the collection of values in dictionary. |
| getXmpMetadata | Get the XmpMetadata of the input pdf in a xml format. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); byte[] data = pxm.getXmpMetadata(); |
| getXmpMetadata | Get the XmpMetadata of the input pdf in a xml format. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); byte[] data = pxm.getXmpMetadata(); |
| isFixedSize | Returns true is collection has fixed size. |
| isReadOnly | Returns true if collection is read-only. |
| isSynchronized | Returns true if collection is synchronized. |
| iterator_Rename_Namesake | |
| iterator | Gets enumerator object of the dictionary. |
| iteratorIt | Gets enumerator object of the collection. |
| registerNamespaceURI | Registers the namespace URI. PdfXmpMetadata xmp = new PdfXmpMetadata(“input.pdf”); xmp.registerNamespaceURI(“xmp”, “http://ns.adobe.com/xap/1.0/"); |
| removeItem | Removes key/value pair from the collection. |
| removeItemByKey | Removes element with specified key. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.remove(DefaultMetadataProperties.Nickname); |
| removeItemByKey | Removes key from the dictionary. PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf(“input.pdf”); xmp.remove(“xmp:Nickname”); |
| set_Item | Sets value by key. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); System.out.println(pxm.get_Item(“xmp:Nickname”)); |
| setByDefaultMetadataProperties | Sets value of XMP metadata by key. PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); System.out.println(pxm.get_Item(DefaultMetadataProperties.CreatorTool)); |
| size | Gets count if items in the collection. |
| tryGetValue | Tries to find key in the dictionary and retreives value if found. |
PdfXmpMetadata
public PdfXmpMetadata()
Constructor for PdfXmpMetadata.
PdfXmlMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); PdfXmpMetadata
Constructor for PdfXmpMetadata.
PdfXmlMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); add
Adds extension field into metadata.
addItem
Adds value to XMP metadata.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.add(DefaultMetadataProperties.Nickname, "name1"); xmp.save(TestSettings.getOutputFile("XMP_AddedValue.pdf")); addItem
Adds pair with key and value into the dictionary.
addItem
Adds new element to the dictionary object.
addItem
Adds new element to the dictionary object.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.add("xmp:Nickname", "Nickname1"); clear
public void clear()
Removes all elements from the object.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.clear(); contains
public boolean contains(int property)
Checks if dictionary contains the specified property.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| property | Property which will be checked. |
Returns: True - if the dictionary contains the specified property; otherwise, false.
contains
Checks if dictionary contains the specified key.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.add("xmp:Nickname", "Nickname1"); if (!xmp.contains("xmp:Nickname")) System.out.println("Key does not exists"); containsItem
Checks does specified key-value pair is contained in the dictionary.
containsKey
Determines does this dictionary contasins specified key.
copyToTArray
Copy metadata into array.
get_Item
Gets value by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item("xmp:Nickname")); getByDefaultMetadataProperties
public XmpValue getByDefaultMetadataProperties(int key)
Gets value of XMP metadata by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item(DefaultMetadataProperties.CreatorTool)); Parameters:
| Parameter | Type | Description |
|---|---|---|
| key | Key of the value. |
Returns: Value from XMP metadata. @see DefaultMetadataProperties
getExtensionFields
public Hashtable < String , XmpPdfAExtensionSchema > getExtensionFields()
Gets the dictionary of extension fields.
Returns: {@code Hashtable<String, XmpPdfAExtensionSchema>} object
getKeys
public com.aspose.ms.System.Collections.Generic.IGenericCollection< String > getKeys()
Gets keys from the dictionary.
Returns: ICollection element
getNamespaceURIByPrefix
Gets namespace URI by prefix.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); System.out.println(xmp.getNamespaceURIByPrefix("xmp")); getPrefixByNamespaceURI
Gets the prefix by namespace URI.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); System.out.println(xmp.getPrefixByNamespaceURI("http://ns.adobe.com/xap/1.0/")); getSyncRoot
public Object getSyncRoot()
Gets synchroniztion object of the collection.
Returns: Object element
getValues
public com.aspose.ms.System.Collections.Generic.IGenericCollection< XmpValue > getValues()
Gets the collection of values in dictionary.
Returns: ICollection object
getXmpMetadata
public byte[] getXmpMetadata()
Get the XmpMetadata of the input pdf in a xml format.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); byte[] data = pxm.getXmpMetadata(); Returns: The bytes of the XmpMetadata.
getXmpMetadata
Get the XmpMetadata of the input pdf in a xml format.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); byte[] data = pxm.getXmpMetadata(); Returns: The bytes of the XmpMetadata.
isFixedSize
public boolean isFixedSize()
Returns true is collection has fixed size.
Returns: boolean value
isReadOnly
public boolean isReadOnly()
Returns true if collection is read-only.
Returns: boolean value
isSynchronized
public boolean isSynchronized()
Returns true if collection is synchronized.
Returns: boolean value
iterator_Rename_Namesake
public com.aspose.ms.System.Collections.IEnumerator iterator_Rename_Namesake()
iterator
public com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.ms.System.Collections.Generic.KeyValuePair< String , XmpValue >> iterator()
Gets enumerator object of the dictionary.
Returns: The enumerator object.
iteratorIt
public com.aspose.ms.System.Collections.IEnumerator iteratorIt()
Gets enumerator object of the collection.
Returns: IEnumerator object
registerNamespaceURI
Registers the namespace URI.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); xmp.registerNamespaceURI("xmp", "http://ns.adobe.com/xap/1.0/"); removeItem
Removes key/value pair from the collection.
removeItemByKey
public void removeItemByKey(int key)
Removes element with specified key.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove(DefaultMetadataProperties.Nickname); Parameters:
| Parameter | Type | Description |
|---|---|---|
| key | Key of the element which will be deleted. @see DefaultMetadataProperties |
removeItemByKey
Removes key from the dictionary.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove("xmp:Nickname"); set_Item
Sets value by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item("xmp:Nickname")); setByDefaultMetadataProperties
Sets value of XMP metadata by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item(DefaultMetadataProperties.CreatorTool)); size
public int size()
Gets count if items in the collection.
Returns: int value
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf(“PdfFile.pdf”); System.out.println(“Count = " + pxm.size());
tryGetValue
Tries to find key in the dictionary and retreives value if found.