2 ms·
The PDF documents allow reliable search and copy/paste, but unfortunately only when the author of the document has taken care to ensure this. Nevertheless, this
by adrian_b 3y ago
The PDF documents allow reliable search and copy/paste, but unfortunately only when the author of the document has taken care to ensure this. Nevertheless, this usually happens automatically when the PDF has been created by exporting a document created with some Office suite, unless the author has changed the default options to forbid these features.
Even many of the PDFs created by scanning printed documents allow reasonably reliable search/copy/paste, if they had been processed by an OCR.
- lxgr 3y ago> The PDF documents allow reliable search and copy/paste Are you sure about that? As far as I understand, extracting text from an ultimately vector-graphics-like PDF heavily depends on ORC-like heuristics on the PDF consumer's side. The ToUnicode mapping table can help with the glyph-to-codepoint mapping aspect of this, but figuring out the difference between the gap between two letters and two words seems hard. I've seen bothtypesofissues mentioned in the following article i n t h e p a s t, including in a specification document I use multiple times per day for my job: https://web.archive.org/web/20220328102205/https://filingdb.com/b/pdf-text-extraction https://web.archive.org/web/20220328102205/https://filingdb....
- adrian_b 3y agoI did not look at the details of the PDF specification, but I have heard that there are indeed many cases that can confuse a PDF reader which wants to find or copy a text string. Nevertheless, I have been using very frequently every day for many years search and copy + paste from PDF documents without any problem. I usually prefer to use mupdf as the PDF reader, because it is very fast (it also works better as an EPUB reader than the other EPUB readers that I have tried), but there are some seldom-encountered PDF files that mupdf cannot parse, in which case I fall back to other PDF readers, e.g. okular. The only case that I encounter when search/copy/paste does not work is in scanned books that have not been OCR'ed, so they contain only bitmap images of the pages, without text. The problems mentioned at your link are caused mostly by the PDF specification being too permissive, which allows abuses like using a non-standard character encoding coupled with the use of a non-standard font. However, this specific type of abuse could not be prevented by any specification without using some sort of AI to decide whether the glyph used for a character encoded as Unicode "A" is really a kind of "A". Among the problems enumerated at your link, I have encountered a few times the case when there are thin spaces inserted between each letter of a string. In such a case it is annoying to remove those spaces after pasting the text in another document, but this is something that I have seen only very rarely.