title: Count PDF pages from stdin with Ghostscript (PostScript)
body: <p>Well I found on <a href="https://stackoverflow.com/questions/4826485/ghostscript-pdf-total-pages">stackoverflow</a> how to count pages of PDF file using Ghostscript by executing the following command on a shell</p>
  
  <pre><code>gs -q -dNODISPLAY -c "($PATH_TO_PDF) (r) file runpdfbegin pdfpagecount = quit"')
  </code></pre>
  
  <p>I would like to get the pdf from stdin. </p>
  
  <p>I'll played a little bit around, but with no success. </p>
  
  <p>My approach was:</p>
  
  <pre><code>gs -q -dNODISPLAY - -c "(%stdin) (r) file runpdfbegin pdfpagecount = quit"')
  </code></pre>
  
  <p>I get no output. </p>
  
  <p>Any hints or suggestions?</p>