<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org">
    <title>Printing to a SMB (MicroSoft) Printer</title>
    <meta name="GENERATOR" content=
    "Modular DocBook HTML Stylesheet Version 1.7">
    <link rel="HOME" title=" LPRng Reference Manual" href=
    "index.htm">
    <link rel="UP" title="Printer Communication and Protocols "
    href="printercomm.htm">
    <link rel="PREVIOUS" title=
    "Problems With Network Print Servers" href="x5207.htm">
    <link rel="NEXT" title="Printing to AppleTalk Printers" href=
    "x5252.htm">
  </head>

  <body class="SECT1" bgcolor="#FFFFFF" text="#000000" link=
  "#0000FF" vlink="#840084" alink="#0000FF">
    <div class="NAVHEADER">
      <table summary="Header navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <th colspan="3" align="center">LPRng Reference Manual: 24
          Sep 2004 (For LPRng-3.8.28)</th>
        </tr>

        <tr>
          <td width="10%" align="left" valign="bottom"><a href=
          "x5207.htm" accesskey="P">Prev</a></td>

          <td width="80%" align="center" valign="bottom">Chapter
          11. Printer Communication and Protocols</td>

          <td width="10%" align="right" valign="bottom"><a href=
          "x5252.htm" accesskey="N">Next</a></td>
        </tr>
      </table>
      <hr align="LEFT" width="100%">
    </div>

    <div class="SECT1">
      <h1 class="SECT1"><a name="AEN5238">11.9. Printing to a SMB
      (MicroSoft) Printer</a></h1>

      <p>Microsoft use the SMB (Simple Message Block) protocol to
      transfer files and print jobs to hosts and printers. SMB can
      be used over TCP/IP, NetBEUI, IPX, and other lower level
      network protocols.</p>

      <p>Unfortunately, most printers do not provide detailed
      status or error reports when using the SMB protocol. There
      are a very large number of printers that have deficient SMB
      support that causes problems when used in a high traffic or
      high throughput environment.</p>

      <p>It is highly recommended that this protocol not be used
      unless there is no alternative.</p>

      <p>If you have a printer or a remote print spooler that
      supports SMB You can use the <a href="smb.htm">SAMBA</a> <b
      class="APPLICATION">smbclient</b> program to send a print job
      to an SMB client. The following is a sample Shell Script
      script which you can use:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN5246"></a>
<pre class="SCREEN">
    #!/bin/sh -x
    # This script is an input filter for printing on a unix machine. It
    # uses the smbclient program to print the file to the specified smb-based
    # server and service.
    # The 'smb' printcap entry below shows how to configure LPRng
    # for printing
    #
    # smb:
    #  :lp=|/usr/local/samba/smbprint
    #  :sd=/var/spool/smb:
    #  :filter= ... filter ...
    #
    # The /var/spool/smb/.config file should contain:
    #   server="PC_SERVER"
    #   service="PR_SHARENAME"
    #   password="PASSWORD"
    #
    # Set PC_SERVER to the server, PR_SHARENAME to the printer,
    # and PASSWORD to the password for this service.
    #
    # E.g.
    #   server=PAULS_PC
    #   service=CJET_371
    #   password=""
    #
    #
    config_file=.config
    if [ -f $config_file ] ; then
        eval `/bin/cat $config_file`
    fi
    #
    # NOTE You may wish to add the line `echo translate'
    # if you want automatic
    # CR/LF translation when printing.
    (
    #   echo translate
        echo "print -"
        /bin/cat
    ) | /usr/local/bin/smbclient "\\\\$server\\$service" \
       "$password" -U "$server" -N -P 1&gt;&amp;2
</pre>
      </div>
      <br>
      <br>

      <p>If the above script was in <tt class=
      "FILENAME">/usr/local/libexec/filters/smbprint</tt>, the
      printcap entry for this printer would be:</p>

      <div class="INFORMALEXAMPLE">
        <a name="AEN5250"></a>
<pre class="SCREEN">
    pauls_pc:
      :sd=/var/spool/lpd/%P
      # we filter the output
      :lp=|/usr/local/libexec/filters/smbprint
      # you can add filters if you want to do specific actions
      :ifhp=model=hp4
      :filter=/usr/local/libexec/filters/ifhp
</pre>
      </div>
      <br>
      <br>
    </div>

    <div class="NAVFOOTER">
      <hr align="LEFT" width="100%">

      <table summary="Footer navigation table" width="100%" border=
      "0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="33%" align="left" valign="top"><a href=
          "x5207.htm" accesskey="P">Prev</a></td>

          <td width="34%" align="center" valign="top"><a href=
          "index.htm" accesskey="H">Home</a></td>

          <td width="33%" align="right" valign="top"><a href=
          "x5252.htm" accesskey="N">Next</a></td>
        </tr>

        <tr>
          <td width="33%" align="left" valign="top">Problems With
          Network Print Servers</td>

          <td width="34%" align="center" valign="top"><a href=
          "printercomm.htm" accesskey="U">Up</a></td>

          <td width="33%" align="right" valign="top">Printing to
          AppleTalk Printers</td>
        </tr>
      </table>
    </div>
  </body>
</html>



syntax highlighted by Code2HTML, v. 0.9.1