News for hackers. Stuff that matters.
Re:Preview in macOS Big Sur is destroying PDFs by refulgentis on Wednesday December 16, 2020 @03:45PM (#25448344)
In my very humble opinion, it's accurate: "Saving a PDF with Preview in Big Sur [Preview in Big Sur] can corrupt OCR text added by a third-party program [is irreversibly destroying PDFs]"

I understand the (fairly common, in these comments) viewpoint that this is the fault of the "third-party program", but since the PDF is readable up until Preview touches it...I find it hard to come around to the viewpoint the third-party program is relevant. Readable bytes -> Preview -> unreadable bytes is my mental model so far.

Edit: absolutely unacceptable this is downvoted to -4. I've observed for a couple months that participation in Apple-related threads, outside indignation that Apple was involved in the discussion at all, gets down to -5 before getting back to -1 a day or two later. No matter what tone is used, this happens, and it makes the problem even worse in the long run. Been here 10 years, always been a _slight_ problem, but over the last year, it's virtually impossible to participate without continuing to slowly destroy my 11 year old account. Not sure how much longer I can keep trying.

Re:Preview in macOS Big Sur is destroying PDFs by birdyrooster on Wednesday December 16, 2020 @03:47PM (#25448394)
Preview isn’t breaking files by reading them, as I understand it, people are saving files with Preview and over-writing their ABBY compatible pdf. Just because the last four bytes of a file name is “.pdf” doesn’t mean anything that opens files with that suffix will work.

PDF is not a bitmap, it’s a script like HTML or JS.

People understand browser incompatibility but some how this is unconscionable.

Re:Preview in macOS Big Sur is destroying PDFs by refulgentis on Wednesday December 16, 2020 @03:50PM (#25448436)
I see, the chain isn't as simple as bytes -> Preview -> unreadable bytes: rather, bytes -> Preview, edit -> unreadable bytes. Is that accurate?
Re:Preview in macOS Big Sur is destroying PDFs by fastball on Wednesday December 16, 2020 @03:57PM (#25448530)
No, the bytes are still readable by Preview, it's just the OCR meta that is apparently no longer copy-pastable.

No reason why you can't just run this through ABBYY FineReader again and get the exact same OCR you got the first time, so I think "irreversible" is definitely a stretch.

Re:Preview in macOS Big Sur is destroying PDFs by birdyrooster on Wednesday December 16, 2020 @03:54PM (#25448490)
Yep they are flushing new bits to disk when preview is instructed to save.
Re:Preview in macOS Big Sur is destroying PDFs by dkonofalski on Wednesday December 16, 2020 @08:00PM (#25451005)
Maybe this can give you some insight. I downvoted your comment simply because it didn't add anything to the discussion and you made an assumption that has several faults in it.

For one, your "mental model" is off because you assume that the first part of "readable bytes" is accurate. Without actually seeing the PDF in question, you don't know if the "readable bytes" are actually corrupted and Preview is fixing them to make them readable. That would mean that Preview is actually correct in its behavior and the source document is what's flawed.

On the tail end of your mental model, then, is another assumption which is that this results in "unreadable bytes" but that's not accurate either. The PDF that results from a save in Preview may be accurate to the PDF specification and is perfectly readable as a PDF in any PDF application/reader. What's no longer readable is the extra content that was originally in the file that may not have been saved correctly, in-spec, or may have been corrupt to begin with.

A big hint as to what's going on here, now that I've had some time to review this, is that the "corruption" happens consistently - the letter "a" is always replaced by the same "corrupted" character, the letter "b" seems to be consistently replaced with the same character, etc. That points, in my opinion, to a lookup that's no longer correct. What side of that lookup is bad is hard to say without seeing the file in question.

Re:Preview in macOS Big Sur is destroying PDFs by vzqx on Wednesday December 16, 2020 @05:29PM (#25449673)
The title is technically accurate, but it's misleading to non-mac users like myself. I assumed the author was using functionality called "Preview" only to view the documents, rather than save them.

There's a big difference between "read-only operation is mangling files" vs. "PDF writer is buggy".

Re:Preview in macOS Big Sur is destroying PDFs by JxLS-cpgbe0 on Thursday December 17, 2020 @12:58PM (#25458161)
> Not sure how much longer I can keep trying

Keep trying, just with a new account every few months are so. HN has no privacy controls, we must add our own.