On Wednesday 11 December 2002 11:51 am, Gary Stainburn wrote:
> On Wednesday 11 December 2002 11:12 am, Alan Peery wrote:
> > Anthony E. Greene wrote:
> > > - A "print server" that converts printjobs to PDF and delivers them to
> > >   the user via email.
> >
> > Do you have pointer to a HOWTO on that?  It could be quite useful for
> > work, as I want to encourage sending documents to customers in PDF
> > format...
> >
> > Alan
>
> Hi Alan,
>
> This is not something I've automated, but the basics are quiet simple.
>
> Many Linux dists - read RH as that's the only one I use - have a GUI
> printer config tool now and have a option to create a 'Print to PDF'
> option. Alternatively, have a 'Print to File' printer which just creates a
> Postscript file instead of a PDF one.  Simply use ps2pdf to convert this to
> a PDF file.
>
> Then on each windows PC, install a network printer pointing to the Linux
> printer you've just installed.  Select the Apple colour Laserwriter (can't
> remember the exact name) driver as this creates a postscipt file and
> supports colour which ends up with colour PDF files.
>
> Personally, I'd simply put these files in a network available directory.
>
> If you want to do this manually, then it should be a simple case of writing
> a small bash script to accept a filename and  a machine/user name using the
> %m %f token and add a printer to the smb.conf specifying you script as the
> 'lpr command' for that printer.  You could then do whatever you want within
> your script, including emailing back to the user, adding to an archive,
> placing in privately available network shares etc.

Hi Alan,

I've knocked up a little script to demonstrate what I meant.  This script 
assumes:

1) You have a Linux PC.
2) You have Windows workstations.  These workstations each have:
        i) An Apple laserwriter configured with the device \\<linuxbox>\pdf
        ii) A folder somewhere shared as \\<windowsbox>\pdf

I added the following section to /etc/samba/smb.conf

[pdf]
   comment = PDF Generator
   path = /var/spool/samba
   browseable = yes
   public = yes
   guest ok = yes
   printable = yes
   print command = /usr/bin/smbtopdf '/var/spool/samba/' '%f' '%J' '%m'

and write the small script /usr/bin/smbtopdf

#!/bin/bash

exec >>/tmp/smbtopdf
exec 2>&1

path="$1"
fname="$2"
Job="$3"
machine="$4"

Job=`echo $Job|sed 's/ /_/g'`
echo "machine='$machine' file='$fname' job='$Job'" 
cd $path
/usr/bin/ps2pdf -sPAPERSIZE=a4 $fname $fname.pdf
/usr/bin/smbclient //$machine/PDF -N<<EOF
put $fname.pdf $Job.pdf
EOF

rm $fname $fname.pdf

echo Done

This accepts a print request from a PC, converts that print request to a PDF 
file, and then puts the resulting file in the PDF folder on the client PC. 

On my test PC, I simply created the PDF folder on the desktop, shared it as 
PDF (with full access obviously), Added the network printer and let it test 
print normally as part of the installation.  When it had finished I had 
Printer_Test_Page.pdf inside my PDF folder.

Be warned though, it will overwrite files so printing the same document twice 
will overwrite the first one



-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000     



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to