2014-09-30 82 views
0

我尝试了几个小时,无法获得好的结果。我需要通过命令行打印PDF文档,并且我选择了Ghostscript来完成这项艰巨任务。我正在用我的参数创建一个名为config.cfg的文件,并将它传递给Ghostscript。我的Ghostscript安装路径是C:\Program Files\gs\gs9.15\bin,我正在使用可执行文件gswin64c进行测试。我的配置文件如下:无法使用Ghostscript打印

的config.cfg

"C:\pdf\pdf\type_theory.pdf" 
-colour 
-noquery 
-printer "Work Printer" 
-ghostscript "C:\Program Files\gs\gs9.15\bin\gswin64c.exe" 
-all 
-portrait 
-copies 1 

和我打电话,通过命令行:

gswin64c -config "C:\\pdf\\pdf\\config.cfg" 

但是我收到的输出以下错误:

GPL Ghostscript 9.15 (2014-09-22) 
Copyright (C) 2014 Artifex Software, Inc. All rights reserved. 
This software comes with NO WARRANTY: see the file PUBLIC for details. 
Error: /undefined in C:\\pdf\\pdf\\postscript.cfg 
Operand stack: 

Execution stack: 
    %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 
Dictionary stack: 
    --dict:1188/1684(ro)(G)-- --dict:0/20(G)-- --dict:77/200(L)-- 
Current allocation mode is local 
Last OS error: No such file or directory 

我可以理解,它是missin g最后一句话的文件,但我不知道它是什么。有人能帮我找到我的错误吗?

回答

1

你还没有选择一个设备,所以你会得到默认设备,这是显示器。如果要打印到打印机,则需要使用mswinpr2设备。所以-sDEVICE = mswinpr2

我不敢肯定你在哪里得到了config.cfg的内容,这应该是gsprint的命令行吗?这些选项对gsprint有一定的意义,对于Ghostscript它们根本没有任何意义。 Ghostscript开关大部分是-s或-d,其中只有很少 -

错误不会告诉你它缺少一个文件,那将是'undefinedfilename'它告诉你'postscript.cgfg '是未定义的。 PostScript是一种编程语言,这是解释器告诉你你的程序有错误。颜色可能是问题。

+0

我犯了一个错误。我是这样的:我从来没有看到它不完全是GhostScript,而是GSPrint。 – 2014-09-30 13:34:05