You cannot work with PDF files from stdin, since the PDF format makes it more or less essential to be able to randomly access all parts of the file.
In cases where Ghostscript reads the PDF file from stdin, it first copies it to the local file and then works on it, so it still doesn't work from stdin.
In short, this is not possible.
source share