Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

3 Answers

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
add comment

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.

share|improve this answer
add comment

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 %
share|improve this answer
    
Works for me, thank you for the hint. –  gentlesea Feb 29 '12 at 10:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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