In Safari it is not possible to copy text from a PDF that has been embedded via the object tag with CTRL + C. It is possible to copy it through the right-click context menu.
This behavior can be observed with an example from the MDN docs. The behavior described above does not apply to Firefox or Chrome. In these browsers it is possible to copy the text with CTRL + C.
Is this a bug/feature in Safari or am I missing something?
I've tried finding documentation or related questions to this problem but to no avail. The object tag doesn't seem to have an allow attribute, unlike the iframe tag for which one must allow clipboard access.
If this problem remains Safari specific, is there any workaround ideas that can be tried?
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Object element example</title>
</head>
<body>
<h1>Object element example</h1>
<object data="mypdf.pdf" type="application/pdf" width="800" height="1200">
<p>You don't have a PDF plugin, but you can <a href="https://mdn.github.io/learning-area/html/multimedia-and-embedding/other-embedding-technologies/mypdf.pdf">download the PDF file.</a></p>
</object>
Summary
The answer is at the end, but follow the logic.
When a PDF is inside a web page it is not actually part of the HTML carrier, it is a binary.pdf that is decompressed into a screen view and then imbedded in an inline frame < embed > (iframe) by the binary PDF viewer.
Thus the only way to copy the PDF context is via the binary viewer.
It does not matter, if it's Edge using inbuilt lighter Acrobat viewer or heavier Acrobat Reader extension or Chrome/Chromium derivatives with Skia/Foxit PDF enabler, those all work the same as here, allowing context image or text copy via control keys or mouse selection into the clipboard. It is not the browsers access.
For your example here is one in PaleMoon.
Similar in Chrome
If you attempt to browser copy the HTML with PDF you ONLY get the external browser HTML content
There is a difference when using Firefox PDF.JS enhanced browser viewer as that is NOT a binary PDF viewer, it uses a text layer over the real PDF (Much like OCR).
In fact we can have some fun dragging or editing the html around the "PDF" page as it's not the real server PDF.
Answer
I can't test Safari on Widows, however, from your description it is working perfectly, exactly the same as all of the above binary PDF viewers, The exceptions are PDF.js and Google Docs viewer etc. where an image and text substitution of a real PDF are presented in their own fashions. The real PDF is available from 2016 as the temporary file, seen in the above real PDF details.
Untested by me, however when loaded in Apple PDFKit there may be some means of access, as hinted by
var string: String? { get }https://developer.apple.com/documentation/pdfkit/pdfdocument/1436036-string