我想创建一个单行的Linux命令来结合两个PDF文件 - 这是从URL下载 - 使用Ghostscript。但是,我不想创建任何临时文件(一切都应该在内存中完成)。管道多个输入到Ghostscript
以下命令看起来不起作用(我尝试通过进程替换实现此目的)。
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=combined.pdf <(curl http://example.com/one.pdf) <(curl http://example.com/two.pdf)
当我运行这个命令,它给了我下面的错误。
**** Warning: An error occurred while reading an XREF table.
**** The file has been damaged. This may have been caused
**** by a problem while converting or transfering the file.
**** Ghostscript will attempt to recover the data.
Error: /ioerror in --run--
Current allocation mode is local
Last OS error: Illegal seek
GPL Ghostscript 9.18: Unrecoverable error, exit code 1
我相信所发生的事情是,这两个输入PDF文件有机会完成下载之前正在运行Ghostscript的命令,也许有一种方法来等待这样的事情发生。