Debian Linux Printing with Windows CIFS,SMB

--------------------------------------------------------------------------------

http://www.cups.org/
http://www.faqs.org/docs/Linux-mini/Debian-and-Windows-Shared-Printing.html

http://www.linuxprinting.org/download/PPD/
http://www.linuxprinting.org/printer_list.cgi
http://www.linuxprinting.org/show_printer.cgi?recnum=HP-DeskJet_6127
http://www.linuxprinting.org/show_printer.cgi?recnum=HP-PSC_1210

http://www.linuxprinting.org/cups-doc.html
http://www.linuxprinting.org/lpd-doc.html
http://www.linuxprinting.org/ppr-doc.html
http://www.linuxprinting.org/pdq-doc.html
http://www.linuxprinting.org/direct-doc.html

http://www.linuxquestions.org/linux/answers/Hardware/Troubleshooting_printing_problems_from_SuSE_10_0_to_HP_PSC1350_shared_from_Windows
http://citrixfaq.msterminalservices.org/faqs2.cfm?id=74&category=2%2C3&sortby=date

IPP - allows a Windows XP machine to use the CUPS printer very, very easily
(just remember to add the port number :631 behind the printer queue name on
XP). Remove the comment marker in front of the octet stream handling in
/etc/cups/mime.types and (the other mime.* file in the same directory), and
everything just works.

--------------------------------------------------------------------------------

CUPS server:
	apt-get install cupsys

CUPS BSD commands
	apt-get install cupsys-bsd

CUPS client programs
	apt-get install cupsys-client

LinuxPrinting.org printer support programs
	apt-get install foomatic-bin

Samba SMB/CIFS server for UNIX
	apt-get install samba

Samba SMB/CIFS client for UNIX
	apt-get install smbclient

ESP Ghostscript ( http://www.cups.org/ghostscript.php)
	apt-get install gs-esp

GNU A2PS ( http://www.gnu.org/software/a2ps/)
	apt-get install a2ps

The following commands will install these packages:
apt-get update
apt-get install cupsys cupsys-bsd cupsys-client foomatic-bin samba smbclient gs-esp a2ps

Additional packages may be required for specific printers. For example, the
hpijs package must be installed for HP InkJet printers to function properly.
	apt-get install hpijs

--------------------------------------------------------------------------------

Foomatic ppds ought to be in /usr/share/cups/model/foomatic-ppds and if they
aren't you might run into problems later, so read the foomatic documentation to
see what might have happened.

PPDs can be gzipped, so long as the file name ends with filename.ppd.gz.

--------------------------------------------------------------------------------

The lpadmin command is used to configure printers. The following is an example
of setting up a laser printer with CUPS:
	lpadmin -p Laser -v parallel:/dev/lp0 -P /root/laser.ppd
	/usr/bin/enable Laser
	accept Laser
	lpadmin -d Laser

	SMB Shared Printer:
	lpadmin -p Laser -v smb://srvname/lj4           -P /root/laser.ppd
	lpadmin -p Laser -v smb://guest@srvname/lj4     -P /root/laser.ppd
	lpadmin -p Laser -v smb://user:pass@srvname/lj4 -P /root/laser.ppd

The first command creates a new printer called "Laser" that is connected to the
first parallel port and is using the PPD file /root/laser.ppd. "Laser" is then
enabled and told to accept jobs with the enable and accept commands. The last
command sets "Laser" as the default printer. More detailed information about
printer configuration is available in the CUPS documentation.

You must type the full path (i.e. /usr/bin/enable) for these commands to work
properly. If you type enable printer then you will most likely get an error
that says: 
	-bash: enable: printer: not a shell builtin
Running enable by itself is a command that enables and disables builtin shell
commands. Since printer is not a shell builtin, an error is generated.

To start a print queue, run the following command:
	enable  printername
To stop a print queue, run the following command:
	disable printername

--------------------------------------------------------------------------------

CUPS uses the LPP Protocol. BSD style printing adds LPR protocol that will
submits LPR jobs to CUPS.

--------------------------------------------------------------------------------

Documents are spooled by using either lpr or lp followed by the file name.
You may view the printer queue and check the printer status with the command
lpstat -o or lpstat -p. To cancel a print job use either cancel or lprm followed
by the job id.

	lptstat -o
	lptstat -p
	cancel 
	lprm   

The CUPS spooler daemon is called cupsd. It converts documents to PostScript,
then converts them to a format native to the printer. Printers that do not
understand PostScript use a rasterized, or bitmap, format for documents.
Rasterized formats can be much larger than the original PostScript, and will
take longer to send to the printer.

If no filter suitable for converting your document is installed you will
receive an error similar to lpr: unable to print file:
client-error-document-format-not-supported.

You can verify the printer is ready with:
	lpq

To delete a printer:
	lpadmin -x printername

--------------------------------------------------------------------------------

SPCSYS Example:

lpadmin      -p hppsc -v smb://print:print@emerald/hp1200 -P /base/usr/ppd/hppsc1200.ppd
/usr/bin/enable hppsc
accept          hppsc
lpadmin -d      hppsc

Test the printer:
	lp filename.txt

Print to specific printer:
	lpr -P PrinterName

--------------------------------------------------------------------------------

Linux to Windows

The following is an example of creating a connection to a Windows PC:

----------------------------------------
smbclient -L rice -N

added interface ip=10.6.7.234 bcast=10.6.7.255 nmask=255.255.255.0
Got a positive name query response from 10.6.7.8 ( 10.6.7.8 )
Sharename  Type  Comment
PRINTER$   Disk
INKJET     Printer
STUFF      Disk
IPC$       IPC    Remote Inter Process Communication
----------------------------------------

If Windows naming service is unavailable you will need to specify the IP address
of the Windows PC with the -I switch as in: smbclient -I 10.6.7.8 -L rice -N

CUPS configuration

Once you have found a Windows printer you may configure CUPS. First verify that
your installation of CUPS has the smb backend with the following command:
	ls -l /usr/lib/cups/backend/smb

If this file does not exist create it by issuing the following:
	ln -s `which smbspool` /usr/lib/cups/backend/smb

The following is an example of setting up the printer shown above:
	lpadmin -p RicePrinter -v smb://rice/INKJET -P /root/inkjet.ppd
	enable RicePrinter
	accept RicePrinter
	lpadmin -d RicePrinter

If Windows naming service is unavailable, add the switch -h followed by the IP
address of the Windows PC to the first lpadmin command as in:
	lpadmin -p RicePrinter -h 10.6.7.8 -i smb://rice/inkjet-P /root/inkjet.ppd

Your printer is now ready to test. Send a file to the printer with the lp
command followed by a filename, or by printing a document from within an
application. 

--------------------------------------------------------------------------------

Windows to Linux

Samba uses nmbd and smbd daemons to share files and printers with Windows PCs.
nmbd acts as a Windows naming service, broadcasting your computer's name to
Windows PCs on the LAN. smbd accepts file and printer requests from Windows PCs

If you are allowing anonymous access to your printer you will need to create a
user account for remote print jobs:
	adduser --system --disabled-password smbprint

This command adds a user called "smbprint" to your system. Make sure there is
enough disk space in /home/smbprint, the "smbprint" user's home directory, to
spool files. Check that the "smbprint" user does not have permission on your
system to read or modify sensitive files and directories. If you have
configured CUPS to restrict printing to certain users on your system, you must
allow the "smbprint" user to access printers you want to share.

The Samba configuration file is /etc/samba/smb.conf. The following is an example
configuration file set up to use CUPS with the "smbprint" user:
	[global]
	  printcap name = cups
	  printing = cups
	  security = share
	[printers]
	  browseable = yes
	  printable = yes
	  public = yes
	  create mode = 0700
	  guest only = yes
	  guest account = smbprint
	  path = /home/smbprint

for additional security, add security = user or security = domain.

Once you have added the above settings to your Samba configuration file you
must restart Samba with the command:
	/etc/init.d/samba restart

CUPS Configuration

Windows printer drivers format their output for the printer before sending it
across the network. You must configure CUPS to accept the pre-formatted output
by uncommenting the following line from /etc/cups/mime.convs:
	application/octet-stream   application/vnd.cups-raw   0   -

Also uncomment the following line from /etc/cups/mime.types:
	application/octet-stream

Now CUPS must be told to allow connections from other machines on the network.
Add these lines to /etc/cups/cupsd.conf:
	
	  AuthType None
	  Order Deny,Allow
	  Deny From None
	  Allow From All
	

Finally, restart cups with the following command:
	/etc/init.d/cupsys restart

Troubleshooting:
http://www.faqs.org/docs/Linux-mini/Debian-and-Windows-Shared-Printing.html
#troubleshooting

--------------------------------------------------------------------------------

http://www.linuxquestions.org/linux/answers/Hardware/Troubleshooting_printing_problems_from_SuSE_10_0_to_HP_PSC1350_shared_from_Windows

Troubleshooting printing problems from SuSE 10.0 to HP PSC1350 shared from Windows
Written by munstah - 2006-02-26 12:37
 
This brain-dump may help to troubleshoot printing problems that may arise when printing to a shared Windows printer, but it will not explain how to set up a printer in the first place or how to connect to an smb printer. The network used here is set up as a workgroup.

Facts:

- SuSE Linux 10.0 2.6.13-15-default
- KDE release 3.4.2 level "b"
- Printer set up under CUPS 1.1.23 as "smb://IP-server/sharename" using hpijs1300
- Windows XP SP2 connected to a workgroup
- HP PSC1350 (Canadian version of PSC1300) shared as "hp1350" from Windos PC

Symptoms:

- Shared printer works perfectly fine when printed to from other Windows workstations.
- When printing from SuSE, the printer starts to react, but then stalls without printing a single line. The main LED blinks, print-jobs cannot be deleted under Windows. Turning the printer on and off does not solve the problem.
- No error messages in Windows. Printer shows job as "Remote Downlevel Document - printing-size (example!) 0.15kb/3.03MB"
- Print job cannot be deleted under Windows. To regain control of printer it has to be deleted, the PC has to be rebooted and the printer must be reconfigured

- The print-job also stalls under Linux, CUPS status reports "reconnecting to printer in 60 seconds" but no change in condition after several minutes wait-time.
- In contrast to Windows the print job can be paused and deleted.

- Trying different printer drivers in CUPS does not change the symptoms.
- Installing the printer using the description on instead of the native SuSE-KDE tools does not change the symptoms

- The printer works immediately when connected directly to the Linux box

Solution:

The problem seems to be caused by the way the HP driver monitors the printer port. An additional complication can be the fact that Macromedia Shockwave associates "spl"-files as shockwave player files.

This I found out step by step when trying to find a more effective way to regain
controll of the printer under Windows and with the help of the article on
http://citrixfaq.msterminalservices.org/faqs2.cfm?id=74&category=2%2C3&sortby=date

Attention:
- you must have local administrator rights on the PC to perform the changes
- better back up your Windows system before proceeding

Step 1: deleting the stuck print job under Windows:
- the spooler service must be stopped first
- navigate to systemfolder (eg C:\WINDOWS) \system32\spool\PRINTERS
-- two files will be shown there: xxxx.shd and xxxx.spl
-- see if the spl file is described as "Shockwave Splash file": if yes, the registry key must be removed, see Step 2
-- delete the two files, close the window

Step 2: this step is only required if the spl-file is set to open with Shockwave (see above)
- run regedit and navigate to "HK classes root - .spl"
- highlight this folder and delete it

STEP 3:
- if it's not already open run regedit now:
- navigate to: "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows NT x86\Drivers\Version-3\hp psc 1300 series"
-- Note: the number in "Version-" may be different on your system!
- right click the key and select "Export" to back it up to a location of your choice
- look for the "Monitor"-key on the right hand side, double-click it, note down the value (most likely "hpzsnt10") and delete it
- double-click the "Dependent Files"-key and delete the line that reads "hpzsnt10.dll"
- exit the registry editor
- in Windows Explorer navigate to the equivalenty of "C:\WINDOWS\system32\spool\drivers\w32x86\hppsc_1300_series7216" and rename "hpzsnt10.dll" to "hpzsnt10.dl~"
- do the same for "C:\WINDOWS\system32\spool\drivers\w32x86\3"
- start the spooler service again

The printer now should react promptly to jobs sent from SuSE.