当前位置: 首页 > 工具软件 > CUPS-PDF > 使用案例 >

CUPS-PDF file name prompt

印飞捷
2023-12-01

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.
 类似资料: