printing a file from shell prompt

I’m using QNX6.2.1 and HP LaserJet 4V printer. I want to print a .dat file to the printer from the shell prompt. Can anyone send me the command?

Also, I want to print the same file from my photon code on a button press.
Can anyone send a snippet for this.


Before printing from shell promt you need to prepare Photon draw-stream (.phs) file.

Command to print like this:

phs-to-pcl printfile.phs > /dev/par1

You need a printer with built-in fonts to print text file from the shell prompt directly.
Command line to print like this:

cp printfile.txt /dev/par1

:question: Maybe it is some way to print from the shell promt using lpr.

This is a big area. Without trying to answer all the questions, here are the main areas.

  1. How to get your data to the printer
    Do you have a spooler set up to do this?
    A spooler can do a lot of necessary conversions if set up right.
    Do you have the required drivers set up?
    What kind of printer, Parallel port, USB, Network Connected

  2. What kind of data?
    Formatted Text
    Is some kind of conversion needed, or will the printer understand
    your data directly?

Assuming you can send the file to the printer from a shell script, you can always
use system() to perform an identical operation from a program, Photon or otherwise.
That is not always what you want to do.

On top of all this, Photon may be used to format the output in the same way you use
it to display information on the screen, using widgets.