Tagging annotated PDF

Very occasionally I update a PDF in EagleFiler from its original source, say a web page. This caused me to lose some annotations I had made.

I’d like to see if a PDF has annotations without opening it in Preview and switching the sidebar.

A script that has to be run manually would be fine. Does anybody know how to check for annotations?

Just to be clear, you’re talking about PDF annotations, not EagleFiler annotations, right? My guess is that this could be done by scripting PDFpen.

Yes

My guess is that this could be done by scripting PDFpen.

No

Automator comes with an “Extract Annotations” action. I’ll report back.

You can open the file in Skim and use File:Convert Notes to “embed” the Preview notes.

Scripts to convert (aka “embed”) and “unembed” notes from multiple files are included in these Skim file management scripts.

Skim understands AppleEvents, but that seems like a rather roundabout way to do it and would still need to open a window to check each file.

(unless I permanently convert to Skim, but I don’t really see the point of that application now that Preview can do annotations)

Sorry, I should have provided this instead:

Skim has tools that let you do all this – without opening the files – in shell.

After unembedding (either with the Applescript above or the attached shell script, using the “unembed” option), you can use the below to find all the annotated pdfs. (It searches recursively on a directory.)

#!/bin/bash
if -d “$1” ]; then
find “$1” -type f -name “*.pdf” -exec “$0” “{}” “;”
elif ! -z xattr "$1" | grep net_sourceforge_skim-app_notes ]; then
echo “$1”
fi

skimalot.sh.zip (3.15 KB)