title: Ghostscript output PDF: text can not be copied
body: <p>I am using TCPDF in order to create PDF files.</p>
  
  <p>Because TCPDF has a bug in the font subsetting (<a href="https://sourceforge.net/p/tcpdf/bugs/1042/" rel="nofollow">link to bug</a>),<br>
  I use the following Ghostscript command to subset fonts in the TCPDF-created PDF file:</p>
  
  <pre><code>gswin64c.exe -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 \
      -dPDFSETTINGS=/prepress -dUseFlateCompression=false -dEmbedAllFonts=true \
      -dSubsetFonts=true -sOutputFile="out.pdf" "input.pdf"
  </code></pre>
  
  <p>It works great and reduces the file size. But when I try to parse the PDF file as text (with poppler -> <code>pdftotext</code>) or when I open the file in PDF viewer and select text I get gibberish on UTF-8 fonts.</p>
  
  <p>In order to reproduce it here is the <a href="https://dl.dropboxusercontent.com/u/6523798/tmp/inputNoSubset.pdf" rel="nofollow">file before ghostscript</a> and <a href="https://dl.dropboxusercontent.com/u/6523798/tmp/outputOfDhostScript.pdf" rel="nofollow">file after ghostscript</a>.</p>
  
  <p>If you open it in Adobe reader copy the text and paste it to somewhere else, you can see that you can copy text from the file "before GS". But in the second file you get gibberish unless you copy english characters (files are in Hebrew).</p>
  
  <p>Other than that the file looks great.</p>
  
  <p>Do you have any idea on how to preserve the UTF8 fonts in Ghostscript?</p>