Skip to main content
Matthew Wright
Participating Frequently
Sep 29, 2021 10:06 PM UTC

PrinterLogic - server-less printing, UniVerse config issues

Mods please remove  - (Can't see any obvious way to delete a thread?)

    1 reply

    Manu Fernandes
    Inspiring
    Sep 30, 2021 8:08 AM UTC
    Mods please remove  - (Can't see any obvious way to delete a thread?)
    Hi Matthew,

    We are used to talk about 'software printer', linked to a script but a device.
    Defined like this into uvspool/sp.config , each printer is defined on one line
    PRINTERNAME /dev/null.printername DRIVER /uvspool/lpuv.sh FORMS DEFAULT
    ​

    PRINTERNAME is the name of the printer used under uv 
    /dev/null.printername is a empty file used by uvspool to lock the device during a printing, using a file per printername avoid locks if you use /dev/null on all printername
    DRIVER /uvspool/lpuv.sh is a unix script which handle the job

    #get the args ; the shift kill the first arg from the list, the all are read from $1, as 'first arg' 
    uv_jobnr=$1         ; shift  ;# job nr , same as displayed on SETPTR 
    uv_jobsize=$1       ; shift  ;# job size in byte
    uv_uid=$1           ; shift  ;# userid = uv @LOGNAME 
    uv_banner=$1        ; shift  ;# banner set by SETPTR BANNER
    uv_form=$1          ; shift  ;# form name requested
    uv_printer=$1       ; shift  ;# printer name requested
    uv_linelenght=$1    ; shift  ;# line lenght from SETPTR
    uv_pagelenght=$1    ; shift  ;# page lenght from SETPTR
    uv_eject=$1         ; shift  ;# eject flag from SETPTR 1/0
    uv_banner=$1        ; shift  ;# banner flag print it 1/0
    uv_useropts=$*      ; shift  ;# USEROPTS options - one string
    
    #force printername to lowercase 
    PRINTER=`echo $uv_printer | tr [:upper:] [:lower:]`
    # get username 
    USERNAME=`grep $uv_uid /etc/passwd | cut -d : -f 5`
    lpr -P $PRINTER-U uv_uid -C "uvspool $uv_jobnr $USERNAME"
    ​
    if you use cat > /tmp/$uv_jobnr.txt vs lpr you get the job into a file, then you can manipulate it, encapsulate, route it to email, to auxilary printer, pass to other software , ... do what you want with the job. 
    We are used to define 'standard' printernames as : 
    - pdf : send the job to a pdf converter 
    - email : send the job to the user by email
    - saveas : send into a document manager with metadata (date/time/user/useropt/... 
    - pdfmailto : send the job to a pdf converter then send the job to the user by email 
    etc

    I hope this help

    ------------------------------
    Manu Fernandes
    ------------------------------