Live data from Hacker News

Preview in macOS Big Sur is destroying PDFs

annoying.technology

161–170 of 326 posts

Re: Preview in macOS Big Sur is destroying PDFs

#161

I work with a ton of PDF's between my Mac and iPad, and it mostly works but there are still just way too many bugs. It's a lot of little things, like in Catalina where opening up the sidebar for annotations (comments) seemingly randomized their order. (Big Sur, fortunately, fixed it to be page-order again.) Or how printing a PDF from a website (in Catalina, also seemingly fixed in Big Sur) would look right on the pag…

> 10% of the glyphs were scrambled ("lik3 thZs"), like some sort of character table corruption. As I understand it, that's a form copy protection trying to prevent exactly what you're doing.

More likely it’s the effect of font subsetting.

If you want your PDF to render the same everywhere, you have to embed font information (even if that font is something like Arial, which is available almost everywhere, as ‘almost everywhere’ isn’t ‘everywhere’, and because there are zillions of variations on Arial)

You don’t want to embed entire fonts, though, certainly not if a PDF uses only a few characters of a font.

The memory wise cheapest way of embedding a font leaves out the table that maps glyph numbers back to Unicode code points. If you do that, the PDF reader guesses a 1:1 mapping to ascii/Unicode.

Subletting means you can’t extract all glyphs in a font from a single file, but AFAIK, that’s just a side effect.

I guess this bug drops such a table, or messes up that translation table.

Re: Preview in macOS Big Sur is destroying PDFs

#162
post #65

Earlier quoted context omitted.

“The idea that this behavior in a PDF reader can be excused because the software that generated the PDF was not approved for the operating system the viewer is running on per the vendor.” Nobody is saying that. The suggestion is that the software that generates the PDF produces corrupt documents. The fact that the vendor of that software doesn’t approve it for Big Sur suggests that they might be aware that there are…

I worded it that way for two reasons, one of which is admittedly speculative: 1) It seems highly unlikely that ABBYY relies on some changed OS behavior in generating PDFs that leads to it producing PDFs that are malformed in such a way that is only revealed when they are rewritten by Preview. Behavior in Preview is by far a more likely cause of the problem. Generally the thing that changed is what broke... 2) To the…

>The PDF opens properly the first time, so de facto it is "valid" as determined by the product that later corrupts it.

While I agree with your main point that, to the user, this looks like a problem with Preview, I think it's actually because Preview is doing something beneficial to open the file which is to ignore "bogus" data. Preview, from what I can tell, ignores additional data that it doesn't expect specifically to allow for opening PDF files where the document data is fine but the metadata is corrupted. The fact that it opens it means nothing since the file would not be able to be opened at all otherwise and Preview is actually doing the user a favor by salvaging it. Once Preview "fixes" it, though, it looks like the OCR pointer is still there but the metadata that contains the plain-text content is not so it's pointing to binary document data instead. Another option is that Preview has "fixed" a font and the mapping is no longer correct which, while I can't really see the text in the image, would be obvious as you'd see words that map to the same corruptions. In either case, Preview's behavior is "correct" and the fact that it was less strict before does not mean that it's now broken - the source PDF is still what was "broken".

Re: Preview in macOS Big Sur is destroying PDFs

#163
post #21

Why anyone treats PDF as anything but a write-once format is beyond me. It's so finicky that I'm not shocked bugs like this happen. The only programs I'd be reasonable sure wouldn't screw it up are Acrobat itself, and pdflatex and friends. I think we need a multi-image container format. It could be something that's literally a bunch of jpgs/pngs/pick your poison in a tar container, and given a new extension. OSes wou…

PDF is one of the best things IMO - it's like a docker container for documents. The way the original authors intended it to be, including fonts and all the things that go into making a document. For example, I personally like to purchase books that are in PDF format, not epub/mobi. I want to rely on professional typesetting from the publishers, not some front-end engineer's vision of what the ebook should look like a…

> absolutely DO NOT WANT - is web page like format with auto-flowing text

I would love it, though, if PDF included this as something that's always entirely optional.

Sometimes I want to read something just as formatted. If my display is big enough, and the formatting has any importance, I probably want that.

Other times, my screen is smaller (phone) or the wrong shape (small laptop), and I'd rather the text confirm to the device rather than vice versa.

Also, sometimes I use my arrow keys to scroll as I read to keep my place (like a line-oriented instead of page-oriented bookmark). So just because the device is capable of it, I don't necessarily always want page-oriented original formatting because it might have two-column text to deal with or top/bottom margins that serve no purpose for me.

Re: Preview in macOS Big Sur is destroying PDFs

#164

Earlier quoted context omitted.

PDF is one of the best things IMO - it's like a docker container for documents. The way the original authors intended it to be, including fonts and all the things that go into making a document. For example, I personally like to purchase books that are in PDF format, not epub/mobi. I want to rely on professional typesetting from the publishers, not some front-end engineer's vision of what the ebook should look like a…

What device do you use to read PDF's?

iPad Pro, 10”.

Re: Preview in macOS Big Sur is destroying PDFs

#165
post #21

Why anyone treats PDF as anything but a write-once format is beyond me. It's so finicky that I'm not shocked bugs like this happen. The only programs I'd be reasonable sure wouldn't screw it up are Acrobat itself, and pdflatex and friends. I think we need a multi-image container format. It could be something that's literally a bunch of jpgs/pngs/pick your poison in a tar container, and given a new extension. OSes wou…

We have that container format. It is called: TIFF

Re: Preview in macOS Big Sur is destroying PDFs

#166

From what I can tell, there is no reason you can't just run the PDF through ABBYY FineReader again and get the exact same OCR you got the first time, so I think "irreversible" is a bit over-the-top. Is it as easy as CMD+Z? No. Is it data you can never get back? Also no.

In theory that is probably true – in my actual scenario I can't run them through ABBYY again because of the limitations of the bundled version. It only accepts PDFs coming from the scanner software, so running these through ABBYY again would give me an error message. I'd have to buy the full version to be able to try out that workaround.

Re: Preview in macOS Big Sur is destroying PDFs

#167

Earlier quoted context omitted.

There are many other formats, a myriad of text formats from asciidocs to markdown. For embedded devices and such, they work great I presume. Please don't mess with PDFs. 20+ year old technology that is shitty but works, I prefer keeping the status-quo.

If PDF had an "accident", and someone was able to do to it what Steve Jobs did to Flash, I would be very happy.

You mean setting back the Web 10 years behind, with WebAssembly still not exposing everything that Flash + CrossBridge were capable of, and all the Web tools that try to replicate Flash IDE still don't come close to it in HTML5?

Nah, better leave PDF as it is, we don't need any accident.

Re: Preview in macOS Big Sur is destroying PDFs

#168

Earlier quoted context omitted.

PDF is one of the best things IMO - it's like a docker container for documents. The way the original authors intended it to be, including fonts and all the things that go into making a document. For example, I personally like to purchase books that are in PDF format, not epub/mobi. I want to rely on professional typesetting from the publishers, not some front-end engineer's vision of what the ebook should look like a…

> absolutely DO NOT WANT - is web page like format with auto-flowing text I would love it, though, if PDF included this as something that's always entirely optional. Sometimes I want to read something just as formatted. If my display is big enough, and the formatting has any importance, I probably want that. Other times, my screen is smaller (phone) or the wrong shape (small laptop), and I'd rather the text confirm t…

> I would love it, though, if PDF included this as something that's always entirely optional.

To be fair that’s what they are working on, with Liquid Mode for PDFs in Adobe Reader. The plan is that it will automatically work for all PDFs using some sort of AI magic.

Re: Preview in macOS Big Sur is destroying PDFs

#169

Earlier quoted context omitted.

If PDF had an "accident", and someone was able to do to it what Steve Jobs did to Flash, I would be very happy.

Are there any other "fixed" or "docker-like" formats for documents besides PDFs that solves a lot of problems with PDF format? From what I understand, PDF is an xml based document standard.

Nope, PDF doesn't have anything to do with XML.

Re: Preview in macOS Big Sur is destroying PDFs

#170
post #70

Earlier quoted context omitted.

You’re a victim of ABBYY’s poor PDF generation, that’s what. Nothing excuses ABBYY if their PDFs are corrupt.

Wow, just wow. The PDF works fine before saving in Preview. As in, Preview itself will render the file perfectly fine with OCR. By all accounts, the PDF is completely valid and uncorrupted at this point. Making a change to the file and saving it in Preview is what causes the corruption. So how the hell could you possibly excuse Preview and call this a ABBYY issue when Preview is the one that causes the issue ? That's…

>The PDF works fine before saving in Preview.

I think the disagreement here is that there's no evidence of this. Preview's error handling could very well be interpreting bad data and allowing the file to be opened. The question becomes, then, should Preview continue to propagate that bad data on save or should it try to correct it with the possibility that it corrupts just that data. If the PDF was not in-spec prior to Preview touching it but it is in-spec after Preview saves it, is it a good thing that Preview "fixed" the PDF file and made it "proper" or is it bad because it technically lost/corrupted data?

In other words, what is the "right" thing for a software to do in this case? Keep bad data and leave the file as "bad" or fix the issue to make a valid PDF and, as a side effect, remove the "bad" data?

Post reply on HN