Dave
Dave

Reputation: 680

Ghostscript renders embedded fonts in pdf poorly (all jaggy)

Ghostscript doesn't render embedded fonts in pdf's properly. e.g. http://vegro.nl/cmsfiles/ConsumentenAssortiment/Brochure/10.axd The characters of the logo on the right top ('Thermrad') are all jagged. If I open the file in Adobe Reader, no problem at all!

Do you have this problem too? Is there any solution? I've been searching for days now, but I cannot find anything.

I tried Ghostscript 8.64 and 8.71 both on Windows Vista and CentOS.

Upvotes: 3

Views: 2900

Answers (2)

matt wilkie
matt wilkie

Reputation: 18084

The cure for smooth font rendering for us when converting PDF to JPG was to turn on text anti-aliasing with -dGraphicsAlphaBits=4 -dTextAlphaBits=4.

Here's a windows batch file I use to convert to a page size passed on the command line. Sample invocation: pdf2jpg infile.pdf 11x17

gswin64c.exe ^
-dNOPAUSE -P- -dSAFER -dBATCH ^
-dGraphicsAlphaBits=4 ^
-dTextAlphaBits=4 ^
-sDEVICE=jpeg ^
-dJPEGQ=85 ^
-r300x300 ^
-sPAGESIZE=%2^
-sOutputFile=%~n1.jpg ^
%1

Also there is at least one known issue with font anti-aliasing being turned off automatically in some gs versions if transparent images are present. Convert a PDF to a Transparent PNG with GhostScript has a solution.

Upvotes: 1

Kurt Pfeifle
Kurt Pfeifle

Reputation: 90193

My advice is to use Ghostscript 8.71. Then use this commandline:

  gswin32c.exe ^
      -sDEVICE=pdfwrite ^
      -o thermrad-out.pdf ^
      -dPDFSETTINGS=/printer ^
      10.axd

That should do the job of converting the PDF to one that has no problems any more. Because the original .axd file does have a problem with an embedded font. (I'm using pdffonts.exe from the XPDF suite to check). The problem occurs on page 3 of your 10.axd:

 for /l %i in (1,1,16) do (
       echo.   ............ Page %i ............................... ^
       & pdffonts.exe -f %i -l %i 10.axd ^
       & echo.)

outputs this:

  [....]
        ............ Page 3 ...............................
  name                                 type              emb sub uni object ID
  ------------------------------------ ----------------- --- --- --- ---------
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes    249  0
  XCZBKH+HelveticaNeue-Light           Type 1C           yes yes yes    250  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     15  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     19  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     41  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     45  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     49  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     53  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     57  0
  Error: Illegal entry in bfchar block in ToUnicode CMap
  YCRHYF+HelveticaNeue-LightExt        Type 1C           yes yes yes     61  0
  [....]

After I let Ghostscript repair it, the problem is gone for page 3 in the repaired PDF:

 c:\> pdffonts.exe -f 3 -l 3 thermrad.pdf

   name                                 type              emb sub uni object ID
   ------------------------------------ ----------------- --- --- --- ---------
   CZBBTM+HelveticaNeue-LightExt        Type 1C           yes yes no      13  0
   MXETZY+HelveticaNeue-Light           Type 1C           yes yes no      40  0

Upvotes: 3

Related Questions