Preview shows "garbage" when selecting text

When trying to select text to for instance copy and paste it in the browser, the highlighted text is replace by gibberish. I think each letter is mapped to another but it essentially makes this function useless. It also means I can no longer search in the pdf using CTRL + F. It seems to happen for some pdfs but others not and I do not understand why it is happening

MacBook Air 15″, macOS 15.2

Posted on Jan 31, 2025 9:41 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 31, 2025 10:26 AM

If this was a scanned document that someone ran an Optical Character Recognition (OCR) process on, it put an invisible layer of text above the image text you see in the PDF.


Ordinarily, that OCR text matches what you see in the document, but if the OCR process produced gibberish (for some unknown reason), then your selection of nanometers would not be that word, but the invisible layer of gibberish on the text layer above it.


I would check with the source who produced this PDF and discover if it was scanned and how they OCR'd it. This is not a Preview issue as much as it is Preview providing you with junk from that OCR text layer. Preview is powerless to correct bad OCR content.



5 replies
Question marked as Top-ranking reply

Jan 31, 2025 10:26 AM in response to userapple1234

If this was a scanned document that someone ran an Optical Character Recognition (OCR) process on, it put an invisible layer of text above the image text you see in the PDF.


Ordinarily, that OCR text matches what you see in the document, but if the OCR process produced gibberish (for some unknown reason), then your selection of nanometers would not be that word, but the invisible layer of gibberish on the text layer above it.


I would check with the source who produced this PDF and discover if it was scanned and how they OCR'd it. This is not a Preview issue as much as it is Preview providing you with junk from that OCR text layer. Preview is powerless to correct bad OCR content.



Jan 31, 2025 12:47 PM in response to userapple1234

On Sequoia v15.3, I just generated a PDF from TeXShop v5.49 using XeLaTeX for the typesetter:


\documentclass[12pt]{article}
%% \usepackage[fontsize=13pt]{scrextend}
\usepackage[left=0.5in,top=0.5in,bottom=0.5in,bindingoffset=0.5in]{geometry}
\usepackage{kantlipsum}
\usepackage{parskip}
\usepackage{fontspec}

\setmainfont[
%:
    %% Path = /usr/local/Texlive/2023/texmf-dist/fonts/opentype/public/qualitype/,
    Path = /System/Library/Fonts/Supplemental/,
    ] {Georgia.ttf}

\begin{document}
%% paragraphs 1 thru 6
\kant[1-6]
\end{document}


Unsurprisingly, I could select a word in the text, right-click on it, and get the expected Lookup result. When I scan a one-page document on my Canon LiDE 400 using VueScan Professional v9.8.44 and have the OCR option selected, I can achieve the same functionality in Lookup while viewing the PDF in Preview.


When I choose File menu > Print… PDF > Save as PDF, the invisible OCR text is removed and a selected word presents as "" in Lookup — because that save operation strips out the invisible text that comprises the OCR content.


Only scanned documents, which are a PDF wrapper around an image of the scanned text, require OCR to place an exact registration of the invisible (searchable, selectable) text above the image text.

Jan 31, 2025 10:36 AM in response to VikingOSX

Thanks for the quick answer. I did try another software to open the pdf and it resulted in the same gibberish, confirming what you said.


I do not understand because I only recently switched to macOS and never had the issue previously on both windows and linux. The documents are also fairly recent, where the first encounter I had with this issue was a paper made in 2022. Surely then the paper was written in latex and did not need OCR?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Preview shows "garbage" when selecting text

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.