【问题标题】:Can't print using Ghostscript无法使用 Ghostscript 打印
【发布时间】:2014-11-25 02:56:10
【问题描述】:

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

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

我可以通过最后一句话理解它缺少文件,但我不知道它是什么。有人可以帮我找出我的错误吗?

【问题讨论】:

    标签: pdf ghostscript


    【解决方案1】:

    您尚未选择设备,因此您将获得默认设备,即显示器。如果要打印到打印机,则需要 mswinpr2 设备。所以-sDEVICE=mswinpr2

    我完全不确定你从哪里得到 config.cfg 的内容,这应该是 gsprint 的命令行吗?这些选项对 gsprint 有意义,但对 Ghostscript 根本没有任何意义。 Ghostscript 开关大多是 -s 或 -d 比较少的是简单的 -

    该错误不会告诉您它丢失了一个文件,即“未定义文件名”它告诉您“postscript.cgfg”中的某些内容未定义。 PostScript 是一种编程语言,它是解释器告诉你你的程序有错误。 -颜色可能是问题所在。

    【讨论】:

    • 我做错了。我在关注这个:pages.cs.wisc.edu/~ghost/gsview/gsprint.htm>,我从来没有看到它不完全适用于 GhostScript,而是适用于 GSPrint。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-24
    • 1970-01-01
    • 2012-06-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多