我正在尝试使用 Ghostscript 创建一个单行 Linux 命令来组合两个 PDF 文件(从 URL 下载)。但是,我不想创建任何临时文件(一切都应该在内存中完成)。
以下命令似乎不起作用(我尝试通过进程替换来实现这一点)。
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 命令,也许有一种方法可以等待这种情况发生。