Last Edited: 01 May 2008 by superuser
fixed some typos and set the
Contents
   How to Print From Linux to Any Printer Attached to a Windows Machine.
      Introduction
      Reading
      Requirements
         Windows
         Puppy Linux
      Steps
         Windows
      Puppy
      Testing
   Problems
   Feedback

How to Print From Linux to Any Printer Attached to a Windows Machine.

Introduction

This process is fidly to setup and most of the work is on windows, I used XP. Whilst experimenting I succeeded in jamming my print spooler with rubbish lots of times. To clear this, as well as canceling print jobs you may need to restart the spooler run "services.msc" or even reboot the machine.

The basic theory is create a printing system on windows that understands standard postscript. Printing on puppy goes through CUPS to smbspool which passes the print job on to a windows shared virtual printer created using Redmon. The shared virtual printer takes standard postscript and passes it on to the Ghostscript program gsprint.exe which then prints the file to whichever windows printer you specify in the gsprint configuration file.

Reading

This is where I learnt about how to do this.

http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html
http://www.truist.com/blog/536/recipe-for-printing-from-linuxunixbsd-to-windows
http://mywebpages.comcast.net/heretrythis/hp3100/psemuxp.html

Requirements

Windows

Ghostscript - postscript interpreter

GSView - postscript viewer and printer
This is used to convert standard postscript into whatever format your windows printer needs it in.

Redmon
Redmon is a printer redirection program. It listens on a windows printer port and redirects anything printed to it.

A working printer with drivers to allow printing from windows

Puppy Linux

CUPS the Common Unix Printing System

smbspool, a printer spooler to allow printing to a windows print share

Steps

Windows

1) download the windows software
http://pages.cs.wisc.edu/~ghost/
Ghostscript
either GPL
http://pages.cs.wisc.edu/~ghost/doc/GPL/gpl856.htm
or AFPL (1 version in front of the GPL version)
http://pages.cs.wisc.edu/~ghost/doc/AFPL/index.htm
GSView
http://pages.cs.wisc.edu/~ghost/gsview/get48.htm
Redmon
http://pages.cs.wisc.edu/~ghost/redmon/index.htm

2) Install Ghostscript and GSView an ensure that you can view and print one of the sample postcript .ps files included

3) Find the directory containing the program gsprint.exe and create a text file called gsprint.cfg and put something like this into it:

  • noquery
  • color (optional - omit for B&W printers)
  • printer
    My Windows Printer
  • ghostscript
    "C:\GS\GS8.14\BIN\GSWIN32C.EXE"

...where "My Windows Printer" is the name of your printer EXACTLY as it appears in Control Panel... Printers, and "C:\GS\GS8.14\BIN\GSWIN32C.EXE" is the exact path and filename of the command-line executable for Ghostscript (your values for these two may be different - enter the correct values for your PC). Save this file, then run the following command:

gsprint somepsfile.ps ( you may need to specify paths for these)

4) Install Redmon

5) Create new redirected printer
add printer
Next
local printer attached to this computer (Automatically detect, unchecked)
create a new port: redirected port
Next
port name: RPT1:
OK
Manufacturer: Apple
Printers: Apple Color LW 12/660 PS(allegedly the choice here is not critical as long as the printer understands standard postcript but I did try a number of combinations that failed)
Printer Name: MyPSPrinter
Default: No
Next
Share Name: MyNetPrinter
Next
Location: anything you like
Comment: as above
Do you want to print a test page: No

6) At the moment this printer doesn't do anything sensible with its output, we need to pipe the output into gsprint
Open the properties for MyPSPrinter
Goto the ports tab and configure RPT1
Redirect this port to the program: this needs the full path to gsprint.exe on your machine
Arguments for this program:"-" (just a hyphen, no quotes)
Output: Program handles output
Run As User: unchecked
You may want to configure a log file as well
Now try testing MyPSPrinter by printing a test page
It is probably easiest to set the printer sharing to allow anyone to print to it. I did my setup on a private LAN so I wasn't concerned about security

Puppy

1) download and install smbspool
http://www.murga-linux.com/puppy/viewtopic.php?p=75624&sid=13ddfd6668ab650db2dfdc21a7d2ec83#75624
move smbspool to /usr/bin/smbspool (this location is important as CUPS will install a symlink to it)
2) download and install CUPS
http://dotpups.de/dotpups/Printing/cups-install-v0.3.pup
install the CUPS dotpup
3) Configure CUPS
point your browser at http://localhost:631∞ and add a new printer, you will need to give:
name: you choose, no spaces
device: windows printer via SAMBA
URI: smb://windows-computer-name-or-IP-address/MyNetPrinter <--this should be the IP address, or the exact name of the computer as shown in LinNeighborhood, and the exact name of the printer.
Make: RAW
Model: RAW Queue

Testing

Now try printing a test page from the CUPS printer page
Ignore the flood of samba error messages, watch the printer queues on the windows machine.
Remember this is quite slow so give it several minutes to work before you start changing settings.
To prove you can print from an application I found seamonkey offered the least confusing options.

Problems

When I was using the wrong CUPS driver the print job would appear on the windows queues and then get dropped because it was invalid postscript.
To check that smbspool is working, take CUPS out of the loop. Use seamonkey to print a page to file, this should create postscript. Now use smbspool directly to send the file to print
smbspool smb://my-windows-computer-name-or-IP-address/MyNetPrinter 1 1 1 1 1 My-Postscript-File-Name
CUPS writes its logs to /var/log/cups so
tail -f /var/log/cups/error_log
will help you to see what CUPS is doing

Feedback

If you find this page useful in any way I would very much appreciate you leaving a comment, even if it is just your name and works or didn't work.



CategoryHowto

Syndicate content Comments

Windows 2000

First: many thanks for this instruction, works great.

In Windows 2000, a change of the registry is required.

In a Dos-window, type:
regedit

This opens the registry editor.
Click the tree to reach:
HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices

Right-click in the right pane - add - string
Enter here the name of your printer, as you added it to gsprint.cfg.
Hit enter to confirm, then right-click this new entry to modify it.
Enter this value then:
winspool,FILE:

Mark