Page 1 of 1

[Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 7:42 am
by Dellu
I am not requesting this feature for BE 12. It could be complex to implement. I just want you to think about it for future versions-- may be BE 13/14. I find the feature very useful for two reasons.

1) sharing references: BE has a nice way of sharing references and attached files via email. But, some managers like Mendeley are not capable of using the rerences data exported from BE easily. they are however fluent at extracting metadata from the PDF. Jabref/Zotero are also very great at extracting metadata. Not just for someone with reference manager, I think the embedded metadata has the potential to be a universal language for sharing files.

2) More importantly, for searching tools like Devonthink, the embedded data gives the Author, Title and the like data to the index. They can use the embedded data for better searches.


Jabref is already has this feature (http://help.jabref.org/en/XMP). Another free reference manger called [cb2bib](http://www.molspaces.com/d_cb2bib-metadata.php) is also capable of doing this.

BE can send a command via ExifTool. A free tool which has a capability to write data into pdf( and other image) files.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 9:27 am
by iandol
Ha, I was just thinking about this as I recently saw this and wondered if I could use it with Bookends:

https://github.com/mnott/pdfmeta

I don't use DevonThink, but think embedded reference metadata sounds useful. JabRef appears to use an XML based format, which seems pretty standards-based. Anyway, a +1 as something to think about for the future.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 10:55 am
by taja
second this. Would be hugely useful for working with Devonthink if batch editing of metadata could be done (without losing Skim annotations by messing with extended attributes, a problem the github page for PDFMeta notes),

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 11:37 am
by Jon
Thanks for the suggestion, something to think about.

But in response to your initial comment that other ref managers are not capable of using the reference data in an email isn't correct (or at least I don't think it is). Bookends will place the reference metadata in the email in whatever your current format is. You can set it to RIS or BibTeX and Bookends will send that via the email. All ref managers can import that.

To do this

1. Format -> Default Format -> RIS
2. Click the Email button and the selected references will be included in the email in tagged RIS (importable).

Jon
Sonny Software

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 1:32 pm
by Dellu
Bookends will place the reference metadata in the email in whatever your current format is. You can set it to RIS or BibTeX and Bookends will send that via the email.
Yes, you are right. I just always use the Bibtex format and Mendeley doesn’t seem happy with it last time I tried it. But, yah, right.

ON a related note: may be it would be nice if we have off-the wall sub-forum in here, as in Tinderbox forum. I have another suggestion for future developments. Extracting ISBN from pdf files. I just saw this plugin in Calibere. It scanes the first few pages of the PDF and extracts the ISBN from the copyright page. That would be another great progress for BE 13/4.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 3:26 pm
by Jon
I don't think we need another forum, this one isn't so busy that posts will be missed. You can send me a pdf with an ISBN in it so that if I look into this I have something to test against.

Jon
Sonny Software

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 3:39 pm
by kseggleton
Another tool for writing PDF metadata is Exiftool http://www.sno.phy.queensu.ca/~phil/exiftool/. On the DevonThink forum there is a thread http://forum.devontechnologies.com/view ... 20&t=21225 on changing the title of a PDF using Exiftool. The script could be manipulated to change the author metadata as well.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Thu Apr 20, 2017 6:21 pm
by Dellu
kseggleton wrote:Another tool for writing PDF metadata is Exiftool http://www.sno.phy.queensu.ca/~phil/exiftool/. On the DevonThink forum there is a thread http://forum.devontechnologies.com/view ... 20&t=21225 on changing the title of a PDF using Exiftool. The script could be manipulated to change the author metadata as well.
Your script is very interesting. I have mentioned Exiftool at the original post. I was using Exiftool and Shell script to get the metadata from the names of the files that BE generates and then embed into the files using Hazel. The problem with that approach is: very power intensive. Plus, the full reference data cannot be written on the file name. So, I used to get only incomplete reference embedded into the XML. Jabref does a better job.

It would be interesting to adopt your script into BE. Your script in its current state requires some manual work. We have to get the reference data into Devontink.We need to copy the data to clipboard. It would be great if you can adopt the script to BE so that selecting a reference and calling for the script, it would embed the reference to the associated PDF (we can also complement it with Keyboard Maestro to do batch processing). I think, doing reference embedding inside BE gives more sense than inside Devonthink because BE gives the reference data directly.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Fri Apr 21, 2017 7:16 pm
by kseggleton
Here is a modified script that will do what you wish - will extract the Authors name(s) and title from the selected reference in Bookends and then set the metadata of the attached PDF. Note that you need to have Exiftool installed and in addition you need to create a unique format in the Bookends format manager with only the symbol 'm' in the 'Field Order' field as pictured below.
Image

Code: Select all

-- Script to change the metadata title and authors based on selected reference in Bookends
-- Will overwrite a PDF so use at your own risk

-- Note - requires ExifTool to be installed in /usr/local/bin
-- Note - requires a Bookends format to be created called 'path' with only the symbol 'm' in the 'field order' field

-- Created by Kyle Eggleton 2017-04-22

-- Get reference details

tell application "Bookends"
	set theID to «event ToySRUID» "Selection"
	set theAuthor to «event ToySRFLD» theID given string:"authors"
	set theTitle to «event ToySRFLD» theID given string:"title"
	set theFile to «event ToySGUID» theID given «class RRTF»:"false", string:"path"
end tell

-- Unencode the URL encoded string returned from Bookends

set theUnencodedPath to do shell script "encoded_string=" & theFile & "
printf -v encoded_string \"%b\" \"${encoded_string//\\%/\\x}\"
echo $encoded_string"
set AppleScript's text item delimiters to {"file://"}
set thePath to text item 2 of theUnencodedPath

-- Set the metadata fields

do shell script "/usr/local/bin/exiftool -title=" & quoted form of theTitle & " -author=" & quoted form of theAuthor & " -overwrite_original " & quoted form of thePath

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Sat Apr 22, 2017 9:32 am
by Dellu
Thank you kseggleton.

Re: [Feature Request] Write reference data into the PDF metadata(xml)

Posted: Mon May 07, 2018 10:04 am
by Dellu
Hi kseggleton
This script suddenly stopped working for me.
Can you look at it please?

There could be a change on BE or OS to break it. I was trying to understand your script. I couldn’t get it.