These are PDF metadata, I’d say. And since the script doesn’t do anything with them, these keywords are probably already contained in your original PDF.
For that, you’d have to read the PDF metadata field “Keywords”. That is possible using Apple’s PDFKit
framework: You have to read the PDF into a PDFDocument
object, get the documentAttributes
dictionary and retrieve the value of the PDFDocumentKeywordsAttribute
key from it. That should give you an NSArray
with the “keywords” as NSString
s. In this case, every keyword is a key-value pair. Looks terrible to me, but at least it’s a lot easier to retrieve than XML data or whatever else people put in their PDFs nowadays.
As I said: It’s possible. But I’m not going to write that script. I suggest searching in the forum for PDFDocument
, that might return some posts with sample code.