[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] PDF Printer in a Qube?



At 11:01 01/05/03 +0100, Steve Root wrote:

<snip from cobalt-securtiy and start a new thread :)>
A more modern Qube is pretty high on my wish-list. Larger disks,
2.4 Kernel and stuff like a built in PDF-Printer (through Samba and
Ghostscript) and a better built in firewall <sigh>.

--

With best regards,

Michael Stauber
OHE
<end snip>

Built in PDF Printer??? How so, I have a Qube3 Pro and didn't know it did that. That would be a cool feature for my users :)

_____________________________

Hi Steve,

Indeed that's a cool feature and Qube's should have it (they don't at the
moment). So that's why that's high on my wish list for a future Qube model.

I use such a setup on a whitebox Linux server. Through Samba I generate a
shared printer which is available to all networked PCs:

(sniplet of code which goes into smb.conf)

[pdfprinter]
        comment = Treiber: Minolta Color PageWorks/Pro PS
        path = /smbhome/pdfprinter
        printable = Yes
        print command = /smbhome/pdfscript %s

[pdfshare]
        path = /smbhome/pdfprinter
        admin users = root
        force group = users
        read only = No
        force create mode = 0777
        force directory mode = 0777
        delete veto files = Yes
        delete readonly = Yes
        dos filetimes = Yes

If someone prints a document to it a shell script is triggered which generates
a Postscript file and transforms it into a PDF file. That PDF file is then
stored on a SMB share from where users can fetch it.

The shell script required for this purpose looks like that:

-----------------------------------------------------------------------

#!/bin/bash

# Generate PDFs via Samba
#
# 1: find the file name:

FILE=$(egrep "^%%Title:" "$1" | head -n1 | sed -e 's/^%%Title: //g' | sed -e
's/^(//g' | sed -e 's/\(.*\)\..*$/\1/g' | tr -d "\r\n")
FILE=`echo -n -e $FILE`

#echo "FILENAME:" $FILE

# 2: remove crap from beginning and end of the ps file

POS_S=`egrep -n "^%\!PS-Adobe" "$1" | cut -d : -f 1 `
POS_E=`egrep -n "^%%EOF" "$1" | cut -d : -f 1 `
sed 1,$[$POS_S -1]d "$1" | head -n $[$POS_E - $POS_S +1] > "${FILE}.ps"

# 3: now we can remove the smb file

rm -f "$1"

# 4: make a pdf

gs -q -dCompatibilityLevel=1.3 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-sOutputFile="${FILE}.pdf" -c save pop -f "${FILE}.ps"

# 5: remove ps file

rm -f "${FILE}.ps"

-----------------------------------------------------------------------

All in all it works pretty seamlessly. To get it to run on a Qube you need
Ghostscript (not installed) and a couple of updated libraries.

--

With best regards,

Michael Stauber