use*_*ser 5 printing cups pdf ghostscript
这里有一些非常奇怪的东西:以前在 Debian 中运行良好的东西,然后即使没有 dist-upgrade 也坏了。
我曾经能够使用 CUPS PDF 虚拟打印机将任何内容打印到 PDF 文件中。现在,它不起作用:当我以普通用户身份打印时, ~/PDF 中没有任何显示。但是,如果我登录 CUPS 管理界面并使用该界面将测试页打印到打印机,则它可以工作;PDF 很好地显示在 ~root/PDF 中。但我希望能够以非 root 用户身份打印到 PDF...
/var/log/cups/cups-pdf_log 有这样的说法:
Fri Feb 7 18:31:57 2014 [STATUS] ***Experimental Option: DecodeHexStrings
Fri Feb 7 18:31:57 2014 [ERROR] failed to set file mode for PDF file (non fatal) (/michael/home/PDF/PDF_-_CUPS_1_5.pdf)
Fri Feb 7 18:31:57 2014 [STATUS] PDF creation successfully finished (michael)
Run Code Online (Sandbox Code Playgroud)
好的,所以有failed to set file mode for PDF file
。然而,谷歌搜索并没有太大帮助。我确实找到了一个网页,建议更改Out
/etc/cups/cups-pdf.conf 中的目录,所以我做了 ( Out /tmp/${USER}.cups-pdf
) 并重新启动了 CUPS,当我尝试打印为 PDF 时,它会选择该更改,因为它创建了这样一个目录,但随后在新位置抱怨相同的错误。
尽管似乎是最新版本(CUPS 1.5.3-5+deb7u1、CUPS-PDF 2.6.1-6、Debian Wheezy),但我还是决定重新安装 CUPS,以防它以某种方式损坏。
sudo apt-get --reinstall -u install cups cups-pdf cups-bsd cups-client cups-common cups-driver-gutenprint cups-filters cups-pk-helper cups-ppdc
Run Code Online (Sandbox Code Playgroud)
但是,我仍然遇到相同的错误。
LogType 7
/etc/cups/cups-pdf.conf 中的设置会产生这个:
Fri Feb 7 19:01:29 2014 [DEBUG] switching to new gid (lpadmin)
Fri Feb 7 19:01:29 2014 [DEBUG] initialization finished (v2.6.1)
Fri Feb 7 19:01:29 2014 [DEBUG] user identified (michael)
Fri Feb 7 19:01:29 2014 [DEBUG] output directory name generated (/tmp/michael.cups-pdf)
Fri Feb 7 19:01:29 2014 [DEBUG] user information prepared
Fri Feb 7 19:01:29 2014 [DEBUG] spoolfile name created (/var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:29 2014 [DEBUG] source stream ready
Fri Feb 7 19:01:29 2014 [DEBUG] destination stream ready (/var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:29 2014 [DEBUG] owner set for spoolfile (/var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:29 2014 [DEBUG] using traditional fgets
Fri Feb 7 19:01:30 2014 [DEBUG] found beginning of postscript code (%!PS-Adobe-3.0)
Fri Feb 7 19:01:30 2014 [DEBUG] now extracting postscript code
Fri Feb 7 19:01:30 2014 [DEBUG] found title in ps code ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [DEBUG] found end of postscript code (%%EOF)
Fri Feb 7 19:01:30 2014 [DEBUG] all data written to spoolfile (/var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:30 2014 [DEBUG] trying to use PS title ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [DEBUG] removing trailing newlines from title ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [STATUS] ***Experimental Option: DecodeHexStrings
Fri Feb 7 19:01:30 2014 [DEBUG] checking for hex strings ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [DEBUG] not a hex string, has no start marker ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [DEBUG] removing enclosing parentheses () from full title ((What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange))
Fri Feb 7 19:01:30 2014 [DEBUG] calling alternate_replace_string
Fri Feb 7 19:01:30 2014 [DEBUG] removing alternate special characters from title (What does the CUPS PDF printer need to be able to set file mode? - Unix & Linux Stack Exchange)
Fri Feb 7 19:01:30 2014 [DEBUG] truncating title (What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_)
Fri Feb 7 19:01:30 2014 [DEBUG] title successfully retrieved (What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_)
Fri Feb 7 19:01:30 2014 [DEBUG] input data read from stdin
Fri Feb 7 19:01:30 2014 [DEBUG] output filename created (/tmp/michael.cups-pdf/What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_.pdf)
Fri Feb 7 19:01:30 2014 [DEBUG] ghostscript commandline built (/usr/bin/gs -q -dCompatibilityLevel=1.4 -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="/tmp/michael.cups-pdf/What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_.pdf" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f /var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:30 2014 [DEBUG] output file unlinked (/tmp/michael.cups-pdf/What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_.pdf)
Fri Feb 7 19:01:30 2014 [DEBUG] TMPDIR set for GhostScript (/var/tmp)
Fri Feb 7 19:01:30 2014 [DEBUG] waiting for child to exit
Fri Feb 7 19:01:30 2014 [DEBUG] entering child process
Fri Feb 7 19:01:30 2014 [DEBUG] GID set for current user
Fri Feb 7 19:01:30 2014 [DEBUG] supplementary groups set for current user
Fri Feb 7 19:01:30 2014 [DEBUG] UID set for current user (michael)
Fri Feb 7 19:01:30 2014 [DEBUG] ghostscript has finished (256)
Fri Feb 7 19:01:30 2014 [ERROR] failed to set file mode for PDF file (non fatal) (/tmp/michael.cups-pdf/What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_.pdf)
Fri Feb 7 19:01:30 2014 [DEBUG] ERRNO: 2
Fri Feb 7 19:01:30 2014 [DEBUG] no postprocessing
Fri Feb 7 19:01:30 2014 [DEBUG] spoolfile unlinked (/var/spool/cups-pdf/SPOOL/cups2pdf-18015)
Fri Feb 7 19:01:30 2014 [DEBUG] all memory has been freed
Fri Feb 7 19:01:30 2014 [STATUS] PDF creation successfully finished (michael)
Run Code Online (Sandbox Code Playgroud)
我确实注意到 Ghostscript 似乎以状态 256 ( [DEBUG] ghostscript has finished (256)
)退出,但我找不到任何能告诉我为什么它会以该错误代码退出的内容。
我的用户帐户不是lp
或lpadmin
组的成员,但这并没有改变。
打印到我办公桌上的物理打印机工作正常;我最近才这样做,在打印到 PDF 之后很久才开始像这样。
我的问题可能是什么?
查看您的日志,听起来好像在设置文件权限时存在问题/tmp
。
2014 年 2 月 7 日星期五 19:01:30 [错误] 无法设置 PDF 文件的文件模式(非致命)(/tmp/michael.cups-pdf/What_does_the_CUPS_PDF_printer_need_to_be_able_to_set_file_mode_.pdf)
我确认你能够做到这一点。也许父目录 的权限/tmp
已更改。