public final class PdfXmpMetadata extends SaveableFacade implements com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
Class for manipulation with XMP metadata.
Constructor and Description |
---|
PdfXmpMetadata()
Constructor for PdfXmpMetadata.
|
PdfXmpMetadata(IDocument document)
Initializes new
PdfXmpMetadata object on base of the document . |
Modifier and Type | Method and Description |
---|---|
void |
add(XmpPdfAExtensionObject xmpPdfAExtensionObject,
String namespacePrefix,
String namespaceUri,
String schemaDescription)
Adds extension field into metadata.
|
void |
addItem(int key,
com.aspose.pdf.engine.data.xmp.XmpValue value)
Adds value to XMP metadata.
|
void |
addItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Adds pair with key and value into the dictionary.
|
void |
addItem(String key,
Object value)
Adds new element to the dictionary object.
|
void |
addItem(String key,
com.aspose.pdf.engine.data.xmp.XmpValue value)
Adds new element to the dictionary object.
|
void |
clear()
Removes all elements from the object.
|
boolean |
contains(int property)
Checks if dictionary contains the specified property.
|
boolean |
contains(String key)
Checks if dictionary contains the specified key.
|
boolean |
containsItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Checks does specified key-value pair is contained in the dictionary.
|
boolean |
containsKey(String key)
Determines does this dictionary contasins specified key.
|
void |
copyToTArray(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>[] array,
int index)
Copy metadata into array.
|
com.aspose.pdf.engine.data.xmp.XmpValue |
get_Item(String key)
Gets value by key.
|
com.aspose.pdf.engine.data.xmp.XmpValue |
getByDefaultMetadataProperties(int key)
Gets value of XMP metadata by key.
|
Hashtable<String,XmpPdfAExtensionSchema> |
getExtensionFields()
Gets the dictionary of extension fields.
|
com.aspose.ms.System.Collections.Generic.IGenericCollection<String> |
getKeys()
Gets keys from the dictionary.
|
String |
getNamespaceURIByPrefix(String prefix)
Gets namespace URI by prefix.
|
String |
getPrefixByNamespaceURI(String namespaceURI)
Gets the prefix by namespace URI.
|
Object |
getSyncRoot()
Gets synchroniztion object of the collection.
|
com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.pdf.engine.data.xmp.XmpValue> |
getValues()
Gets the collection of values in dictionary.
|
byte[] |
getXmpMetadata()
Get the XmpMetadata of the input pdf in a xml format.
|
byte[] |
getXmpMetadata(String name)
Get a part of the XmpMetadata of the input pdf according to a meta name.
|
boolean |
isFixedSize()
Returns true is collection has fixed size.
|
boolean |
isReadOnly()
Returns true if collection is read-only.
|
boolean |
isSynchronized()
Returns true if collection is synchronized.
|
com.aspose.ms.System.Collections.IEnumerator |
iterator_Rename_Namesake() |
com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>> |
iterator()
Gets enumerator object of the dictionary.
|
com.aspose.ms.System.Collections.IEnumerator |
iteratorIt()
Gets enumerator object of the collection.
|
void |
registerNamespaceURI(String prefix,
String namespaceURI)
Registers the namespace URI.
|
boolean |
removeItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Removes key/value pair from the colleciton.
|
void |
removeItemByKey(int key)
Removes element with specified key.
|
boolean |
removeItemByKey(String key)
Removes key from the dictionary.
|
void |
set_Item(String key,
com.aspose.pdf.engine.data.xmp.XmpValue value)
Sets value by key.
|
void |
setByDefaultMetadataProperties(int key,
com.aspose.pdf.engine.data.xmp.XmpValue value)
Sets value of XMP metadata by key.
|
int |
size()
Gets count if items in the collection.
|
boolean |
tryGetValue(String key,
Object[] value)
Tries to find key in the dictionary and retreives value if found.
|
save, save
bindPdf, bindPdf, bindPdf, bindPdf, bindPdf, close, dispose, getDocument
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public PdfXmpMetadata()
Constructor for PdfXmpMetadata.
PdfXmlMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf");
public PdfXmpMetadata(IDocument document)
Initializes new PdfXmpMetadata
object on base of the document
.
document
- Pdf document.public void registerNamespaceURI(String prefix, String namespaceURI)
Registers the namespace URI.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); xmp.registerNamespaceURI("xmp", "http://ns.adobe.com/xap/1.0/");
prefix
- The prefix.namespaceURI
- The namespace URI.public String getNamespaceURIByPrefix(String prefix)
Gets namespace URI by prefix.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); System.out.println(xmp.getNamespaceURIByPrefix("xmp"));
prefix
- The prefix.public String getPrefixByNamespaceURI(String namespaceURI)
Gets the prefix by namespace URI.
PdfXmpMetadata xmp = new PdfXmpMetadata("input.pdf"); System.out.println(xmp.getPrefixByNamespaceURI("http://ns.adobe.com/xap/1.0/"));
namespaceURI
- Namespace URI.public void addItem(int key, com.aspose.pdf.engine.data.xmp.XmpValue value)
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"));
key
- The key name.value
- Value which will be added.public void add(XmpPdfAExtensionObject xmpPdfAExtensionObject, String namespacePrefix, String namespaceUri, String schemaDescription)
Adds extension field into metadata.
xmpPdfAExtensionObject
- The pdf extension object to add.namespacePrefix
- The prefix of schema.namespaceUri
- The namespace uri of schema.schemaDescription
- The optional description of schema.public void clear()
Removes all elements from the object.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.clear();
clear
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
public void removeItemByKey(int key)
Removes element with specified key.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove(DefaultMetadataProperties.Nickname);
key
- Key of the element which will be deleted.DefaultMetadataProperties
public void addItem(String key, com.aspose.pdf.engine.data.xmp.XmpValue value)
Adds new element to the dictionary object.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.add("xmp:Nickname", "Nickname1");
addItem
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- Key of new element.value
- Value of the element.public void addItem(String key, Object value)
Adds new element to the dictionary object.
key
- Key of new element.value
- Value of the element.public boolean contains(String key)
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");
key
- Key which will be checked.public boolean contains(int property)
Checks if dictionary contains the specified property.
property
- Property which will be checked.public com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>> iterator()
Gets enumerator object of the dictionary.
iterator
in interface com.aspose.ms.System.Collections.Generic.IGenericEnumerable<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
iterator
in interface com.aspose.ms.System.Collections.IEnumerable<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
iterator
in interface Iterable<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
public com.aspose.ms.System.Collections.Generic.IGenericCollection<String> getKeys()
Gets keys from the dictionary.
getKeys
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
public boolean removeItemByKey(String key)
Removes key from the dictionary.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove("xmp:Nickname");
removeItemByKey
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- Key which will be removed.public Hashtable<String,XmpPdfAExtensionSchema> getExtensionFields()
Gets the dictionary of extension fields.
Hashtable<String, XmpPdfAExtensionSchema>
objectpublic com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.pdf.engine.data.xmp.XmpValue> getValues()
Gets the collection of values in dictionary.
getValues
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
public com.aspose.pdf.engine.data.xmp.XmpValue get_Item(String key)
Gets value by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item("xmp:Nickname"));
get_Item
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- The key name to get.public void set_Item(String key, com.aspose.pdf.engine.data.xmp.XmpValue value)
Sets value by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item("xmp:Nickname"));
set_Item
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- The key name to set.value
- The value to set.public boolean isFixedSize()
Returns true is collection has fixed size.
public boolean isReadOnly()
Returns true if collection is read-only.
isReadOnly
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
public void copyToTArray(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>[] array, int index)
Copy metadata into array.
copyToTArray
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
array
- The destination array.index
- The starting index.public int size()
Gets count if items in the collection.
size
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println("Count = " + pxm.size());
public boolean isSynchronized()
Returns true if collection is synchronized.
public Object getSyncRoot()
Gets synchroniztion object of the collection.
public com.aspose.ms.System.Collections.IEnumerator iteratorIt()
Gets enumerator object of the collection.
public com.aspose.ms.System.Collections.IEnumerator iterator_Rename_Namesake()
public com.aspose.pdf.engine.data.xmp.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));
key
- Key of the value.DefaultMetadataProperties
public void setByDefaultMetadataProperties(int key, com.aspose.pdf.engine.data.xmp.XmpValue value)
Sets value of XMP metadata by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item(DefaultMetadataProperties.CreatorTool));
key
- Key of the DefaultMetadataProperties value.value
- Object.DefaultMetadataProperties
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();
public byte[] getXmpMetadata(String name)
Get a part of the XmpMetadata of the input pdf according to a meta name.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); byte[] data = pxm.getXmpMetadata("dc:creator");
name
- Metadata name.public boolean containsKey(String key)
Determines does this dictionary contasins specified key.
containsKey
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- Key to search in the dictionary.public boolean tryGetValue(String key, Object[] value)
Tries to find key in the dictionary and retreives value if found.
tryGetValue
in interface com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,com.aspose.pdf.engine.data.xmp.XmpValue>
key
- Key to search in the dictionary.value
- Retreived value.public void addItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Adds pair with key and value into the dictionary.
addItem
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
item
- Item to be added.public boolean containsItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Checks does specified key-value pair is contained in the dictionary.
containsItem
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
item
- Key-value pair.public boolean removeItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue> item)
Removes key/value pair from the colleciton.
removeItem
in interface com.aspose.ms.System.Collections.Generic.IGenericCollection<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,com.aspose.pdf.engine.data.xmp.XmpValue>>
item
- Key/value pair to be removed.Copyright © 2018 Aspose. All Rights Reserved.