public final class PdfXmpMetadata extends SaveableFacade implements com.aspose.ms.System.Collections.IDictionary
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(int key,
Object value)
Adds value to XMP metadata.
|
void |
add(XmpPdfAExtensionObject xmpPdfAExtensionObject,
String namespacePrefix,
String namespaceUri,
String schemaDescription)
Adds extension field into metadata.
|
void |
addItem(Object key,
Object value)
Adds new element to the dictionary object.
|
void |
clear()
Removes all elements from the object.
|
boolean |
contains(Object key)
Checks if dictionary contains the specified key.
|
void |
copyTo(com.aspose.ms.System.Array array,
int index)
Copy metadata into array.
|
Object |
get_Item(Object key)
Gets value by key.
|
Object |
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.ICollection |
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.ICollection |
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.IDictionaryEnumerator |
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.
|
void |
remove(int key)
Removes element with specified key.
|
void |
remove(XmpPdfAExtensionObject key)
Removes pdf extension field.
|
void |
removeItem(Object key)
Removes key from the dictionary.
|
void |
set_Item(Object key,
Object value)
Sets value by key.
|
void |
setByDefaultMetadataProperties(int key,
Object value)
Sets value of XMP metadata by key.
|
int |
size()
Gets count if items in the collection.
|
save, save
bindPdf, bindPdf, bindPdf, bindPdf, bindPdf, close, dispose, getDocument
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 add(int key, Object 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.IDictionary
public void remove(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 remove(XmpPdfAExtensionObject key)
Removes pdf extension field.
key
- The key of value to remove.public void addItem(Object key, Object 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.IDictionary
key
- Key of new element.value
- Value of the element.public boolean contains(Object 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");
contains
in interface com.aspose.ms.System.Collections.IDictionary
key
- Key which will be checked.public com.aspose.ms.System.Collections.IDictionaryEnumerator iterator()
Gets enumerator object of the dictionary.
public com.aspose.ms.System.Collections.ICollection getKeys()
Gets keys from the dictionary.
getKeys
in interface com.aspose.ms.System.Collections.IDictionary
public void removeItem(Object key)
Removes key from the dictionary.
PdfXmpMetadata xmp = new PdfXmpMetadata(); xmp.bindPdf("input.pdf"); xmp.remove("xmp:Nickname");
removeItem
in interface com.aspose.ms.System.Collections.IDictionary
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.ICollection getValues()
Gets the collection of values in dictionary.
getValues
in interface com.aspose.ms.System.Collections.IDictionary
public Object get_Item(Object 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.IDictionary
key
- The key name to get.public void set_Item(Object key, Object 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.IDictionary
key
- The key name to set.value
- The value to set.public boolean isFixedSize()
Returns true is collection has fixed size.
isFixedSize
in interface com.aspose.ms.System.Collections.IDictionary
public boolean isReadOnly()
Returns true if collection is read-only.
isReadOnly
in interface com.aspose.ms.System.Collections.IDictionary
public void copyTo(com.aspose.ms.System.Array array, int index)
Copy metadata into array.
copyTo
in interface com.aspose.ms.System.Collections.ICollection
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.ICollection
PdfXmpMetadata pxm = new PdfXmpMetadata(); pxm.bindPdf("PdfFile.pdf"); System.out.println("Count = " + pxm.size());
public boolean isSynchronized()
Returns true if collection is synchronized.
isSynchronized
in interface com.aspose.ms.System.Collections.ICollection
public Object getSyncRoot()
Gets synchroniztion object of the collection.
getSyncRoot
in interface com.aspose.ms.System.Collections.ICollection
public com.aspose.ms.System.Collections.IEnumerator iteratorIt()
Gets enumerator object of the collection.
public Object 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, Object 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.Copyright © 2017 Aspose. All Rights Reserved.