1

I am having a problem when converting PDF to Images using ImageMagick or Ghostscript. All accented characters disappear from the converted image. I found a couple of people having the same problem and apparently updating imagemagick package and ghostcript fixed it, but not for me.

I am using this PDF file on every tests I made: https://www.dropbox.com/s/3gso0sw1e1n8f9r/error-with-accents.pdf?dl=0

I have an Ubuntu 14.04.2 LTS server on Azure where I need ImageMagick to work. From the official repositories I have ImageMagick 6.7.7 and Ghostscript 9.10. Later, I tried upgrading them in order to fix my issue and now I have also ImageMagick 6.8.9-10 running on /opt/imagemagick-6.8 folder and I added Ubuntu's 15.04 repository so I could install Ghostscript 9.15 directly through apt-get. None of these fixed the problem for me.

Here are my latests attempts on the Ubuntu 14.04 server:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:    14.04
Codename:   trusty

$ /opt/imagemagick-6.8/bin/convert -version
Version: ImageMagick 6.8.9-10 Q16 x86_64 2015-07-30 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: jng jpeg png x xml zlib

$ /opt/imagemagick-6.8/bin/convert -list configure |grep DELEGATES
DELEGATES      mpeg jng jpeg png ps x xml zlib

$ /opt/imagemagick-6.8/bin/convert error-with-accents.pdf -verbose -alpha off -resample 150 -density 150 -quality '80' im-test.jpg
   **** Warning: considering '0000000000 XXXXX n' as a free entry.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Mac OS X 10.10.4 Quartz PDFContext <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

error-with-accents.pdf=>im-test.jpg PDF 595x794=>1240x1654 1240x1654+0+0 16-bit sRGB 172KB 0.440u 0:00.240

$ gs -v
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.

$ gs -dBATCH -dNOPAUSE -sDEVICE=jpeg -sOutputFile=gs-test.jpg error-with-accents.pdf 
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** Warning: considering '0000000000 XXXXX n' as a free entry.
Processing pages 1 through 1.
Page 1

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Mac OS X 10.10.4 Quartz PDFContext <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

$ convert -version
Version: ImageMagick 6.7.7-10 2014-03-06 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP    

$ convert -list configure |grep DELEGATES
DELEGATES     bzlib djvu fftw fontconfig freetype jbig jpeg jng jp2 lcms2 lqr lzma openexr pango png rsvg tiff x11 xml wmf zlib

$ convert error-with-accents.pdf -verbose -alpha off -resample 150 -density 150 -quality '80' im-test-6.7.7.jpg
   **** Warning: considering '0000000000 XXXXX n' as a free entry.

   **** This file had errors that were repaired or ignored.
   **** The file was produced by: 
   **** >>>> Mac OS X 10.10.4 Quartz PDFContext <<<<
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.

error-with-accents.pdf=>im-test-6.7.7.jpg PDF 595x794=>1240x1654 1240x1654+0+0 16-bit DirectClass 160KB 0.490u 0:00.279

All with the same results:
https://www.dropbox.com/s/eob6y234x37s864/gs-test.jpg?dl=0
https://www.dropbox.com/s/96z1pkksdn1dpr4/im-test.jpg?dl=0
https://www.dropbox.com/s/dev0kbza2c8v2gf/im-test-6.7.7.jpg?dl=0

I am able to run Ghostscript and ImageMagick correctly on a Mac OS. And, according to this post, the versions I have on Ubuntu should work. So I'm thinking it's something related to FreeType fonts. Which I know nothing on how to fix this. Any help?

1

Thanks to Kurt Pfeifle on Stackoverflow for the answer.

The problem was the version of Ghostscript installed on the server. Since the latest version for Ghostscript on Ubuntu wily repository is 9.15, I downloaded the official binary package for linux x64 at Ghostscript website.

Then I substituted /usr/bin/gs binary with the one inside the package and everything worked correctly. No more problems with accents.

1

I had to the same kind of problems when trying to print a pdf with accents. I came to the conclusion that it was a ghostscript problem, since CUPS was using it while rasterising the pdf through gstoraster filter. I also realised that a recent binary of ghostscript in standalone mode was doing a great job.

BUT I wouldn't advise to subsitute /usr/bin/gs because it could break some dependences (CUPS for example) !

Instead, I suggest you to have a look on the tool pdfimages from poppler-utils

  • the question is all ready solved and there is no need to post an answer. if you have a different problem ask a question here – Neil Nov 10 '15 at 10:10

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.