Export tags to pdf keywords

I discover the - for me - new feature concerning tags management. I find it very handy. It appears that the tags created follow the openmeta standard, thus they could be shared by others applications, Leap for instance. Great. But when you are obliged to export pdf to the windows world, you lose these precious tags. Could it be possible to make a script ou a function integrated to DTP to export the tags, the name of the document in a csv file, so this could be in return imported via a program (like pdf explorer) into PDF metadata (as keywords) related to adobe xmp structure.
Many thanks.

You can enter PDF keywords (supported on all platforms) via Tools > Show Properties too.

Yes, you point a good functionnality. But I meant bulk processing, not by hand. I must admit this could be a beginning of a solution, but not satisfactory : what to do if you have many many tags already entered ? Definitely not by hand.

In another post you almost did the trick, but in the reverse way :
In the script below, you convert keywords to tags, but my problem concerns the tags to keywords conversion. No far from it, you catch the idea ?

– Convert keywords to tags
– Created by Christian Grunenberg on Wed Mar 03 2010.
– Copyright © 2010. All rights reserved.

tell application id “com.devon-technologies.thinkpro2”
try
set these_items to the selection
if these_items is {} then error “No selection.”

  repeat with this_item in these_items
     try
        set theMD to meta data of this_item
        set theKeywords to |kMDItemKeywords| of theMD
        if (exists theKeywords) and (theKeywords is not "") then
           set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ","}
           set theTags to text items of theKeywords
           set AppleScript's text item delimiters to od
           set theTags to (parents of this_item) & theTags
           set the tags of this_item to theTags
        end if
     end try
  end repeat

on error error_message number error_number
if the error_number is not -128 then display alert “DEVONthink Pro” message error_message as warning

end try
end tell

Metadata is read-only at the moment in DTPO, so you can’t write keywords to a PDF, AFAIK.

You’d have to do/script that part outside of DTPO, which is certainly possible.

C

Sorry, but I disagree with you. You can write tags at the bottom of your documents in DTPO. And you can also write ou update through the Tools/Show properties menu keywords straight away to a pdf/xmp/metadata.

The script i stated above works perfectly, provided you are updating from metadata/pdf/keywords to metadata/openmeta/tags as far as the openmeta tags are concerned. But, to a certain extend, i am unable to make it work the reverse way, from tags to keywords. Probably a vocabulary question, the applescript language suffers from a poor documentation, related to these matters.

But the pdf keywords are indeed a KEY factor for playing with and organizing pdf on both platforms, not only from the interoperabilty point of view but also for the sake of keeping the information consistent. Even with unix world (look at xpdf/pdfinfo tools).

Francis

That’s what cturner meant, the AppleScript meta data property is read-only and therefore it doesn’t work the other way.

OK, I understand.

The only way I see to do it straightforward (as a matter of facts…) is :
1- To record some keywords related to the document via the Tools/Show properties in pdf/keywords, done by hand
2- To launch the script (very very good masterpiece indeed) to update DTPO Tags from pdf/keywords (which works !).
3. Data tags+keywords are consistent, then, except the tags created automatically by the ‘smart folder’ function (tags coming from the nested folders), working in DTPO.

I should have prefered the other way round. It is a pity, both unix and windows worlds know only pdf keywords, ‘normalized’ by adobe.

Another way could consist in an export to a csv file, which could be in turn imported into pdf/xmp keywords.

Yep 1 from ironic software did also the trick via a function menu (‘Write metadata on pdf’), but it has disappeared since the last release (yep 2); people from ironic staff said, due to constraints from openmeta, it could not be done - the same position as yours (i.e. from openmeta tags to pdf/keywords). We have to wait for a tool from the openmeta organization. This is a strong request from users of ironic software, no doubt it should succeed one day.

Francis

There’s an Automator function that writes metadata, but it wants to rewrite the entire file. :frowning:

Also Python has the following library: http://code.google.com/p/python-xmp-toolkit/,
so you could grab the tags fro DTPO via py-appscript and write them with this.

I imagine there’s something similar for Ruby.

HTH, Charles

Many many thanks for the support, I should take a look at this stuff (but I am a bit afraid, being not an expert in python langage).

Anyway, wish the best for all to manage their tags !

Francis