Macro to extract annotations from a PDF

Hello,
I should preface my question by asking whether PDF annotations are generic or app specific, or both. I think the answer is both because some Adobe acrobat annotations are I think not visible in other apps.
Is it possible to create a macro to extract annotations from a PDF and copy them to the clipboard?
This function exists in PDF apps, but require too much clicking.
thanks very much in advance for your time and help

Both, I would say, too.

From Acrobat for example you can export the annotation data as .fdf (let’s call this “generic”, since it’s some kind of a standard).

Skim can also save the annotations in a separate file, which is a Skim-specific format. (However you can export them as .fdf, too.)

In Skim you can convert Acrobat annotations to Skim-readable annotations. (File > Convert Notes…)

Probably yes, via AppleScript. Have a closer look at Acrobat’s AppleScript dictionary. But if you’re asking to do that without involving any PDF app, I don’t think it is easily possible. You would need to have knowledge of the exact structure of the PDF document, including the possible PDF versions (1.4, 1.5, etc.). Furthermore the content and the annotations are most likely compressed, depending on the PDF creation settings.

1 Like

thank you Tom.
I had the idea after reading the ‘extract annotations’ with Automator paragraph of the following article:

The Automator action probably uses the System’s PDF engine (Quartz). It seems to be possible to use the quartzfilter with AppleScriptObjC. But I’m not familiar with that, and in general I don’t have too much faith in Apple’s PDF stuff (except for quickly displaying simple PDFs in Preview).

A thing to keep in mind is the compatibility of Apple’s PDF Engine. I think it uses PDF 1.4 (or 1.5?) while the current PDF version is PDF 1.7. Perhaps, concerning annotations, there has nothing changed between 1.5 and 1.7. Not sure, just to mention it.

Have you tried using Automator, but use a "Copy to Clipboard" action?

Hi there! I have a similar question but specifically:

  • I’m using Skim and can export my annotations as skimnotes. What I’d like to be able to do is parse this single file of annotaitons into separate files, one file for each annotation, that contains the reference of the PDF so that I can send it to Devonthink Pro.

I’m new to Keyboard Maestro and this parsing business is a bit beyond my current skills. I was wondering if anyone could suggest a way to do this. Thanks for your help.

Hey @melhopkop,

Post a sample PDF with annotations, so we have something to test with.

-Chris

Hi Chris (@ccstone),

I just tried to but it looks like PDF’s (and Skim notes) are not supported file types for uploading to this forum so I’ve uploaded them to Dropbox:

Let me know if that works or if I should try something else. Thanks for your help!

All you have to do is zip them. The forum supports Keyboard Maestro specific files and .zip files.

But Dropbox works...

The exported .skim file is XML, and that isn't always fun to deal with – but it can be done.

I'll look at this more thoroughly in a bit.

-Chris

In case it helps, from File > Export… you can save the annotations also as plain text:

Hey Tom,

Heck, yes!

Notes exported as text are a walk in the park to parse.

Thanks.

-Chris

Thanks, Tom. That does help but as a newbie I still don’t know how to create a macro to parse that text. Apologies if this is explained elsewhere, I couldn’t find it. Would you be able to show me the steps to have the macro go through each paragraph making a note?

Thank you.

Hi,

the info was meant for Chris. I think he is working on a solution for you; so, just give him a bit of time and everything will be OK :slightly_smiling_face: