We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create custom metadata namespace

I can successfully add metadata to an existing namespace with code like this:

Document pdfDocument = new Document(“myDoc.pdf”);
pdfDocument.Metadata.RegisterNamespaceUri(“pdf”, “http://ns.adobe.com/pdf/1.3/”, “Adobe PDF schema”);
PdfXmpMetadata xmp = new PdfXmpMetadata();
pdfDocument.Metadata[“pdf:myCustomTag”] = “blah”;
pdfDocument.Save(“myDoc.pdf”);

However, I don’t seem to be able to create a new namespace and add metadata to it:

Document pdfDocument = new Document(“myDoc.pdf”);
pdfDocument.Metadata.RegisterNamespaceUri(“pdfuaid”, “http://www.aim.org/pdfua/ns/id/”, “PDF/UA schema”);
PdfXmpMetadata xmp = new PdfXmpMetadata();
pdfDocument.Metadata[“pdfuaid:part”] = “1”;
pdfDocument.Save(“myDoc.pdf”);

Is it not possible to create a namespace, or is there something wrong with my code?

You can disregard…I discovered XmpPdfAExtensionProperty, and that did the trick.

@cfinley

Thank you for your kind feedback.

We are glad to know that things have started working in your environment. Please feel free to contact us if you need any further assistance.

@cfinley

In addition to our last post, there are multiple approaches that can be used to create custom namespaces. Would you please share your code snippet for reference of other users who may have similar requirements.