Author:
Lasse Johansson
Contributors:
Filippo Carletti Dan Brown
Last modified
Problem: You want to find an easy way for all your local
users to create PDF files.
Solution: Install Ghostscript
and ps2pdf on your E-Smith server and create a "pdf printer" by using Samba.
The steps in this HOWTO has been confirmed working on SME 5, but they would most probably be applicable on
ESSG 4.1.2 as well.
Confirmed: It's
perfectly OK to run these steps on ESSG
4.1.2.
If you use this HOWTO on a SME 5.1.2, you don't need to install Freetype, since it's allready a part of that distribution.
Samba: http://www.samba.org/
Ghostscript: http://www.cs.wisc.edu/~ghost/
Article: "Automating PDF production from SWP" http://facweb.arch.ohio-state.edu/pviton/support/pdfgs.html#x1-330009.2.1
Article: "PDF service with Samba": http://www.linuxdoc.org/LDP/LG/issue72/bright.html
First we'll have to install a number of rpm's (the links for each rpm package goes to the corresponding info page at rpmfind.net):
(If installing on SME 5.1.2, start directly with
#2) Install freetype-2.0.1-4
RPM for i386 (direct
link) with the command:
rpm -Uvh freetype-2.0.1-4.i386.rpm
Install XFree86-libs-4.0.3-5
RPM for i386 (direct
link) with the command:
rpm -Uvh XFree86-libs-4.0.3-5.i386.rpm
Install XFree86-xfs-4.0.3-5
RPM for i386 (direct
link) with the command:
rpm -Uvh XFree86-xfs-4.0.3-5.i386.rpm
Install chkfontpath-1.9.5-1
RPM for i386 (direct
link) with the command:
rpm -Uvh chkfontpath-1.9.5-1.i386.rpm
Install urw-fonts-2.0-4
RPM for noarch (direct
link) with the command:
rpm -Uvh urw-fonts-2.0-4.noarch.rpm
Install Omni-0.5.0-4
RPM for i386 (direct
link) with the command:
rpm -Uvh Omni-0.5.0-4.i386.rpm
Install ttfonts-ja-1.0-6
RPM for noarch (direct
link) with the command:
rpm -Uvh ttfonts-ja-1.0-6.noarch.rpm
Install VFlib2-2.25.1-20
RPM for i386 (direct
link) with the command:
rpm -Uvh VFlib2-2.25.1-20.i386.rpm
And finally install the two packages ghostscript-fonts-5.50-1
RPM for noarch (direct
link) and ghostscript-6.51-16
RPM for i386 (direct
link) with the command:
rpm -Uvh
ghostscript-fonts-5.50-1.noarch.rpm ghostscript-6.51-16.i386.rpm
We now have all the required (and a few not so
required...) packages installed.
To check this
you can type:
# ps2 ...followed by a TAB and you should end up with the following line:
ps2ascii ps2epsi ps2pdf ps2pdf12 ps2pdf13 ps2pdfwr ps2ps
It's now time to create an ibay where we pick up our PDF files.
Just make an ibay named "pdfdrop" and set the group permissions read and write to all users on your LAN
Now to the script printpdf itself,
it will be placed in
/usr/bin/ so we make a
# cd /usr/bin/
and then a
# pico printpdf
Copy the entire script below into your pico editor and save your work with [ctrl x]
#!/bin/sh
# Simple script to convert a specified postscript file
into a PDF document
# and place it in a
location that is shared by the Samba server.
#
# Arguments:
# 1st - The name of the spool
file
#
# John Bright, 2001, jbright@winfordeng.com
# We will create the pdf into a temporary file based
upon the current date and time.
# After we
are finished, we'll rename it to a file with the same date, but
ending
# in .pdf. We do this because
if a user tries to open a PDF that is still being written,
# they will get a message that it is corrupt, when it
is actually just not done yet.
DATE=`date +%b%d-%H%M%S`
# Directory in which to place the output
# Be sure this directory exists and is writable by
the user that Samba
# is running as (for
example, the nobody user)
OUTDIR=/home/e-smith/files/ibays/pdfdrop/files
#ps2pdf $1
$OUTDIR/$DATE.temp
#The following line
changed by Lasse Johansson lasse@saxdalen.com to enable pdf1.3 outputs. Original
line commented above.
ps2pdf13 $1
$OUTDIR/$DATE.temp
mv $OUTDIR/$DATE.temp
$OUTDIR/$DATE.pdf
rm $1
Make your script executable:
chmod 755
printpdf
Now we have to create a custom template for our "pdf-printer" and our
pdfdropbox in smb.conf:
Make the templates-custom directory:
mkdir -p /etc/e-smith/templates-custom/etc/smb.conf
Create a new template for this pdf thing:
pico /etc/e-smith/templates-custom/etc/smb.conf/91pdf
Copy and paste this into your pico editor:
[pdf]
path = /tmp
printable = yes
guest ok = yes
print command = /usr/bin/printpdf %s
; There is no need to support listing or
removing print jobs,
; since
the server begins to process them as soon as they arrive.
; So, we set the lpq (list queued jobs)
and lprm (remove jobs in queue)
; commands to be empty.
lpq command =
lprm command =
Save the new template with [ctrl x]
Expand the template:
/sbin/e-smith/expand-template /etc/smb.conf
Check that the new section [pdf] appears
at the end of your smb.conf by typing
less /etc/smb.conf
and
scroll down to the end of the file.
Restart your smb:
# /etc/rc.d/init.d/smb stop
Shutting down SMB
services:
[ OK ]
Shutting
down NMB
services:
[ OK ]
# /etc/rc.d/init.d/smb
start
Starting SMB
services:
[ OK ]
Starting
NMB
services:
[ OK ]
You're actually finished with your server setup now!
Now we're going to
set up the client machine (I assume here it's a M$ Windows 95 or 98, for Me, NT,
2000 and XP the procedure would probably be "simular", - anybody out there who
would like to contribute with those sections to this How-To?)
Download the "Adobe universal installer v. 1.0.5" at THIS LOCATION ( http://www.adobe.com:80/support/downloads/detail.jsp?ftpID=1292)
...Also, make sure to lay your hands on an
appropriate "PPD" file (Adobe Printer Driver) from THIS
LOCATION (http://www.adobe.com/products/printerdrivers/winppd.html)
(or, if you have some machine with Adobe Acrobat Distiller installed,
you would find the file Adistill.ppd or even better Adist4.ppd somewhere
there...)
If you choose so, you kan pick up this
text file, and save it with the name Adist4.ppd
(This is
the ppd file created by Adobe Acrobat 4.05, and it is distributable
according to the license text)
Unpack and install the package "Adobe
universal installer v. 1.0.5" in your client, and make sure you have the
PPD file available...
...When you get to the question:
"How is
the printer attached to your computer?"
...answer "Network"
...point out your newly created PDF-printer...
Now, you will have to direct the installation to your PPD file and finally name the printer "PDF-printer"
Congratulations!
You have just created a "PDF-printer" for
your LAN.
Just start up your favourite Windooze application, write
some essay and enjoy printing it out to your printer "PDF-printer".
You can pick up the output in form of PDF from your Ibay "pdfdrop"
ENJOY!
There are, of course, several parts here that could be much improved.
In
particular, I'm trying to determine the best proper way to make Windooze TTF
fonts translate into PostScript fonts in the PDF document, and also how to
insert TTF fonts directly into the PDF, if possible. (At present, the generated
PDF is not always searchable and not always detatchable because of this font
problem)
Anyone out there feeling smarter that me regarding font stuff and
Ghostscript is welcome to contribute.
Also, finding a smarter approach of adding more useful fonts to Ghostscript (maybe instead of ttfonts-ja-1.0-6.noarch.rpm ...) would be greatly appreciated!
Comments, suggestions and improvements for this HowTo are welcome!
Please
contact Lasse Johansson