Preview refuses to open pdf file, incorrectly claiming a permission issue

I had to force-quit Preview (it became unresponsive after trying to open a 200Mb animated gif), but after re-starting it, some files that were open before no longer open. Instead an error box pops up saying that

The file “file.pdf” couldn’t be opened because you don’t have permission to view it.

and

To view or change permissions, select the item in the Finder and choose File > Get Info.

(how can I generate an image of that error box?).

However, the file permissions are okay, finder generated the usual preview, and acroread can open the file. I suspect that Preview has generated some lock for this file somewhere, but I'm not sure where and how. OSX 10.9.5. (copying the file in a terminal to another one and trying to open that didn't help, as did changing permissions to read-write for everyone).


Solution 1:

quitting preview was enough to fix it for me.

Solution 2:

After searching on the net I found a solution, following mainly this suggestion, though only deleting a small sub-directory:

  1. I removed the sub-directory ~/Library/Containers/com.apple.Preview/Data/Library/Saved Application State/com.apple.Preview.savedState

  2. I quit Preview and re-started it.

PS: In recent versions of macOS the save state is kept in ~/Library/Saved\ Application\ State/com.apple.Preview.savedState.