Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a few PDFs that contain ligatures in the text (e.g., ff is combined into a single character, ).

Is there an easy way to remove them when copying the text from the PDF? (i.e., when I paste, I'd like the to be pasted as ff).

I copy a lot of text from these PDFs into answers on Stack Overflow and I find the ligatures at best obnoxious (ok, I admit, I'm really picky :-P); the ligatures also do not show up correctly when copied into other places (e.g., if I copy them into Notepad, they show up as blocks).

I cannot modify the PDFs.

I use both Adobe Acrobat Reader and Foxit Reader, but I'd be open to trying a new PDF reader.

share|improve this question

The reader evince seems to decode ligatures when I tested this.

Btw. for pdflatex documents you can use this in the preamble to display ligatures in the PDF document but copy individual characters:

\pdfgentounicode=1 %
share|improve this answer
Works for me, thank you for the hint. – gentlesea Feb 29 '12 at 10:27

One possibility would be to use your favorite text-editor and simply replace them.

Another way would be to write a script which utilizes sed...but that would be *NIX-Systems only, I fear.

share|improve this answer
GnuWin32 and you have sed on windows. – mbq Jul 18 '10 at 21:18
@mbq: It's also included in that? very good. Thx. – Bobby Jul 18 '10 at 21:26

In python this would be:

import unicodedata
# \uFB00 is the ff ligature.

You could combine this with pyPdf to read the pdf files.

share|improve this answer

I answered a similar question in more depth - Why does the text `fi` get cut when I copy from a PDF or print a document?

You can replace the "broken" words in the copied text if you have a mapping from broken words to original words. I wrote a script to generate this mapping by removing ligatures from words and checking whether the resulting word is unique. For my dictionary of English words, 99.5% of all possible broken words are replaceable, and 92.3% of words that contain a ligature sequence (ff, fi, fl, ffi, or ffl) can be recovered. The difference between these two percentages is due to the surprisingly large number of legitimate words that are created by removing ligaments from other legitimate words (like butterfly --> buttery, fluffs --> us, and misfits --> mists).

Here's a CSV of guaranteed-replaceable "broken" words (and the words they used to be):

share|improve this answer
It's great that you're offering the file. Realistically, though, nobody with common sense would download an unknown file (especially from a brand new user). Don't take it personally if the file doesn't get much traffic. It doesn't mean your efforts aren't appreciated. – fixer1234 Aug 28 '15 at 8:00
Yeah, I understand. I wish there was a simple way to verify links like that, or even just to guarantee the file type. Thanks! – jvanbrug Aug 28 '15 at 16:35

My way was simply to copy and paste from the PDF to notepad (to remove any formatting) and then from notepad to Microsoft Word.

In Word all ligatures are changed with other formatting fonts.

I use find and replace for each of them (like ^l for manual line interruption and ^m for manual page interruption and so on, you can find all easily online) and I replace with correct form.

In 4 or 5 steps I cover all possibilities quite quickly. It is useful to remove additional paragraph interruptions too (^P)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .