README.md 1.72 KB
Newer Older
Radek Hušek's avatar
Readme  
Radek Hušek committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CUPS pdf postprocess
====================

This is a simple utility acting as postprocesor of cups-pdf virtual printer.

Requirements
------------

- Python 3 (should be trivial to modify for Python 2)

- PyQt5


Setup
-----

This script can be use either directly (e.g. via context menu) or through cups-pdf.

Radek Hušek's avatar
Radek Hušek committed
19
20
First copy file `cups-pdf-postprocess.conf` to /etc/cups/ and edit it for your needs.
When invoked by
Radek Hušek's avatar
Readme  
Radek Hušek committed
21
cups, the script does not have any knowledge about running X, so you have to
Radek Hušek's avatar
Radek Hušek committed
22
set atleast `DISPLAY` (and probaly also `XAUTHORITY`) variable.
Radek Hušek's avatar
Readme  
Radek Hušek committed
23

Radek Hušek's avatar
Radek Hušek committed
24
25
Syntax is of printers section `("name of printer", ["command", "first argument"]),`
(it will be
Radek Hušek's avatar
Readme  
Radek Hušek committed
26
27
28
29
30
31
interpreted as part of Python list literal). There will be appended aditional
`lp`-like parameters when acually executing command.

To use it through cups, install pdf-cups, setup a new virtual printer and
then modify `/etc/cups/cups-pdf.conf`:
```
Radek Hušek's avatar
Radek Hušek committed
32
PostProcessing /path/to/cups-pdf-postprocess-your-wrapper.py
Radek Hušek's avatar
Readme  
Radek Hušek committed
33
34
```

Radek Hušek's avatar
Radek Hušek committed
35
36
37
*NOTE:* Ubuntu requires modifying AppArmor settings to allow cups-pdf to execute
this script by adding something like
```
Radek Hušek's avatar
Radek Hušek committed
38
  /path/to/cups-pdf-postprocess-your-wrapper.py ux,
Radek Hušek's avatar
Radek Hušek committed
39
40
41
```
into cups-pdf profile.

Radek Hušek's avatar
Radek Hušek committed
42
43
44
45
46
*WARNING:* The script does not delete printed files, so files printed through cups-pdf
will stay where they were printed to (default path is `/var/spool/cups-pdf/${USER}`).
It is up to you to delete them when needed. Easy way to do so might be to move
cups-pdf output directory to `/tmp` so it gets deleted on each restart.

Radek Hušek's avatar
Readme  
Radek Hušek committed
47
48
49
50
51
To add the script into context menu soft-link cups-pdf-postprocess-your-wrapper.desktop
into appropriate place for your desktop enviroment (in case of KDE4 this is
`~/.kde4/share/kde4/services/ServiceMenus`). You may need to copy it and fix path
to shell wrapper.