Recent Changes - Search:

Tips & Tricks

Windows Tips

Vista Tips

MS Server Tips

Apple Tips

Linux Tips

Networking Tips

Business

PVRTips

powered by PmWiki

PrintFromLinux2Win

Hide Contents

Table of Contents

Create a Virtual Postscript Printer in Windows using Ghostscript

There are a variety of reason for create a virtual Postscript printer which are enable Macintosh/Linux/Unix systems to print to non-Postscript printer attached to a Windows system.

This document will provide instructions on how to create a virtual Postscript printer under Windows XP. The actual output device is any printer you might specify. That is, a printer will be created under Windows XP that will act like a Postscript printer and output to almost any non-Postscript windows printer.

This process through which this works is as follows:

Postscript > Virtual Postscript Printer > RedMon > Ghostscript > GS mswinpr2 device > Physical Printer

How To Do It

Download Required Packages

The first step is to download the Ghostscript and RedMon (Redirection Port Monitor) software package. A companion package called GSview is a nice graphical interface to Ghostscript however is not needed if you are familiar with scripting or command prompt. Here are the mirror sites:

gs814w32.exe
redmon17.zip
gsv46w32.exe

Install Ghostscript, RedMon and GSview

Install Ghostscript to the folder c:\gs . Install RedMon to c:\gs\redmon and optionally install GSview.

Extract redmon17.zip to c:\gs\redmon and double click on setup.exe to actually install the Redirection Port Monitor( redmon).

Setup & Prepare the Physical Printer

Identify or create and setup the physical printer which will print the Postscript file.

If the printer is not already shared, share the printer using the share name gsprinter

Add Printer Image
Figure 1

Figure 1 shows the shared setup for a HP Laserjet 5P printer named HP Laserjet 5P (GS). We created this printer with a (GS) designation since we wanted a specific printer to handle the Postscript output. The reason for creating a separate printer for the Postscript output has to do with the next setting.

Add Printer Image
Figure 2

Everything should work without this next option. For some printers we need to set the Print directly to the printer option otherwise printing might be very slow. However, enabling direct printing may have undesirable effects when printing from Windows programs, create a printer dedicated to Postscript printing. Once the setup is completed, experiment with this setting. If your printer/system does not require direct Printing to the printer, creating a separate dedicated printer for Postscript is not necessary.

Create the Virtual Postscript Printer

Create a color Postscript printer and associate it to a newly created RPT1: port. Using the Add a printer Wizard add our virtual Postscript printer.

Add Printer Image
Figure 3

Select a Local printer attached to this computer option (the virtual printer will act like a local printer)

Add Printer Image
Figure 4

and select Create a new port and choose Redirected Port as the Type of Port.

  • Do not choose the FILE: or any other port here!
  • If you are using Windows XP/2000 and you do not have a Redirected Port as an option then the installation of RedMon (above) failed. You cannot continue until RedMon is properly installed.
  • For Windows 98 first select the printer (HP Color LaserJet PS) and then select FILE: as the port. After creating the printer, add the RPT1: printer port under the Details tab of the printer properties. The process is similar to these steps, but make sure to configure the printer and the port as described below.
  • The Windows 2000 screen looks significantly different than the XP screen shown above. The functionality remains the same.

Click on Next and

Add Printer Image
Figure 5

accept the default Port Name of RPT1: (or RPT2:, etc.) by clicking OK. Now select the default printer to associate with this port

Add Printer Image
Figure 6

Select the HP printer HP Color Laserjet 4550 PS. This is the virtual printer we are creating so even if you do not own this printer select this choice. Certain other (but not all) printer selection will work here. Important is that printer be a color Postscript printer. Some printers seem to give better font quality output then others. Good success has been experienced with this one. Under Windows 2000 select the HP C LaserJet 4500-PS printer. Click Next until name your printer: window shows

Add Printer Image
Figure 7

Name the printer GS PS Printer (or anything else that suits your fancy) and you probably do not want it to be your default printer. Click on Next and Next again on the Printer Sharing page until you reach the Print Test Page dialog box:

Add Printer Image
Figure 8

Make sure you do not print a test page. Click on Next and then Finish to actually install the printer.

This printer will become our virtual Postscript printer. We can share it and print to it from other systems including Linux and Macinistosh. The Linux system can be configured to print to a HP LaserJet 4050 Postscript printer or simply a Raw Print Queue.

Create Ghostscript Options File

To create the Ghostscript Options file mswinpr2.txt and to configure the mswinpr2 device driver, create an options file c:\gs\mswinpr2.txt using a plain text editor such as Notepad. The file will tell Ghostscript that we want to print the Postscript file using the mswinpr2 printer device driver. The mswinpr2.txt file contents are:

 -Ic:\gs\gs8.14\lib;c:\gs\fonts 
    -sDEVICE=mswinpr2 
    -dNoCancel 
    -dNOPAUSE 
    -dSAFER 
    -sPAPERSIZE=letter

Place the file into the GhostScript directory c:\gs. Note: the path (the first line) must be correct for the version of Ghostscript you installed. Change the 8.14 to whatever version number you noted when you installed Ghostscript. European users should change the paper size from letter to a4. For more information on GhostScript devices and their options click here.

Note: If your path names contains spaces you will need to put quotes around the paths specification C:\gs\gs8.14\lib;C:\gs\fonts. Thanks to Jonathan Sefton for pointing this out.

Configure the RPT1: Port

To configure the newly created RPT1: port to use Ghostscript to use the mswinpr2 device driver

Select Properties of the newly created GS PS Printer

Add Printer Image
Figure 9

Under the Ports tab the correct port (created above) should already be selected (RPT1: or higher). Click on Configure Port...

Add Printer Image
Figure 10

and fill out the dialog box as shown above. Make sure the program path C:\gs\gs8.xx\bin\gswin32c.exe points to the gswin32c.exe executable. Change version 8.14 in the path to match the version that was actually installed. Make sure the arguments for this program are: as indicated above - listed here again for reference:

 @c:\gs\mswinpr2.txt -sOutputFile="\\spool\gsprinter" -

Note the dash at the end of the line. The OutputFile points to the share name of the physical output device we setup above. In our example the share name is gsprinter. The path name after the @ points to the options file mswinpr2.txt we created above. The Output: needs to be Program handles output, the Printer: is irrelevant, and the Run: box should say Hidden. Click on OK when done

Note: The Log File button can be useful for tracking down problem should the printer fail to work properly.

Note: There is no requirement that the physical printer be a local printer. It could be a network printer and we can use its Windows share name to print to it.

Note: Thanks to Stephane Hole for pointing out that one can send the output directly to the physical printer instead of the share name:

 @c:\gs\mswinpr2.txt -sOutputFile="HP Laserjet 5P (GS)" -

where the string HP Laserjet 5P (GS) is the name of the physical printer we setup in the step Setup & Prepare the Physical Printer above. In general, this is probably a better solution for local printers than using a share name.

Note: If your path names contains spaces you will need to put quotes around the path C:\gs\mswinpr2.txt. Thanks Jonathan Sefton for pointing this out.

Edit the Registry

Synopsis: We need to edit the registry to to avoid a printer dialog box form opening every time we print

Note: This step may not be necessary in all cases

We need to edit the registry to make sure Ghostscript knows the printer exists. This is not for the faint hearted, if you are not confident make sure you take a backup (which is outside the scope of this document)

 REGEDIT4
 [HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\CurrentVersion\Devices]
 "gsprinter"="winspool,FILE:"

Note the gsprinter name in the registry key above. This name must match the shared printer name we reference in the OutputFile setting above. If you fail to do this you may have a dialog box open prompting you to select the physical printer to print to every time your print to the virtual GS PS Printer.

Print a Test Page

Print a test page to verify everything is working by Selecting the General tab from the GS PS Printer Properties page

Add Printer Image
Figure 11

and select Print Test Page. If all goes well your physical printer will print a Postscript test page. Note: if the color is wrong (i.e. the black is not black), try removing all the Color Profiles in the Color Management tab of the GS PS Printer printer.

References

http://www.stat.tamu.edu/~henrik/GSPSprinter/GSPSprinter.html - Retrieved 6 Oct 2007


All text is available under the terms of the GNU Free Documentation License
Privacy Policy | About Wikitec | Disclaimer | Copyright

Edit - History - Print - Recent Changes - Search
Page last modified on 2008-01-11 22:03