Why are thumbnails not being generated for PDF files?

I found a solution! I hope this helps save some time and frustration for others that might encounter this problem. It turns out that it isn’t WordPress or PHP.

After a lot of digging, I came across this discussion by some members of the WordPress Core team: https://core.trac.wordpress.org/ticket/48853. It says that there is some kind of issue in Ghostscript 8.70 and below that prevents the thumbnails from being generated for PDFs. So, I checked the installed version of Ghostscript. Sure enough, it’s 8.70. I looked for a yum update, but 8.70 is the latest available for the server OS (CentOS 6).

I saw several posts that described installing a newer version from a tar.gz file, so I tried that using the defaults. WordPress still would not generate PDF thumbnails. Rats. Even though the command line reported the newer version of Ghostscript, it was like WordPress didn’t see it. Then I saw a post somewhere that seemed to indicate that WordPress was looking in /usr/bin for the Ghostscript executable. The default ./configure command (with no arguments) installed GS in /usr/local/bin. After installing GS into /usr/bin instead, WordPress was finally able to generate PDF thumbnails!

Here are the steps for CentOS 6:

  1. wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs919/ghostscript-9.19.tar.gz (I saw somewhere that if you go higher than that version with CentOS 6, you’ll have to mess with updating compilers and linkers and whatnot.)
  2. tar -zxvf ghostscript-9.19.tar.gz
  3. cd ghostscript-9.19
  4. ./configure --prefix=/usr (To install where WordPress expects to find GS)
  5. make
  6. sudo make install

That’s it! I also bounced Apache for good measure, but I’m not sure that’s necessary. Hope this helps!