Strona 1 z 1

Serwer druku do pdf

: 01 marca 2015, 21:50
autor: d@p
Witam,
Na wstępie chciałbym przeprosić jeśli podobny temat już istnieje. Przekopałem masę stron i nie trafiłem jeszcze na odpowiedź.

Mój problem wygląda następująco. Oprogramowanie na którym pracuję (jako klient, nie mam możliwości edycji żadnych parametrów programu) potrzebuję drukarki wirtualnej, która będzie drukowała do pliku w formacie pdf lub innym, najlepiej na maszynie wirtualnej. Problem jest na tyle skomplikowany, przynajmniej wg mnie :) , że we wspomnianym programie do wydruków ustawiony jest na stałe adres IP drukarki sieciowej, która mieli papier na darmo, stąd potrzeba skonfigurowania drukarki drukującej do pliku.

Początkowo myślałem że na komputerze, który obsługuje program zainstaluje maszynę wirtualną z debianem, przypisze adres IP zgodny z tym, jaki jest przypisany w programie. Niestety moja wiedza na temat tego systemu mocno się zatarła więc będę otwarty na wszelkie sugestie. Rozumiem że muszę mieć skonfigurowaną drukarkę cups-pdf i sambę do udostępniania. To też zrobiłem, myślę że poprawnie, pozostaje kwestia dostania się do drukarki po adresie IP.

A może ktoś z Was ma inne rozwiązanie, niekoniecznie w kierunku mojego pierwotnego pomysłu.

smb.conf
http://wklej.org/id/1652223/txt/

cups-pdf
http://wklej.org/id/1652228/txt/

Klient skonfigurowany jest do drukowania na takim adresie:
socket://10.85.68.13:9100

: 02 marca 2015, 13:40
autor: dedito
Te konfiguracje daj tu na forum w znaczniki code.
Co to za magiczny program ma na sztywno ustawioną drukarkę?

: 02 marca 2015, 14:17
autor: pawkrol
Wydaje mi się że może być z tym problem.
1. Drukarka ma własne ip, więc jak przypiszesz ten sam adres do serwera bo zrobisz konflikt.
2. Komunikacja z drukarką pewnie Jetdirect - następny problem. Cups inaczej udostępnia.

Czemu nie możesz zmienić drukarki w programie ? Brak uprawnień ?

: 02 marca 2015, 15:41
autor: d@p
1. Drukarka, do której do tej pory drukuje może być odpięta, mam do niej dostęp.
2. Tak

W programie nie mogę zmieniać nic. Mam tylko obsługę od strony klienta. Brak uprawnień do jakiejkolwiek edycji.

Kod: Zaznacz cały


[global] netbios name = wcsprinter server string = Samba file and print server workgroup = Workgroup security = user hosts allow = 127. 192.168.0. interfaces = eth0 127.0.0.1/8 192.168.0.0/24 bind interfaces only = yes remote announce = 192.168.0.255 remote browse sync = 192.168.0.255 printcap name = printcap load printers = yes cups options = raw printing = cups printcap name = cups guest account = smbguest log file = /var/log/samba/samba.log max log size = 1000 null passwords = no username level = 6 password level = 6 encrypt passwords = yes unix password sync = yes socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 local master = no domain master = no preferred master = no domain logons = no os level = 33 logon drive = m: logon home = \\%L\homes\%u logon path = \\%L\profiles\%u logon script = %G.bat time server = no name resolve order = wins lmhosts bcast wins support = no wins proxy = no dns proxy = no preserve case = yes short preserve case = yes client use spnego = no client signing = no client schannel = no server signing = no server schannel = no nt pipe support = yes nt status support = yes allow trusted domains = no obey pam restrictions = yes enable spoolss = yes client plaintext auth = no disable netbios = no follow symlinks = no update encrypted = yes pam password change = no passwd chat timeout = 120 hostname lookups = no username map = /etc/samba/smbusers passdb backend = tdbsam passwd program = /usr/bin/passwd '%u' passwd chat = *New*password* %n\n *ReType*new*password* %n\n *passwd*changed*\n add user script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null '%u' add user to group script = /usr/sbin/useradd -d /dev/null -c 'Samba User Account' -s /dev/null -g '%g' '%u' add group script = /usr/sbin/groupadd '%g' delete user script = /usr/sbin/userdel '%u' delete user from group script = /usr/sbin/userdel '%u' '%g' delete group script = /usr/sbin/groupdel '%g' add machine script = /usr/sbin/useradd -d /dev/null -g sambamachines -c 'Samba Machine Account' -s /dev/null -M '%u' machine password timeout = 120 idmap uid = 16777216-33554431 idmap gid = 16777216-33554431 template shell = /dev/null winbind use default domain = yes winbind separator = @ winbind cache time = 360 winbind trusted domains only = yes winbind nested groups = no winbind nss info = no winbind refresh tickets = no winbind offline logon = no  [homes] comment = Home Directories path = /home read only = no available = yes browseable = yes writable = yes guest ok = no public = no printable = no locking = no strict locking = no  [netlogon] comment = Network Logon Service path = /home/netlogon read only = no available = yes browseable = yes writable = no guest ok = no public = no printable = no locking = no strict locking = no  [profiles] comment = User Profiles path = /var/samba/profiles read only = no available = yes browseable = no writable = yes guest ok = no public = no printable = no create mode = 0600 directory mask = 0700 locking = no strict locking = no  [printers] comment = All Printers path = /var/spool/samba browseable = yes writable = no guest ok = yes public = yes printable = yes locking = no strict locking = no printer name = CUPS printer admin = pgf  [pdf-documents] path = /home/pdf-documents comment = Converted PDF Documents available = yes browseable = yes writeable = yes guest ok = yes locking = no strict locking = no  [pdf-printer] path = /tmp comment = PDF Printer Service printable = yes guest ok = yes use client driver = yes printing = bsd print command = /usr/bin/gadmin-samba-pdf %s %u lpq command = lprm command =  

Kod: Zaznacz cały

#  cups-pdf.conf -- CUPS Backend Configuration (version 2.6.1, 2011-10-04) #  18.09.2005, Volker C. Behr #  Experimentelle Physik V, Universitaet Wuerzburg #  behr@physik.uni-wuerzburg.de #  http://www.cups-pdf.de # # #  This code may be freely distributed as long as this header #  is preserved. Changes to the code should be clearly indicated. # #  This code is distributed under the GPL. #  (http://www.gnu.org/copyleft/gpl.html) # #  For more detailed licensing information see cups-pdf.c in the #  corresponding version number.              ########################################################################### #                                      # # This is the configuration file for CUPS-PDF. Values that are not set in # # here will use the defaults. Changes take effect immediately without the # # need for restarting any services.                      # #                                      # # Take care not to add whitespaces at the end of a line!          # #                                      # ###########################################################################   ########################################################################### #                                      # # Path Settings                                  # #                                      # ###########################################################################  ### Key: Out ##  CUPS-PDF output directory ##  special qualifiers: ##     ${HOME} will be expanded to the user's home directory ##     ${USER} will be expanded to the user name ##  in case it is an NFS export make sure it is exported without ##  root_squash! ### Default: /var/spool/cups-pdf/${USER}  Out ${HOME}/PDF  ### Key: AnonDirName ##  ABSOLUTE path for anonymously created PDF files ##  if anonymous access is disabled this setting has no effect ### Default: /var/spool/cups-pdf/ANONYMOUS  #AnonDirName /var/spool/cups-pdf/ANONYMOUS  ### Key: Spool ##  CUPS-PDF spool directory - make sure there is no user 'SPOOL' on your ##  system or change the path     ### Default: /var/spool/cups-pdf/SPOOL  #Spool /var/spool/cups-pdf/SPOOL   ########################################################################### #                                      # # Filename Settings                              # #                                      # ###########################################################################  ### Key: Truncate ##  truncate long filenames to a maximum of <Truncate> characters ##  this does not consider the full path to the output but only the filename ##  without the .pdf-extension or a job-id prefix (see 'Label') ##  the minimal value is 8 ### Default: 64  #Truncate 64  ### Key: Cut ##  removing file name extensions before appending .pdf to output ##  extensions will only be removed if _both_ the following criteria are met: ##   - the extension (w/o the dot) is not longer than <Cut> characters ##   - the remaining filename has a minimal length of 1 character ##  set Cut to -1 in order to disable cutting ##  recommended values: pure UNIX environment : -1 ##                      mixed environments    :  3 ### Default: 3  #Cut 3  ### Key: Label ##  label all jobs with a unique job-id in order to avoid overwriting old ##  files in case new ones with identical names are created; always true for ##  untitled documents ##  0: label untitled documents only ##  1: label all documents with a preceeding "job_#-" ##  2: label all documents with a tailing "-job_#" ### Default: 0  #Label 0  ### Key: TitlePref ##  where to look first for a title when creating the output filename ##  (title in PS file or title on commandline): ##  0: prefer title from %Title statement in the PS file ##  1: prefer title passed via commandline ### Default: 0  #TitlePref 0   ########################################################################### #                                      # # User Settings                                  # #                                      # ###########################################################################  ### Key: AnonUser ##  uid for anonymous PDF creation (this might be a security issue) ##  this setting has no influence on AnonDirName (see there) ##  set this to an empty value to disable anonymous ### Default: nobody  #AnonUser nobody  ### Key: LowerCase ##  This options allows to check user names given to CUPS-PDF additionally ##  against their lower case variants. This is necessary since in some ##  Windows environments only upper case user names are passed. Usually UNIX ##  user names are all lower case and it is save to use this option ##  but be aware that it can lead to mis-identifications in case ##  you have user names that differ only in upper/lower case. ##     check only against user name as passed to CUPS  : 0 ##     check additionally against lower case user name : 1 ### Default: 1  #LowerCase 1  ### Key: UserPrefix ##  some installations require a domain prefix added to the user name ##  leave empty for no prefix ### Default: <empty>  #UserPrefix  ### Key: DirPrefix ##  if a prefix was defined above this switch toggels whether to include ##  the prefix in the output directory's name (if not $HOME) or not ##  0: do not include, 1: include ### Default: 0  #DirPrefix 0  ### Key: RemovePrefix ##  some installation pass usernames with a prefix (usually a domain name) ##  if you do not want this prefix to be used by the ${USER} variable for ##  output directories put the part which is to be cut here ### Default: <empty>  #RemovePrefix   ########################################################################### #                                      # # Security Settings                              # #                                      # ###########################################################################  ### Key: AnonUMask ##  umask for anonymous output ##  these are the _inverse_ permissions to be granted ### Default: 0000  #AnonUMask 0000  ### Key: UserUMask ##  umask for user output of known users ##  changing this can introduce security leaks if confidential ##  information is processed! ### Default: 0077  #UserUMask 0077  ### Key: Grp ##  group cups-pdf is supposed to run as - this will also be the gid for all ##  created directories and log files ### Default: lp  Grp lpadmin   ########################################################################### #                                      # # Log Settings                                  # #                                      # ###########################################################################  ### Key: Log ##  CUPS-PDF log directory ##  set this to an empty value to disable all logging ### Default: /var/log/cups  #Log /var/log/cups  ### Key: LogType ##  log-mode ##  1: errors ##  2: status (i.e. activity) ##  4: debug - this will generate a lot of log-output! ##  add up values to combine options, i.e. 7 is full logging ##  if logging is disabled these setting have no effect ### Default: 3  #LogType 3   ########################################################################### #                                      # # PDF Conversion Settings                          # #                                      # ###########################################################################  ### Key: GhostScript ##  location of GhostScript binary (gs) ##  MacOSX: for using pstopdf (recommended) set this to /usr/bin/pstopdf ##          or its proper location on your system ### Default: /usr/bin/gs  #GhostScript /usr/bin/gs  ### Key: GSTmp ##  location of temporary files during GhostScript operation ##  this must be user-writable like /var/tmp or /tmp ! ### Default: /var/tmp  #GSTmp /var/tmp  ### Key: GSCall ## command line for calling GhostScript (!!! DO NOT USE NEWLINES !!!) ## MacOSX: for using pstopdf set this to %s %s -o %s %s ### Default: %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s  #GSCall %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s  ### Key: PDFVer ##  PDF version to be created - can be "1.5", "1.4", "1.3" or "1.2" ##  MacOSX: for using pstopdf set this to an empty value ### Default: 1.4  #PDFVer 1.4  ### Key: PostProcessing ##  postprocessing script that will be called after the creation of the PDF ##  as arguments the filename of the PDF, the username as determined by ##  CUPS-PDF and the one as given to CUPS-PDF will be passed ##  the script will be called with user privileges ##  set this to an empty value to use no postprocessing ### Default: <empty>  #PostProcessing   ########################################################################### #                                                                         # # Experimental Settings                                                   # #   These settings activate experimental options. If you decide to use    # #   them I would appreciate any feedback - including an 'ok' if they      # #   work as expected - so I can eventually put them into the non-         # #   experimental sections.                          # #                                                                         # ###########################################################################  ### Key: DecodeHexStrings ##  this option will try to decode hex strings in the title to allow ##  internationalized titles ##  (have a look at contrib/pstitleconv for a suitable filter for data ##   from Windows clients) ##  0: disable, 1: enable ### Default: 0  DecodeHexStrings 1  ### Key: FixNewlines ##  this option will try to fix various unusal line delimiters (e.g. ##  form feeds) ##  especially useful when using non-Linux-generated files ##  0: disable, 1: enable ### Default: 0  #FixNewlines 0 

: 02 marca 2015, 20:33
autor: pawkrol
W takim razie nie wiem czy to ci w ogóle wyjdzie:
Cups udostępnia drukarkę w ten sposób:

Kod: Zaznacz cały

http://adres_ip:631/printers/PDF
Dodatkowo jeśli zaprzęgniesz sambę

Kod: Zaznacz cały

smb://adres_ip/PDF
Program natomiast wysyła bezpośrednio na adres ip.

: 02 marca 2015, 20:43
autor: d@p
Tego się obawiałem. Jakiś inny pomysł ?
Wstawienie np. routera z print serverem ? Da się tak ?

: 02 marca 2015, 22:50
autor: pawkrol
Nie jestem pewien, ale zerknij na ten link http://www.linuxforums.org/forum/networ ... erver.html

: 03 marca 2015, 22:06
autor: d@p
W pewnym sensie to rozwiązało mój problem.
Zgodnie z linkiem udało mi się ustawić CUPS nasłuchujące jak jetdirect. Pliki się zapisują, jednak coś jest z nimi nie tak, zapisuje się pusta strona, której właściwie nie można otworzyć (tu kwestia zmiany uprawnień do plików przy drukowaniu przez guesta).
Martwi mnie natomiast dlaczego wszystkie pliki są jednakowego rozmiaru mimo że drukuje różne dokumenty. Wydruki w tej chwili nie są mi do niczego potrzebne ale tak z czystej technicznej ciekawości chciałbym to zrobić do końca :)

Przykładowo chciałbym, mimo że nie korzystam z tych wydruków, mieć wgląd do danych z ostatniego miesiąca, więc drukując do katalogu na przykład /home/{user}/pdf/ dodalem skrypt do init.d który wyszukuje pliki starsze niż 30 dni i je usuwa.
To mam, ale wszystkie pliki, które się generują w tej chwili są nieczytelne i właściwie puste.

@pawkrol dziękuję za dotychczasową pomoc :)