For PDFSharp:
If you would like to change/add the metadata on the Custom Properties of a PDF you can use the PdfDocument.Info.Elements object.
String filename = @"d:\temp\Hugo-input.pdf";
String outputfile = @"d:\temp\Hugo-output.pdf";
PdfDocument document = PdfReader.Open(filename);
document.Info.Elements.Add(new KeyValuePair("/MyKey",new PdfString("MyValue")));
document.Save(outputfile);
Always start a custom key with a slash!
You can find the key and value when you open this document in Adobe Acrobat Reader -> File -> Properties -> Custom.
This works with PDFSharp 1.32