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.

link|improve this question
feedback

4 Answers

This answer is courtesy of the LaTeX Community. It's solved the issue for me.

\usepackage{microtype}
\DisableLigatures{encoding = *, family = * }
link|improve this answer
Maybe I'm missing something, but I'm not sure how this would help me: I can't modify the PDFs. Is there a PDF reader for Windows that allows something like this? – James McNellis May 4 '11 at 4:50
Sorry... my mistake. My answer is related to pdflatex, not PDFs. pdflatex is used by tex authors to create PDFs. Tex authors can generate PDFs free from the problem you describe if they insert the above commands in their tex source. – SmileAndNod May 4 '11 at 15:22
feedback

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.

link|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
feedback

In python this would be:

import unicodedata
# \uFB00 is the ff ligature.
unicodedata.normalize('NFKD',u'\uFB00').encode('ascii','ignore')

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

link|improve this answer
feedback

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:

\input{glyphtounicode.tex}
\pdfgentounicode=1 %
link|improve this answer
Works for me, thank you for the hint. – gentlesea Feb 29 at 10:27
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.