Back to Devexpress

XmpDocument.Remove(String) Method

officefileapi-devexpress-dot-pdf-dot-xmp-dot-xmpdocument-dot-remove-x28-system-dot-string-x29.md

latest3.6 KB
Original Source

XmpDocument.Remove(String) Method

Removes the specified node from the XMP packet.

Namespace : DevExpress.Pdf.Xmp

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public bool Remove(
    string qualifiedName
)
vb
Public Function Remove(
    qualifiedName As String
) As Boolean

Parameters

NameTypeDescription
qualifiedNameString

The node’s qualified name ( prefix:local format).

|

Returns

TypeDescription
Boolean

true if the node is successfully removed; otherwise, false.

|

Example

The code sample below removes the dc:Title node:

csharp
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);

    // Delete the node:
    metadata.Remove("dc:title");

    // Apply changes:
    document.SetMetadata(metadata);

    // Save the result:
    pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
    ' Load a document
    pdfDocumentProcessor.LoadDocument("Documents//Invoice.pdf")
    Dim document As PdfDocument = pdfDocumentProcessor.Document

    ' Retrieve metadata:
    Dim metadata As XmpDocument = XmpDocument.FromString(document.Metadata.Data)

    ' Delete the node:
    metadata.Remove("dc:title")

    ' Apply changes:
    document.SetMetadata(metadata)

    ' Save the result:
    pdfDocumentProcessor.SaveDocument("Invoice_Upd.pdf")
End Using

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Remove(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

pdf-document-api-xmp-example/CS/XmpMetadataExamples/Program.cs#L48

csharp
editedMetadata.Remove("dc:subject");

pdf-document-api-xmp-example/VB/XmpMetadataExamples/Program.vb#L39

vb
dimensions.Add("stDim:Unit", "inch")
editedMetadata.Remove("dc:subject")
' Embed modified metadata to the document:

See Also

XmpDocument Class

XmpDocument Members

DevExpress.Pdf.Xmp Namespace