I have a pdf file, whose text can be shown correctly in evince, but not when text are searched or copied and pasted outside the file. For example, "external transportation." is copied and pasted outside as

2D/28:93 /89:4758/9/.5:

I created the pdf file from the original version of the pdf file which works correctly, by

gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile=example.pdf original.pdf

The command is my general way to repair various problems in a pdf file (especially font problems in pdf files created on Windows).

  1. Why does the command create the problem? How shall I change the command, as a general way to fix pdf problems?
  2. How shall I repair the current version of the pdf file, so that the correct text can be searched and copied and pasted outside? The file I am actually interested in repairing was created in the same way and with additional modifications. I want to repair it, so that I can keep the modifications.


  • 1
    how do you know that the pdf file requires repairing? .... perhaps it is some form of copy protection
    – jsotola
    Jun 6 '19 at 23:01
  • 3
    @Tim, it is up to you to determine which conversion step corrupted the pdf file ... we cannot do it for you .... in the future, please include the information, that you posted in the comment, in your question
    – jsotola
    Jun 6 '19 at 23:25
  • 2
    I can confirm that the gs command you gave creates a PDF with the problem you describe. So why are you running that gs command? Why not just use the original file? Does that also have some issue?
    – terdon
    Jun 8 '19 at 13:32
  • 2
    Relevant: Ghostscript output PDF: text can not be copied
    – terdon
    Jun 8 '19 at 13:36
  • If you're able to edit a PDF document, why not just save an modified pdf in your editor? If the editor generated file has some problem, maybe you can call the editor's customer service for help? Jun 23 '19 at 14:23

I did some reading and some helpful posts on Stack Overflow (1, 2, 3) seem to suggest that the issue is with the specific fonts embedded in your PDF file. Your original file uses these fonts:

$ pdffonts original.pdf 
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
KPSHBO+Wingdings                     TrueType          Custom           yes yes no       5  0
KNQZHK+Arial                         TrueType          Custom           yes yes no       9  0
YLWHHJ+TimesNewRoman                 TrueType          Custom           yes yes no      13  0
HWNDJR+ArialBlack                    TrueType          Custom           yes yes no      17  0
QQRMEC+TimesNewRoman,Bold            TrueType          Custom           yes yes no      21  0

I am guessing (but don't know for sure) that the problem is most likely caused by the Wingdings font. Presumably you don't have it on your system. At least, of the fonts listed, that's the only one I can't find on mine:

$ fc-list | grep -f <(pdffonts original.pdf | grep -oP '\+\K[A-Z][a-z]+') | awk '{print $1}'

Unfortunately, I tried downloading a Wingdings font from here, then ran:

unzip wingdings.zip 
sudo cp Wingdings\ Regular.ttf /usr/share/fonts/TTF/Wingdings.ttf

Which should have installed the font, but the gs command still didn't work. So perhaps gs's pdfwrite can't deal with this font at all. So I don't know if there's a way of getting gs to convert your file correctly. Perhaps simply using the original which doesn't have this problem is your only choice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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