View Single Post
Old 01-04-2014, 09:55 PM   #1
piovac
Member
piovac began at the beginning.
 
piovac's Avatar
 
Posts: 14
Karma: 10
Join Date: Jan 2014
Device: Kindle Paperwhite, Samsung Note 4, Samsung Tab S, MacBook Pro
Lightbulb Annotating PDFs in OS X w/o modifying the file

I came out with a nice method to read and annotate PDF books in OS X without modifying the original files. The problem is that the default Preview.app saves all the annotation in the original files, which has the advantage to be portable to other PDF application, but has the disadvantage of continuously modifying the original PDF file.

A nice a alternative is to use Skim (http://skim-app.sourceforge.net/). I used it for years while working as papers reviewer and it really work nicely. By default Skim saves the annotation in the file extended attributes of HFS+. Alternatively, one can save files and notes in PDF Bundle (actually a folder), containing both the original PDF file and a file with the annotations. In any case, the original PDF file is untouched. Of course the application has features to embed and the embed the annotation in the PDF file in case you want to pass them to another PDF application, and the possibility to export the annotations in a separate file.

Using the default method (HFS+ extended attributes) is not convenient because the attributes get generally lost when the file is emailed, backed-up, etc. Moreover the import into Calibre strips the attributes away. For general use the creation of a PDF Bundle is my preferred. The problem is that the Calibre do not handle file formats that are actually folders and not real files.

The method that I came out with the better suit the use in Calibre is to use the external annotation file and (semi)-automate the process to import and and save the annotations. Here is the step-by-step process.

Step 1 - Install the Skim app if you do not already have it.

Step 2 - Associate the PDF files to the Skim. This is the only way to make it work with Calibre as it uses the default application provide by the system.

Step 3 - You can now read and annotate your files in calibre with Skim. When done, export the annotations in a .skim file: File->Export... and choose the Skim format, but do not modify the filename. This will save the .skim annotation in the same folder of the PDF file in the Calibre Library. Very important: DO NOT save the PDF files when you exit the program.

Step 4 - Next time you reopen the file Skim will ask you if you want to load the notes from the .skim file. You of course would say yes. And you can repeat step 3 when done.

Step 5 - The first automation task would be to load the annotations from the .skim file automatically without asking any question. This can be easily achieved using an hidden default option of Skim. To automate the loading operation by default, just open a terminal and type the following command:

defaults write -app Skim SKReadMissingNotesFromSkimFileOption -integer 1.

Step 6 - The export of the notes on a file and the closing of the PDF without saving is a very cumbersome operation with a lot of menu selections and click. But this can be easily automated with an Apple Automator service written in AppleScript and Assigned to a keystroke combination.
6.1- Open Automator and start a new service named "Save Skim Notes and Close.workflow"
6.2- On top of the windows select "Service receives [no input] in [Skim.app]"
6.3- For the action choose "Run AppleScript" and load the content of the script as follow then save it and the service is ready to use:

on run {input, parameters}
(* Your script goes here *)
try
tell application "Skim"
set filepath to path of front document
end tell
set filepath to POSIX file file path
set filepath to Unicode text 1 thru -5 of (filepath as Unicode text) & ".skim"
tell application "Skim"
save document 1 in filepath as "Skim Notes"
end tell
tell application "Skim"
close document 1 without saving
end tell
display alert "Skim notes saved on .skim file." giving up after 2
on error
display dialog "Could not save Skim notes!"
end try
return input
end run

6.4- Now you can assign a keystroke combination to the service (it will be under the "General" category). I chose Ctrl-Shift-Cmd-S as it is not used by any other Skip command.

6.5.- Ready to go. When Skim is open and you finish the annotation just press your keystroke or from the menu "Skim->Services->Save Skim Notes and Close" and the service saves the annotations file and closes the PDF without saving it.

Enjoy!

PS. Here are some links for Skim, Automator, etc. :
http://sourceforge.net/apps/mediawik...en_Preferences
http://sourceforge.net/apps/mediawik...le=AppleScript
http://veritrope.com/tech/the-basics...-applescripts/
piovac is offline   Reply With Quote