Hi Alexei,
Thanks for your inquiry. Please use the PdfSaveOptions.ExportCustomPropertiesAsMetadata property to get or set a value determining whether or not to export CustomDocumentProperties as Metadata. The default value is false. When this value is set to true custom document properties are exported in PDF document as metadata.
The namespace of exported properties in XMP packet is “custprops”. Every property has an associated xml-element “custprops:Property1”, “custprops:Property2” and so on. There is “rdf:Description” element inside property element. The description element has two elements “custprops:Name”, containing custom property’s name as a value of this xml-element, and “custprops:Value”, containing custom property’s value as value of this xml-element.
var wdoc = new Document();
wdoc.BuiltInDocumentProperties.Title = "My Title";
wdoc.CustomDocumentProperties.Add("prop1", "val1");
wdoc.CustomDocumentProperties.Add("prop2", "val3");
wdoc.CustomDocumentProperties.Add("prop3", "val3");
wdoc.Save(MyDir + "WORD.docx",
Aspose.Words.SaveFormat.Docx);
PdfSaveOptions options = new PdfSaveOptions();
options.ExportCustomPropertiesAsMetadata
= true;
wdoc.Save(MyDir
+ "PDF.pdf", options);