title: Ghostscript: "Unrecoverable error: undefinedfilename in setpagedevice"
body: <p>I'm trying to compress pdf files using ghostscript like this:</p>
  
  <pre><code>gs -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH  -sOutputfile=output.pdf input.pdf 
  </code></pre>
  
  <p>I've done this successfully in the past, but for some reason now it won't work.  I get the following error:</p>
  
  <pre><code>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.
  **** Unable to open the initial device, quitting.
  Unrecoverable error: undefinedfilename in setpagedevice
  Operand stack:
      true  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--  --nostringval--
  </code></pre>
  
  <p>[Edit: I fixed the typo from -SOutputFile to -sOutputFile to avoid this red herring. (But that is what some of the comments/answers are referring to.)]</p>