You can do low-level editing of a PDF in PDFNet. Briefly:
Create a new custom entry (on the document's root):
Obj* cust_dict = [[myPDFDoc GetRoot] PutDict:@"_MyCustomData" ];
[cust_dict PutText:@"_myGUID" value:@"123-4567-890"];
Read the custom entry:
Obj* dict = [[myPDFDoc GetRoot] FindObj:@"_MyCustomData"];
DictIterator* itr = [dict Get:@"_myGUID"];
Obj* strObj = [itr Value];
NSString* str = [strObj GetAsPDFText];
NSLog(@"guid is %@", str);
Delete a custom entry:
[[myPDFDoc GetRoot] EraseDictElementWithKey:@"_MyCustomData"];
You could also place metadata on a page's root, or in a more standard location, as outlined here: https://groups.google.com/d/msg/pdfnet-sdk/gtPjLZVbRSQ/Tv5DTb9pRXkJ
For more specific information about adding XMP metadata (as your tag implies you're interested in), try searching XMP on the PDFNet support forum: https://groups.google.com/forum/#!searchin/pdfnet-sdk/XMP
I'm not sure how you would do this with Quartz.
Disclosure: I work for PDFTron, maker of PDFNet.