Search code examples
ghostscript

Maximum number of input file for Ghostscript (gs)


I simply want to combine multiple eps files into one big file using gs command the command work flawlessly except that when I specify more than 20 input files.

Somehow the command ignore input files starting from 21st input.

Anyone experience the same behavior? Is there a cap of number of input files specify anywhere?

I look through the site and couldn't find one.

sample command

gs -o output.eps -sDEVICE=eps2write file1.eps file2.eps .... file21.eps

Thank you.

Edit: add sample command


Solution

  • Almost certainly you have simply reached the maximum length of the command line for your Operating System. You can use the @ syntax for Ghostscript to supply a file containing the command line instead.

    https://www.ghostscript.com/doc/current/Use.htm#Input_control

    Note that the EPS files will not be placed appropriately using that command, and this does not actually combine EPS files, it creates a new EPS file whose marking content should be the same as the input(s).

    If you actually want to combine the EPS files its easy enough, but will require a small amount of programming to parse the EPS file headers and produce appropriate scale/translate operations, as well as stripping off any bitmap previews (which will also happen when you run them through Ghostscript).