IXmpCustomSchema Interface
Defines access to custom XMP schema properties.
Declaration
public interface IXmpCustomSchema extends Iterable<XmpProperty>
Remarks
Refer to the following help topic for additional information: Create Custom XMP Schemas.
The following code snippet creates a custom XMP schema with the http://www.example.com/custom/1.0/ namespace URI and adds custom properties:
import com.devexpress.docs.pdf.*;
import java.io.*;
import java.nio.file.*;
public class Main {
public static void main(String[] args) throws Exception {
try (InputStream inputStream = new FileInputStream("Document.pdf");
PdfDocument pdfDocument = new PdfDocument(inputStream)) {
// Create a new XMP metadata packet.
XmpMetadata metadata = new XmpMetadata();
// Register a custom XMP namespace.
metadata.registerNamespace(
"http://www.example.com/custom/1.0/",
"dx"
);
// Add custom metadata properties.
IXmpCustomSchema customSchema = metadata.getCustomSchema();
customSchema.set("Team", "Office");
customSchema.set("Checked", "true");
customSchema.set("Project", "PDF Document API");
// Embed the XMP metadata into the PDF document.
pdfDocument.getMetadata().setXmp(metadata);
// Save the updated document.
try (FileOutputStream outputStream = new FileOutputStream("UpdatedDocument.pdf")) {
pdfDocument.save(outputStream);
}
}
}
}
Implements
java.lang.Iterable<com.devexpress.docs.pdf.XmpProperty>
Methods
get(String localName) Method
Returns a custom XMP property value by local name.
Declaration
public abstract String get(String localName)
Parameters
| Name | Type | Description |
|---|---|---|
| localName | String | The local property name. |
Returns
| Type | Description |
|---|---|
| String | The custom XMP property value. |
iterator() Method
Returns an iterator for custom XMP properties.
Declaration
public abstract Iterator<XmpProperty> iterator()
Returns
| Type | Description |
|---|---|
| java.util.Iterator<XmpProperty> | An iterator for custom XMP properties. |
set(String localName, String value) Method
Sets a custom XMP property value by local name.
Declaration
public abstract void set(String localName, String value)
Parameters
| Name | Type | Description |
|---|---|---|
| localName | String | The local property name. |
| value | String | The custom XMP property value. |