[Previous] [Contents] [Index] [Next]

Printing Support

Printer installation and configuration

Starting with release 1.12, Photon has had builtin printer support. This includes a number of drivers, applications, and a print selection widget/convenience dialog to make printing simpler within your own applications.

Printing in Photon relies on two configuration files:

Although you can print directly to a printer without a spooler, we highly recommend setting up a print spooler to avoid conflicts. The process of setting up the spooler is simple, even for a standalone computer.

Here are the steps to help you get your Photon printing system up and running:

Step 1. Configure parallel and network connections

Determine whether you'll be using a parallel port on your PC or a network connection to print. Follow the appropriate steps below to verify your configuration.

Connecting through a parallel port:

  1. Type the following to determine if Dev.par is running:

    ls /dev

    If you see an entry in /dev similar to /dev/par1, then it's running. If it isn't running, start Dev.par from the command line. (You can also add the command to your /etc/config/sysinit file so that it'll automatically start whenever you reboot.)

    For more information on Dev.par, see the QNX 4 Utilities Reference.

  2. Verify that you can output text directly to the printer:

    cat >/dev/par
    Hello, this is some text.  
    ctrl-L    { a formfeed }
    crtl-D    { an EOF }
    crtl-C    { a break }

If you aren't successful at printing, check:

Connecting through a TCP/IP network connection:

=>> Check your TCP/IP documentation to verify that you've got the correct configuration.

Step 2. Set up phfont

Because the Photon printer filters uses phfont to render text to a printed page, phfont must be running.

  1. To verify that phfont is running, enter the following command from a shell prompt:

    sin -P phfont

    It's running if you see an entry in the form of phfontxxx. The "xxx" indicates which font server (e.g. pfr, phf) is running.

    If a font server isn't running, you can start phfont by entering:

      export PATH=/usr/photon/bin:$PATH
      export PHFONT=/dev/phfont
      phfont -X &

    Note: Be sure to enclose the commands in brackets so that the /usr/photon/bin directory doesn't become a part of your default search path!

    If Photon isn't running at the time someone tries to print, the font manager can be started in the "stay active" mode. You can add the above commands to your sysinit file.

  2. Verify that you're running an appropriate version of phfont. You must be running Photon 1.12 or later, and the date of phfont must be later than September, 1997 to have the appropriate interface for the printer filters. To display the date, type:

    which -l phfont

    You should see output similar to:

    19948 Oct 29 12:38  /usr/photon/bin/phfont

Step 3. Identify and test your printer and filter

  1. Determine the make of printer that you want to print to.
  2. Use the following table to determine the type of print filter you need for your printer. For example, if you have a PostScript printer, you'll choose Pp.ps. The Japanese models appear in brackets.
    Make of printer Model Filter
    PostScript Color and B&W Pp.ps
    Canon BJ-30/100/200/200e/200ex/230
    Epson ESC/P2 Stylus Color (MJ-700V2C) Pp.escp2.S1
    Stylus Pro (MJ-900C)
    Stylus Pro XL (MJ-5000C)
    Stylus COLOR IIs (MJ-500C)
    Stylus COLOR II (MJ-800C)
    Stylus Pro XL (MJ-5100C)
    Stylus COLOR 200 (MJ-510C) Pp.escp2.S3
    Stylus COLOR 400 (MJ-830C) Pp.escp2.400
    Stylus COLOR 500 (MJ-810C) Pp.escp2.500
    Stylus 1500 (MJ-3000C) Pp.escp2.1500
    Stylus COLOR 1520 (MJ-6000C) Pp.escp2.1520
    Stylus COLOR 3000 (MJ-8000C) Pp.escp2.3000
    Hewlett-Packard PCL or compatible All models except the 720 and 1000 series Pp.pcl
    Lexmark 3000 Pp.pcl

    If your printer model doesn't appear in this table, please contact Technical Support.

    Note: From now on, "Pp.xxx" will be used to represent the filter type. Whenever you see a reference to "Pp.xxx", substitute your print filter.

  3. Verify that the print filter you chose works with the sample test file:

    cd /usr/photon/print/
    Pp.xxx simple_test.phs >/dev/par

    If the print filter doesn't work with the sample test file, check that:

    If you're still having difficulty after verifying the above, contact Technical Support.

Step 4. Set up lpsrvr

The lpsrvr utility is used to manage multiple users and processes printing to a single device. In this step, you'll customize the sample lpsrvr configuration file that's used with lpsrvr to set up your spooler.

A sample lpsrvr configuration file called lpsrvr.photon may be found in /usr/photon/print. It contains device setups for common industry printers such as Canon, Epson, and Hewlett-Packard. Each individual printer driver is defined in its own section.

Spooler example

Suppose you have a PostScript printer attached to /dev/par1. You define a spool device name for it in the configuration file as follows:

    co=/usr/photon/bin/Pp.ps $(spfile) > $(device)


In this example:

If you need a detailed explanation of the lpsrvr utility - all its features, and the format of the configuration file - you can refer to the lpsrvr man page in the QNX Utilities Reference.

Now, check to see if lpsrvr is running. Type:

sin -P lpsrvr

If lpsrvr is running

All you need to do is:

  1. Modify your existing configuration file (e.g. /etc/config/lpsrvr). Append the new printer entry to your existing configuration file.
  2. Slay your existing lpsrvr. (Make sure no one is using it!)
  3. Restart lpsrvr so that your changes take effect.

If lpsrvr isn't running

Use the sample file as your configuration file.

  1. Copy the sample file to the /etc/config directory. It's recommended that you give it a unique name (i.e. lpsrvr.node).

    cp /usr/photon/print/lpsrvr.photon /etc/config/lpsrvr.node
  2. Edit the relevant spooler and filter information in the file:
  3. Start lpsrvr on a new console (or a new pterm):
      export PATH=/usr/photon/bin:$PATH
      # Start PHFONT (if you didn't in Step 2)
      lpsrvr -v -f /etc/config/lpsrvr.node &

    The printer drivers need the PhRender shared libraries to draw their images. The export PATH command puts phlib_render_11 in the default search path.

    Also, the printer drivers use the rendering functions in the auxrender shared library if phlib_auxrender_11 is loaded, or in the search path. The auxrender library prints geometric objects at printer resolution rather than at screen resolution. Circles, arcs, beziers, and other geometries print much smoother. Since this geometry engine uses more memory and floating-point math, users building embedded systems will most likely elect to avoid it.

    Note: We recommend that you start with the verbose option (-v) so you can watch what lpsrvr is doing. If you'd like, you can leave it on indefinitely for tracking purposes.

    It's a good idea to put this command in your sysinit file so that the spooler is started each time you boot the node.

  4. The devices corresponding to your entries (e.g. /dev/spool/ps.phs) should now exist and be ready to use.
  5. Verify your lpsrvr setup by copying the test file /usr/photon/print/simple_test to the spool directory:

    cd /usr/photon/print
    cp simple_test.phs /dev/spool/xxx.phs

    The lpsrvr utility should then display progress messages like:

    debug msg:move 'CI2.1' to 'SP2.1'
    debug msg:1 dispatched to PAR1(1)
    debug msg:started pid=9973
    debug msg:exec command:'/usr/photon/bin/Pp.ps SP2.1 > /dev/par1'

    When the copy is complete, you should see messages like:

    debug msg:finished - 9973, status 0x0000
    debug msg:1 completed on PAR1, status = 0
    debug msg:PAR1 now idle

Step 5. Set up your printer definition file

Now that the spooler is working, turn your attention to configuring Photon to work with the spooler.

Photon uses the information contained in the /usr/photon/print/printers file. It describes the model, capabilities, and default settings. To create this file, copy the sample file (/usr/photon/print/printers_sample) to the printers file and extract the sections relevant to your printer:

cd /usr/photon/print
cp printers_sample printers

Note: If you're printing through a parallel port, the spool directory resides only on the node where lpsrvr is running. If the printer is on a network, you need to specify the node number where lpsrvr runs.

After the printer configuration files are installed and configured, setting up a personal printer for your desktop is easy and fast using the Photon printer setup utility, prsetup. For information on how to set up your personal printer for printing in Photon, see the chapter, Using the Print Dialogs, in the Photon User's Guide.

Editing the printers file

The following is a sample setup for the /usr/photon/print/printers file defined with the lpsrvr utility.

[Complete Printer Option List]
Filter                = Pp.sample
Device                = /dev/spool/SomePrinter.phs
Location              = Location Description
Properties            = prprops
Preview               = preview
NonPrintable          = 500,350,500,250
Supported Resolution  = 75,150,300,600
Supported PaperSize   = 8500*11000:Letter,8500*14000:Legal
Supported Color       = 0:B&W,1:GreyScale,2:Color
Supported PaperSource = 1:Auto,2:Upper,3:Lower,4:Manual,5:Envelope,6:EnvelopeManual
Supported PaperType   = 1:Normal,2:HighQuality,3:Draft,4:Transparency,5:Envelope,6:T-Shirt
Supported Duplex      = 0:Off,1:On
Supported Dithering   = 1:None,2:Coarse,3:Fine,4:LineArt,5:ErrorDiffusion,6:HalfTone
Supported Orientation = 0:Best-Fit,1:Portrait,2:Landscape
Supported Intensity   = 100
Supported InkType     = 1:B&W,3:Color (CMY),4:Color (CMYK),6:Color (Neon)
Resolution            = 300
PaperSize             = 8500*11000
Color                 = 1
PaperSource           = 1
PaperType             = 1
Duplex                = 0
Dithering             = 5
Orientation           = 1
Intensity             = 50
InkType               = 1

This file defines the range of values allowed for each option, and the default values for each option. All options that don't begin with the word Supported specify the default value.

Options that begin with the word Supported (e.g. Supported Resolution, Supported PaperSize, Supported Color) define the range of values that are allowed for that option. While the values for the Supported options are fixed (i.e. 1, 2, ... 6), the labels for the values (e.g. Normal and HighQuality in the Supported PaperType) may be renamed or translated into another language.

For example, Supported Color has three fixed values: 0, 1, and 2. The labels B&W, GreyScale, and Color could be changed to "mono", "grey", and "color". The default setting is 1.


The device option should be set to the name of the device defined in the lpsrvr configuration file. If you're using a printer in a networked environment, you'll also need to know the node number of the device. For example, to use a spooler running on Node 10:

Device = //10/dev/spool/ps.phs


If you didn't set up a spooler, you could direct the printing to a local device or file directly using "Filename." In these cases you don't set "Device" to anything; instead, you set Filename. For example:

Filename = /dev/par1


Filename = //10/dev/par1

Note: If you don't use a spooler, make sure you don't try to print two files to the printer at the same time. Printing on a network without a spooler isn't a good idea!


The location option is a text description of where the printer is. It's more useful in large network environments. For example:

Location = Beside the Coffee Machine


The NonPrintable option specifies the height and width of the nonprintable printer margins in thousands of an inch, where 125 represents 1/8", 250 represents 1/4", etc. The dimension options are set clockwise starting at the left margin. Therefore, the first value sets the width of the left margin, the second value sets the top margin, the third value sets the right margin, and the last value sets the bottom margin. If all margins are the same, then a single value may be used. For example:

NonPrintable = 500

Supported Options

The Supported options in the sample configuration file give a list of all possible options understood by Photon. If a particular printer doesn't support an option, it may be deleted from the list. For example, the complete options for Supported InkType are:

Supported InkType = 1:B&W,3:Color (CMY),4:Color (CMYK),6:Color (Neon)

For a: Set:
3-color Ink Jet printer Supported InkType = 1:B&W,3:Color (CMY)
black & white laser printer Supported InkType = 1:B&W

Alternate print filters

Photon also supports printing to files in its native format (Photon Script=PHS), printer-dependent format, or graphics image format. These are defined as follows:

[PHS Spool File]
Location = PHS Spool File

[PS Spool File]
Filter   = Pp.ps
Location = PostScript Spool File

[BMP Spool File]
Filter   = Pp.bmp
Location = Bitmap graphics Spool File

Step 6. Select printers for a user

Now that the system manager's setup is complete, individual users may log in as a regular user (where the $HOME environment variable points to a reasonable directory) and start Photon.

  1. Start prsetup inside Photon.

    There should be a list of printers to choose from. (You just set them up in Step 5.)

  2. Install the printers or spool filters that you wish to use in the Photon Printer Setup (prsetup) dialog.
  3. Choose a printer that you would use the most for the default printer.
  4. Load a Photon application, such as Helpviewer. Try to print something using the Print/Select printer option.

    If you weren't successful printing, check the following:


The following "Frequently Asked Questions" may help you troubleshoot your printing problems.

Can I print without lpsrvr?

Although you can print directly to a printer without a spooler, we highly recommend that you set up a print spooler to avoid conflicts between print jobs. The process of setting up the spooler is simple, even for a standalone computer.

If you don't use a spooler, it's your responsibility to make sure there's only one task attempting to print at any time.

How do I set up lpsrvr for a network printer?

If you're comfortable with the lpr utility, then you may use it to set up lpr directly, or you can let lpsrvr pass the job to it. For example, your lpsrvr would contain lines similar to:

    co=nice -1 /usr/photon/bin/Pp.ps $(spfile)

    cp=/usr/ucb/lpr -Pnet_printer

In this case, the output is sent via a pipe to lpr:

co=nice -1 /usr/photon/bin/Pp.ps $(spfile)

rather than to a device:

co=nice -1 /usr/photon/bin/Pp.ps $(spfile) > ($device)

I can print from the lpsrvr node, but not from other nodes.

You need to specify the lpsrvr's node number for remote printing. Even if nodes share the same root (i.e. "/" on your node is the same as "/" on the remote node), the /dev directory is node-specific (use the prefix command for more details).

Printing is slow, and none of the text appears.

Verify that phfont is running on the same node as your Pp.xxx filter.

How can I modify the default options permanently? To print properly, I have to change the options in my print dialog every time I print.

The printer configuration defaults can be modified using prsetup, the Photon Printer Setup dialog.

It's also possible to change the defaults for all users by editing the /usr/photon/print/printers file. The Photon Printer Setup dialog affects only you.

Pp.xxx says it can't load PhRender_lib11: "Could not link shared object 'phlib_render_11' -- No such file or directory".

Most likely phlib_render_11 isn't in your default path.

My printout is blurry.

If you print from a Photon application and your printout is blurry, there are a number of options in the Properties menu that you can adjust to change the print quality:

The characters appear pixelized (i.e. jagged).

If you print from a Photon application and the images look great, but the characters appear pixeled, verify that you have the following:

PxError: Can not open file for input.

If you get this error message when printing from Photon, you probably didn't install your printers with prsetup.

I can't print from a Photon application.

Verify that the device in your /usr/photon/print/printers file is the correct device.

How does Photon determine the properties to use for printing?

Photon determines the properties to use for printing from three configuration files:

Your personal list of installed printers. Use the prsetup utility to edit this file.
Your current default printer.
The system-wide configuration information for each printer.

The information in your personal configuration file overrides any values in the system-wide configuration file.

[Previous] [Contents] [Index] [Next]