I execute a Ghostscript (gs) command with the following arguments:
gs -q -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=98 -r96 -dTextAlphaBits=4 \
-dGraphicsAlphaBits=4 -sOutputFile=target.jpg -f watermark.ps input.pdf
where watermark.ps is a PostScript file with script like here:
Is it possible in Ghostscript to add watermark to every page in PDF
Is it possible to use that PostScript inline, I mean putting watermark.ps text directly to the command line avoiding the file reading?
According to this doc http://www.ghostscript.com/doc/9.18/Use.htm#Input_control it's possible using -c or -s switches, but I can't figure out how to merge that .ps file to one line? How to treat new lines in PS? Maybe I should use -c for every line? I was not able to google any gs example with inline PS.