If you are talking about EXIF metadata, you can look at exiv2 , which is a C ++ library for processing EXIF metadata. There is a second lib called libexif and is written in C.
Exiv2 has examples on its website, and the API is well documented.
UPDATE: if you want to add your own metadata, you can use the MakerNoteor tag Comment.
Exif Standard: PDF . 4.6.5. EXIF IFD 7, , .
MakerNote Type Undefined Count Any
Comment Type Undefined Count Any
, 2 , .