CUPS-PDF file name prompt

http://ubuntuforums.org/showthread.php?t=893968

 

CUPS-PDF file name prompt

Over the past few months, a number of forum members have requested help in configuring cups-pdf to prompt for a file name. With the help of the threads credited below, I got this working and thought I would pass along the procedure I followed.

1) Create a script similar to the sample script below and place it in a folder in your path (~/bin is good).

2) Open the file /etc/apparmor.d/usr.sbin.cupsd in a text editor and add the path to the script at the end of this file just before the final } symbol. After the path append uxr,. An example is:

/home/kaibob/bin/cupscript.sh uxr,
3) Open the file /etc/cups/cups-pdf.conf in a text editor, remove the # symbol before the line that begins with postprocesssing, and add the path to the script after postprocessing. An example is:

PostProcessing /home/kaibob/bin/cupscript.sh
4) Restart apparmor (ignore warning messages):

sudo /etc/init.d/apparmor restart
5) Restart your computer (seems to be necessary).

The sample script contained below works but is intentionally barebones--you will want to gussy it up a bit to fit your needs. It uses zenity, which I believe is installed by default in Hardy, but is otherwise available in the repo's. Be sure to back up all files before editing them.

SAMPLE SCRIPT
#!/bin/bash
CURRENT_PDF="${1}"
CURRENT_USER="${2}"
DISPLAY=:0.0
export DISPLAY
XAUTHORITY=/home/${CURRENT_USER}/.Xauthority
export XAUTHORITY
PDFNAME=$(zenity --file-selection --save --confirm-overwrite)
mv "$CURRENT_PDF" "$PDFNAME"
SOURCES - CREDIT
http://ubuntuforums.org/showthread.php?t=750426
http://ubuntuforums.org/showthread.php?t=837257
Last edited by kaibob; August 21st, 2008 at 05:59 AM.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值