使用ghostscript将png转换为pdf

Eug*_* Yu 13 pdf ghostscript

正如标题所说我试图将png转换为pdf.我无法在任何地方找到关于此的详细描述.

我用过这个命令

gs sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -sOutputFile=test.pdf test.png
Run Code Online (Sandbox Code Playgroud)

但我得到的只是

Error: /syntaxerror in (binary token, type=137)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push
Dictionary stack:
   --dict:1161/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
GPL Ghostscript 9.07: Unrecoverable error, exit code 1
Run Code Online (Sandbox Code Playgroud)

此错误消息.现在我开始讨论如果ghostscript中有这样的功能.我应该使用其他软件吗?**我正在运行最新的9.07版本

oak*_*kad 14

Ghostscript可以输出多种格式(包括png)但我不相信它能够将png作为输入.您可以使用像imagemagick的convert实用程序来完成目标,但是:convert test.png test.pdf