Turning iPad PDF annotations into anonymous reviews

Update: Updated script to 1.1 (2012-15-10)

As a researcher, I frequently peer review the papers of other researchers.  The standard way to do this is to print out the paper, make handwritten notes on it, and then convert it all into a written, anonymous review text that gets sent to the committee and the authors.  Recently, I have started reading papers on my iPad – it's more colorful, more interactive, and more portable.  Using GoodReader, I can annotate the papers, too.  But how do I get these annotations into a text that I can send as a review?

Let me show where the problem is.  In the paper to review, I highlight a passage:
In fact, building large applications takes minutes to hours. This is unacceptable.
and add a note "An incremental rebuild would be much faster. Please discuss." to the highlighted passage. (In GoodReader, you get this by tapping on the highlighted text and selecting "Open").  In a PDF viewer, this nicely translates into a highlighted section with a note.  For my students, this is fine.  My anonymous review, however, is supposed to come in text.  I can use GoodReader to turn the annotations into text:

Highlight, 12.04.2012 09:52, Andreas Zeller:
But an incremental rebuild would be much faster. Please discuss.
The problem is obvious: it lacks context (where exactly is the problem?), and won't be helpful for the author.  So I wrote a script for my Mac with which my annotations read like this:

Page 2 "building large applications takes minutes to hours": But an incremental rebuild would be much faster. Please discuss.
This way, the author knows precisely where the issue is; and I can nicely combine markup and comments in one single step.

The script leverages the free Skim PDF viewer and converts the annotations into the form above.  Paste it into AppleScript Editor and run it while Skim shows the annotated PDF; the extracted summary will show up in a TextEdit window.  Enjoy!

-- This script supports anonymous reviews of documents (e.g., submitted scientific papers) via PDF annotations.  It takes an annotated PDF (opened in the Skim PDF viewer) and produces a list of annotations in a form that is easy to edit; this list is copied to the clipboard and also opened in TextEdit. My typical workflow with this script is as follows.
-- 1. I have the PDFs to be annotated in DropBox.
-- 2. I annotate them on my iPad using GoodReader (other programs creating standard PDF annotations should work just as well).  I use the following markups:
--     * UNDERLINE means something straightforward to fix (e.g. typos)
--     * STRIKEOUT means something to delete
--     * HIGHLIGHT means something to comment upon
-- 3. I add NOTES to these annotations (especially the highlights) to comment on text-specific issues.
-- 4. I also add non-anchored notes for general comments not related to a speficic piece of text; this is where the summary and the general assessment goes.
-- 5. After editing, I again sync with DropBox and open the PDF in Skim on my Mac.  Then I run this script, and get the summary in my preferred format in a TextEdit window.
-- 6. I edit the script where needed, and integrate it into the official review form.
-- One can easily extend this script to differentiate more kinds of notes or attributes.

-- Enjoy!
-- Andreas Zeller <zeller@cs.uni-saarland.de>, 2012-10-15

-- Revision Notes
-- 2012-04-15: Revision 1.0
-- Initial Release

-- 2012-10-15: Revision 1.1
-- Adapted for Skim 1.3.22 (extended notes)
-- New: ignore highlight notes without associated text

tell application "Skim"
set res to ""
-- All of this only works with Skim notes, so we convert first
set documentName to name of document 1
set closeAtExit to 0
on error
open (choose file with prompt "Select annotated PDF file")
-- display dialog "Please open the annotated PDF in Skim." buttons {"Quit"}
-- error number -128
set closeAtExit to 1
end try
set documentName to name of document 1
set documentFile to file of document 1
if modified of document 1 then
save document 1
end if
convert notes (document 1)
set res to res & "== " & name of document 1 & "  =="
set pageNotes to notes of document 1
repeat with currentNote in pageNotes
-- display dialog type of currentNote as string
set notePage to the index of the page of currentNote
set noteType to the type of currentNote
set textForNote to return & "Page " & notePage
set skipNote to 0
-- add anchor if present
set noteSelection to the selection of currentNote as text
on error
set noteSelection to "(SELECTION)"
end try
set s to noteSelection
if s is not "missing value" then
-- remove newlines
set s to my replace_chars(s, return, " ")
set s to my replace_chars(s, ASCII character 10, " ")
-- remove hyphens
set s to my replace_chars(s, "- ", "")
-- trim text
repeat until s does not start with " "
set s to text 2 thru -1 of s
end repeat
repeat until s does not end with " "
set s to text 1 thru -2 of s
end repeat
set textForNote to textForNote & " \"" & s & "\""
end if
set textForNote to textForNote & ":"
-- add note type
set t to the type of currentNote as text
if t is "strike out note" then
set t to " please delete."
else if t is "underline note" then
set t to " please fix."
else if t is "highlight note" then
set t to ""
set skipNote to 1 -- ignore highlights unless with text
else if t is "anchored note" or t is "text note" then
set t to ""
end if
set textForNote to textForNote & t
-- add note text if relevant
if text of currentNote is not noteSelection then
set textForNote to textForNote & " "
if t is not "" then
set textForNote to textForNote & "("
end if
set textForNote to textForNote & text of currentNote
if extended text of currentNote as text is not "missing value" then
set textForNote to textForNote & "  " & extended text of currentNote
end if
if t is not "" then
set textForNote to textForNote & ")"
end if
set skipNote to 0
end if
if skipNote is 0 then
set res to res & textForNote & return
end if
end repeat
-- Copy result to clipboard
set the clipboard to res
-- Go back to original file
revert document 1
if closeAtExit is 1 then
close document 1
end if
-- display dialog ("You can now paste this text from the clipboard into your review form:" & res)
end tell

-- Now open TextEdit with the summary
tell application "TextEdit"
make new document
set n to documentName & " - Annotation Summary.txt"
tell front document
set its text to (the clipboard)
set its name to n
end tell
-- save document 1 in ((documentFile as text) & " - Annotation Summary.txt")
end tell

-- Yes, this is how to replace characters with AppleScript.  No comment.
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars


  1. Thanks, this is neat!

    GoodReader has an option in the settings (under Viewing PDF Files) which allows you to set the "Author Name" for annotations. I've found that changing didn't change existing annotations, though, even if I re-flattened the file.

  2. Very useful.

    I suggest to also take a look at "PDF Highlighter" at the App Store. This iPad app supports an export format ("Send Annotation Summaries: Plain Text") for your annotations that already comes very close to the textual format that you would want to send as a review (actually, I suggested this academic use case to the app's author and he promptly agreed to support it — thanks again!).

    [ I pipe PDF Highlighter's output through a tiny post-processing script that turns the text into a review document that cannot be told from the variants I'd produce manually. Hooray for paper-less reviews. ]


  3. There is a really simple yet robust tool for extracting highlights and notes from your pdf-files available at: http://www.sumnotes.net . Not only it supports various advanced features like selective extraction or predictive extraction, but it also allows you to save extracted highlights into TXT or DOC files. All desktop browsers and operating systems are supported. We are in cloud, so no installation is needed. And yes, it is for free. Try it out.