Skip to main content
All docs
V23.2

XmpSimpleNode Class

An XMP metadata node with a simple value.

Namespace: DevExpress.Pdf.Xmp

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public class XmpSimpleNode :
    XmpValueNode

Remarks

A simple value is a Unicode string. The string may be empty. A simple value can be a regular string or URI string.

Example

The code sample below edits document metadata:

View Example: How to Embed XMP Metadata to the PDF Document

using DevExpress.Pdf;
using DevExpress.Pdf.Xmp;
//...

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    // Load a document
    pdfDocumentProcessor.LoadDocument("Documents//Invoice.pdf");
    PdfDocument document = pdfDocumentProcessor.Document;

    // Retrieve metadata:
    XmpDocument metadata = XmpDocument.FromString(document.Metadata.Data);

    // Add items to the Creator array:
    XmpArray creators = metadata.GetArray("dc:creator");
    if (creators != null)
    {
        creators.Add("PDF Document API");
        creators.Add("Office File API");
    }

    // Change the CreatorTool node value:
    XmpSimpleNode creatorTool = metadata.GetSimpleValue("xmp:CreatorTool");
    creatorTool.SetValue("PDF Document API");

    // Add MaxPageSize structure:
    XmpName structureName = XmpName.Get("MaxPageSize", "http://ns.adobe.com/xap/1.0/t/pg/");
    XmpStructure dimensions = metadata.CreateStructure(structureName);
    metadata.RegisterNamespace("http://ns.adobe.com/xap/1.0/sType/Dimensions#", "stDim");
    dimensions.Add("stDim:h", 11);
    dimensions.Add("stDim:w", 8.5f);
    dimensions.Add("stDim:Unit", "inch");

    // Embed modified metadata in the document:
    document.SetMetadata(metadata);

    // Save the result:
    pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf");
}

Inheritance

See Also