PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : PDF-Generator unter Mandrake 9.2 "WIE"



Manta
01.12.03, 21:13
Hallo....,
ich habe Mandrake9.2 als Server laufen mit Samba2.28 und möchte die Standart freigegebenen PDF Generator nutzen !
Habe unter WinXP einen Drucker über Netzwerkverbindung eingerichtet mit Treiber vom "HP LaserJet 4L" und die Verbindung zum "PDF-Generator" wird als "Bereit" angezeigt !

Wenn ich aber ein Druckauftrag an den Drucker schicke Passiet NIX ....(kein Fehler,kein hinwies ...)

Was hab ich falsch gemacht ???

Ach .. User u. Password sind gesetzt und sind I.O.

=====smb.conf===== auszug=======

[pdfgenerator]
comment = PDF Generator (only valid users)
print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m %I &
printable = yes
path = /var/tmp

[pdfscreen]
comment = PDF Generator - Screen quality (only valid users)
print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m %I "" %S &
path = /pdf
copy = pdf-generator

[pdfprinter]
comment = PDF Generator - Print quality (only valid users)
print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m %I "" %S &
path = /pdf
copy = pdf-generator

[pdfprepress]
comment = PDF Generator - PrePress quality (only valid users)
print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m %I "" %S &
path = /pdf
copy = pdf-generator
==============



Danke schon mal im Vorraus.....
(Antwort BITTE in Deutsch)

aheinhold
01.12.03, 22:41
Hallo,

ich hab sowas am laufen. Man benötigt eigentlich nur einen Samba-Drucker der mit einem PS-Druckertreiber läuft. Ich würde mir da einfach einen passenden Farblaser aussuchen (mit PS).

Der Print-Command ist dann (wie bei Dir) ein Script, das PS-Dateien in PDF's umwandeln kann.

Von daher hast du eigentlich alles richtig gemacht!!

Kannst du mal das Script posten? Vielleicht liegt da ja der Fehler?!?!

Manta
01.12.03, 22:55
Hallo aheinhold

Script das ist genau das Orginal von Mandrake 9.2 ....

habs mal angehängt !


aber welchen Druckertreiber also "Drucker" ist zuempfehlen?
was heist "Farblaser mit PS" ??

und wo legt der(linuxrechner) dieses PDF-Doc dann ab ???
ich hätte es gerne in z.b. "/pdf" wie geb ich das an ???



gruss Manta

aheinhold
01.12.03, 23:03
Hallo Manta,

also unter Linux gibts recht schöne tools wie z. B. ps2pdf, die genau das machen, was du eigentlich möchtest!

Du hast in deinem Samba Drucker eingerichtet, das ist soweit schon sehr gut!
Wenn du den SMB-Drucker unter Windows einrichtest, welchen Treiber verwendest du dann?

P.S. Hast du vergessen, das Script anzuhängen?

Manta
02.12.03, 17:49
Hallo,
also der Treiber auf WindowsXP ist "HP Color LaserJet PS".

was evt sein könnte im Script steht :
# Source config file if it exists:
CONFFILE=/etc/samba/print-pdf.conf
^^^^^^^^^^^^^^^^ aber diese Datei gibts nicht auf meinem System!

Wie geb ich das ausgabe Verzeichnis eigentlich an??


grus Manta


und des komplette Script

============ANFANG======
#!/bin/bash
# samba-print-pdf
# This is a script which allows you to set up a virtual printer on samba
# which will take the file (generated by a postscript filter on windows)
# and turn it into a PDF, informing the user of where it is when it
# is done
#
# (c) Buchan Milne <bgmilne@cae.co.za> 2002
# License: GPLv2
# Changelog
# v0.0.6 20030428
# - Allow options passed as env. variables from print command
# - Inline and simplify sed (use tr) clean script
# - Ensure file arrives in PREFIX even if TEMP is used without provided name
# - Changes from Joshua M. Schmidlkofer <joshua@imr-net.com> 20030425
# - Debugging, adjustments, and corrections.
# - Stupid sed sanitizing script. [probably horribly inefficient also].
# - Temp file usage cleanup.
# v0.0.5 20020723
# - Add support for preset settings
# - Allow passing of filename provided by client as final filename
#
# Arguments:
# $1 = file (usually passed with %s from samba)
# $2 = unix prefix to where to place the file (~%u should work)
# $3 = windows prefix to the same location (//%L/%u should work)
# $4 = user/computer to send a notification to (%u or %m)
# $5 = IP address of client (%I)
# $6 = Name of destination file without extension (%J)
# $7 = PDF setting (prepress,print,screen etc)
#
# If you want to customise any of the following configuration defaults,
# you can place them in the file /etc/samba/print-pdf.conf.
# If you need to modify anything in this script, please provide me with your
# changes, preferably in such a way that the changes are configurable.

PS2PDF=ps2pdf13
OPTIONS="-dAutoFilterColorImages=false -sColorImageFilter=FlateEncode"
#Values taken from arguments:
INPUT=$1
PREFIX="$2"
WINBASE=$(echo "$3"|sed -e 's,/,\\\\,g')
#NAME=`echo "$6"|sed -e 's/[&/:{}\\\[<>$#@*^!?=|]/-/g;s/\]/-/g'`
NAME=`echo "$6"|tr '[:punct:]' '[-*]'`

# Source config file if it exists:
CONFFILE=/etc/samba/print-pdf.conf
[ -e $CONFFILE ] && . $CONFFILE

#Values not taken as arguments, could be set via env. vars (?) or config file
KEEP_PS=${KEEP_PS=0}
PERMS=${PERMS=640}
BASEFILE=${BASEFILE=pdf-service}
TEMP="${TEMP=$2}"
UMASK=${UMASK=006}

#Make sure that destination directory exists
mkdir -p "$PREFIX"

INFILE=$(basename $INPUT)

umask $UMASK

[ -n "$NAME" ] && TEMP="$PREFIX"

#make a temp file to use for the output of the PDF
OUTPUT=`mktemp -q $TEMP/$BASEFILE-XXXXXX`
if [ $? -ne 0 ]; then
echo "$0: Can't create temp file $TEMP/$OUTPUT, exiting..."
exit 1
fi
if [ -n "$NAME" ]; then
FINALOUTPUT="$PREFIX/$NAME"
else
FINALOUTPUT="$OUTPUT"
fi
if [ -n "$7" ]; then
OPTIONS="$OPTIONS -dPDFSETTINGS=/${7#pdf-}"
else
OPTIONS="$OPTIONS -dPDFSETTINGS=/default"
fi

WIN_OUTPUT="$WINBASE\\"`basename "$FINALOUTPUT"`
#mv "$INPUT" "$INPUT.ps";INPUT="$INPUT.ps"

# create the pdf
$PS2PDF $OPTIONS "$INPUT" "$OUTPUT.pdf" >/dev/null 2>&1
mv -f "${OUTPUT}.pdf" "${FINALOUTPUT}".pdf

# Generate a message to send to the user, and deal with the original file:
MESSAGE=$(echo "Your PDF file has been created as $WIN_OUTPUT.pdf\n")


# Cleanup
if [ $KEEP_PS != 0 ];then
mv -f $INPUT "${FINALOUTPUT}".ps
MESSAGE=$(echo "$MESSAGE and your postscript file as $WIN_OUTPUT.ps")
# Fix permissions on the generated files
chmod $PERMS "${FINALOUTPUT}".ps "${FINALOUTPUT}".pdf
else
rm -f $INPUT
# Fix permissions on the generated files
chmod $PERMS "${FINALOUTPUT}".pdf
fi

#Remove empty file from mktemp:
rm -f $OUTPUT

# Send notification to user
echo -e $MESSAGE|smbclient -M $4 -I $5 -U "PDF Genera
=============ENDE===============

aheinhold
04.12.03, 23:44
Hallo MANTA,

der Druckertreiber unter Windows ist grundsätzlich OK. Du musst dabei nur wissen, dass mit einem Monochrom PS-Treiber nur Schwarz-Weiss PDF's erzeugt werden können. Deshalb der Tipp: Such dir unter Windows einen Treiber von einem Color Laser Jet PS aus. Dann können auch farbige PDF's erzeugt werden.

Nun zum Script:

Sieht echt interessant aus. Da der Schreiber des Scripts jedoch mit seeehr vielen Variablen arbeitet kann ich dir auf anhieb nicht sagen, wo die PDF-Dateien abgelegt werden. Ich werd mir das Coding am Wochenende nochmal genauer geben; dann kann ich dir (hoffentlich) auch sagen, wo die PDF-Datei abgelegt wird.

aheinhold
05.01.04, 09:28
Hallo Manta,

ich habe in meiner smb.conf einen Drucker angelegt:

[pdf_printer]
comment = PDF-Drucker
path = /home/pdf/%U
printable = yes
print command = /usr/local/bin/pdfmaker.sh %s


Dann hinterlegst du wie oben besprochen einen Color-LaserJet Postscript Treiber für diesen Drucker (unter Windows).

Dann wird natürlich noch das Script benötigt, welches unter print command angegeben ist. Das sieht bei mir ganz einfach so aus:

pdfmaker.sh

#!/bin/sh
file_id=`date +%Y%m%d_%H%M%S`
ps2pdf $1 ${file_id}.pdf
rm -f $1

Das Script kopierst du nach /usr/local/bin, machst es ausführbar (chmod 755 ...).
Dann erstellst du noch den genannten Ordner in /home (z. B. /home/pdf/<username> und gibst dem entsprechenden User Berechtigungen für diesen Ordner. Das kannst du natürlich auch alles so anpassen, wie du möchtest. Ich hoffe, ich konnte dir damit helfen!

Manta
07.01.04, 20:01
Hallo zusammen,

is doch ganz einfach mit dem Orginal Skrip von Mandrake 9.2

es hätte anscheinend nur "postscript = yes" eintragen müssen !

meine smb.conf sieht jetzt so aus

-----
# Samba config file created using SWAT
# from 0.0.0.0 (0.0.0.0)
# Date: 2003/12/06 11:36:43

# Global parameters
[global]
encrypt passwords = Yes
max log size = 50
dns proxy = No
force directory mode = 0777
directory mask = 0777
printing = cups
force directory security mode = 0777
netbios name = servername
log file = /var/log/samba/log.%m
workgroup = Arbeitsgruppe
map to guest = Bad User
server string = Samba Server %v
character set = ISO8859-15
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
load printers = yes
create mask = 0777

[homes]
comment = Home Directories
read only = No
browseable = No

[printers]
comment = All Printers
browseable = no
valid users = @users
path = /var/spool/samba
print command = lpr-cups -P %p -o raw %s -r # using client side printer drivers.
printable = yes
create mask = 0700
public = yes

[print$]
path = /var/lib/samba/printers
write list = @users
guest ok = Yes

[pdfgenerator]
printable = yes
comment = PDF Generator (only valid users)
revalidate = yes
path = /var/tmp
postscript = yes
print command = /usr/share/samba/scripts/print-pdf %s ~%u //%L/%u %m %I &


-----
und nun gehts.

die PDF-datei ist dann unter /home/(user)

gruss Manta


PS: vielen dank noch mal an aheinhold

Tiroler
26.02.04, 17:23
Als Ergänzung:
Bei mir wurde ebenfalls keine pdf's erzeugt... nachdem ich die smb.conf komplett verglichen hatte... und nach unzähligen Versuchen konnte ich folgende Zeile als Übeltäter ausmachen:
printcap name = cups

Auskommentiert bzw. gelöscht und siehe da, es funktioniert :)

Vielleicht kann mir ja jemand erklären, für was die printcap Funktion eigentlich ist(?)


Achja, Thema fixer Pfad:
im Mandrake Script:
# create the pdf
$PS2PDF $OPTIONS "$INPUT" "$OUTPUT.pdf" >/dev/null 2>&1
mv -f "${OUTPUT}.pdf" "${FINALOUTPUT}".pdf

einfach
mv -f "${OUTPUT}.pdf" /home/pdf/"$INPUT".pdf

schreiben und die pdf's werden unter home/pdf abgelegt. (die MESSAGE Funktion sollte formhalber ebenfalls entsprechend geändert werden)

Meine Frage jetzt noch an die Spezialisten:
Kann ich den Windows Dateinamen (bsp. Doku.doc) irgendwie rausfinden... damit die erzeugte Datei einen sinnvollen Dateinamen erhält(?)

Danke & viele Grüße,
der Tiroler