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:
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.
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.
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:
Check your TCP/IP documentation to verify that you've got the correct configuration. |
Because the Photon printer filters uses phfont to render text to a printed page, phfont must be running.
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 & )
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.
which -l phfont
You should see output similar to:
19948 Oct 29 12:38 /usr/photon/bin/phfont
Make of printer | Model | Filter |
---|---|---|
PostScript | Color and B&W | Pp.ps |
Canon | BJ-30/100/200/200e/200ex/230 BJC-70/80 BJC-210/240 BJC-600/600e610 BJC-800/820 BJC-4000/4100/4200/4550 |
Pp.canon |
Epson ESC/P2 | Stylus Color (MJ-700V2C) | Pp.escp2.S1 |
Stylus Pro (MJ-900C) Stylus Pro XL (MJ-5000C) |
Pp.escp2.S1 | |
Stylus COLOR IIs (MJ-500C) Stylus COLOR II (MJ-800C) Stylus Pro XL (MJ-5100C) |
Pp.escp2.S2 | |
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.
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. |
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.
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.
Suppose you have a PostScript printer attached to /dev/par1. You define a spool device name for it in the configuration file as follows:
[ps.phs] ta=PAR1 co=/usr/photon/bin/Pp.ps $(spfile) > $(device) [-PAR1] dv=/dev/par1
In this example:
The Photon printer drivers take the spool filename as input, and output to stdout. Since the printer drivers parse the input file multiple times, copy-out (co) must be used, rather than copy-in (ci).
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
All you need to do is:
Use the sample file as your configuration file.
cp /usr/photon/print/lpsrvr.photon /etc/config/lpsrvr.node
sp=/qnx/PhSpool cd=/tmp
These commands change the default existing directory where temporary spool files are found from:
/usr/spool/lp
to:
/tmp
The commands also change the registered name of the spooler from /qnx/spooler to /qnx/PhSpool. This configuration modifies the lpsrvr behavior so that it works with Photon, but doesn't interfere with other lpsrvr's in the system.
Note that if you modify the settings for sp and cd, the standard shell utilities (lp, lpc, lpq, and lprm) will work only when the LPSRVR environment variable is appropriately defined.
( 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.
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.
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
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
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.
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
Or
Filename = //10/dev/par1
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
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 |
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
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.
There should be a list of printers to choose from. (You just set them up in Step 5.)
If you weren't successful printing, check the following:
The following "Frequently Asked Questions" may help you troubleshoot your printing problems.
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.
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:
[net.phs] ta=NET co=nice -1 /usr/photon/bin/Pp.ps $(spfile) [-NET] cp=/usr/ucb/lpr -Pnet_printer dv=/dev/null
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)
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).
Verify that phfont is running on the same node as your Pp.xxx filter.
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.
Most likely phlib_render_11 isn't in your default path.
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:
If you print from a Photon application and the images look great, but the characters appear pixeled, verify that you have the following:
If you get this error message when printing from Photon, you probably didn't install your printers with prsetup.
Verify that the device in your /usr/photon/print/printers file is the correct device.
Photon determines the properties to use for printing from three configuration files:
The information in your personal configuration file overrides any values in the system-wide configuration file.