public final class PdfXmpMetadata extends SaveableFacade implements com.aspose.ms.System.Collections.Generic.IGenericDictionary<String,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,
XmpValue value)
Adds value to XMP metadata.
|
void |
addItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,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,
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,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,XmpValue>[] array,
int index)
Copy metadata into array.
|
XmpValue |
get_Item(String key)
Gets value by key.
|
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<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,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,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,
XmpValue value)
Sets value by key.
|
void |
setByDefaultMetadataProperties(int key,
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, 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();
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, XmpValue value)
Adds new element to the dictionary object.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.add("xmp:Nickname", "Nickname1");
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,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,XmpValue>>
iterator
in interface com.aspose.ms.System.Collections.IEnumerable<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,XmpValue>>
iterator
in interface Iterable<com.aspose.ms.System.Collections.Generic.KeyValuePair<String,XmpValue>>
public com.aspose.ms.System.Collections.Generic.IGenericCollection<String> getKeys()
Gets keys from the dictionary.
public boolean removeItemByKey(String key)
Removes key from the dictionary.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove("xmp:Nickname");
public Hashtable<String,XmpPdfAExtensionSchema> getExtensionFields()
Gets the dictionary of extension fields.
Hashtable<String, XmpPdfAExtensionSchema>
objectpublic com.aspose.ms.System.Collections.Generic.IGenericCollection<XmpValue> getValues()
Gets the collection of values in dictionary.
public 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"));
public void set_Item(String key, XmpValue value)
Sets value by key.
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println(pxm.get_Item("xmp:Nickname"));
public boolean isFixedSize()
Returns true is collection has fixed size.
public boolean isReadOnly()
Returns true if collection is read-only.
public void copyToTArray(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,XmpValue>[] array, int index)
Copy metadata into array.
public int size()
Gets count if items in the collection.
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 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, 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.
public boolean tryGetValue(String key, Object[] value)
Tries to find key in the dictionary and retreives value if found.
public void addItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,XmpValue> item)
Adds pair with key and value into the dictionary.
public boolean containsItem(com.aspose.ms.System.Collections.Generic.KeyValuePair<String,XmpValue> item)
Checks does specified key-value pair is contained in the dictionary.