url = NSURL.fileURLWithPath_('test.pdf')
pdfdoc = PDFDocument.alloc().initWithURL_(url)
attrs = NSMutableDictionary.alloc().initWithDictionary_(pdfdoc.
    documentAttributes())
attrs[PDFDocumentTitleAttribute] = 'THIS IS THE TITLE'
attrs[PDFDocumentAuthorAttribute] = 'A. Author and B. Author'
pdfdoc.setDocumentAttributes_(attrs)
pdfdoc.writeToFile_('mynewfile.pdf')
Writing metadata to a pdf using pyobjc