Preview: PDF annotations disappearing
As many others have, I've found that after making some notes or highlights on a pdf in Preview (and even after saving by hand), closing the pdf and reopening it will result in some (but not all) of the annotations having simply vanished.
What's interesting is that the annotations are still present in the file, they apparently just haven't been saved in a way in which Preview or any other pdf viewer can show. (The annotations still don't appear when opening the file with Acrobat, Chrome, etc.)
If I open the file with TextEdit, and search (Command+F) for "/Subtype /Text", for example, I can find my apparently "deleted" notes.
(For anyone else trying to recover their notes, sometimes the text of the notes appears with the string "\000" between every character, so that it appears like this: "\000l\000i\000k\000e\000 \000t\000h\000i\000s". After copying it into another document, simply find and replace "\000" with nothing ("") to recover the original text—though you may find that some other characters, such as single quotes, are still encoded this way, as "\031", for example. This phenomenon appears unrelated to whether the notes are viewable, though.)
What's going on here? Is there any way to "repair" a PDF that isn't showing these objects?
(I'm running macOS Catalina 10.15.5.)
By the way, I noticed that one of the distinguishing features the "surviving" notes had was that their object ids (e.g. 1470 in "1470 0 obj") were all referenced near the very end of the file, whereas at least most of the other ones appeared not to be. Two out of the three objects were actually duplicated near the very end of the file, whereas the other one was only referenced by object id there.