Printing from non-PM apps
Printing from non-PM apps is kind of difficult on OS/2, at least
it's not really well supported. Since all ported applications
from un*x lack any support for PM-based printing I try to explain some useful
workarounds and solutions. Unfortunately I'm no real expert, you are welcome
to supply e.g. native code to access the printer queues, etc.
Major parts of this doc are taken from the
INSTALL.OS2
document from
LyX.
Feel free to enhance this doc ...!
Direct Printing
The most simple solution is printing to a
Postscript file and then use gvpm for printing. If you have installed
"printlp.exe" of "gnugroff.zip" from
OS/2 software sites,
you could try to directly print to the local OS/2 spooler:
Excerpt from README.OS2 as supplied with 'gnugroff.zip':
New printlp and printdvi programs: Printlp captures all stdin input
and spools it to "lpt1" (default) or the output device set in the
environment variable LP_DEVICE. Printdvi captures all stdin input
into a temporary file and calls the command "v" with the name as
argument (v is the viewer in emTeX) or the command in the
environment variable DVI_PRINT_COMMAND. If the command contains a
%s, this will be replaced by the temporary file name.
I recommend to add to config.sys
SET DVI_PRINT_COMMAND=VP
or "printlp" for a Postscript-capable printer or if you already configured a
postscript filter for your program. A different solution
to try is this one from Marcus von Cube (for xephem): Create a small
REXX file:
/* xprint.cmd */
parse arg file
file = translate( file, "\", "/" )
'@print /d:lpt2 /b' file
(you may want to change "print /d:lpt2 /b" to "printdvi").
LPR, LPD
Warp 3 with common extensions and all versions above
contain helpful tools for our purposes: "lpr" and "lpd".
If your
%ETC%\INETD.LST contains the following line:
printer tcp lpd
and
inetd is running, you should be able to use
lpr:
lpr -s localhost -p lpt2 -b <filename>
(it might be necessary to set up a
loopback interface, see
networking FAQs or
XFree86OS/2 installation docs
how to this).
It accepts "/" as a path separator.
For convenience you may create a batch file which may inherit the permanent
flags. e.g. a "lp.cmd" which looks like
lpr -s localhost -p MyPrinter %1 %2 %3 %4 %5 %6 %$7 %8 %9
where we assume you have a printer queue named "MyPrinter" on your
machine.
Knowledge of the physical names of your printer queues is required
for this approach.
You can retrieve them by looking looking at the "View" page of the according
printer object on the WPS or in the "\SPOOL" directory on your system's
partition.
A superior way is to use the more complex OS/2 API.
Check out e.g.
SplEnumQueue().
This API allows to retrieve the default queue. The other
Spl*() interfaces allow a full job control even without
any PM-GUI interaction.
Wrappers, Utils
un*x ports require at least two features to make them work
as being on an un*x system:
-
a Postscript interpreter or printer, since
Postscript is the standard
printing format
-
equivalents to "lp", "lpr" utilities
Several utils exist to help integrating such tools in your OS/2 system.
-
GhostScript is the only Postscript interpreter
that you could use. It can be found at
http://www.cs.wisc.edu/~ghost/.
However it comes with a non-advisable OS/2 binary set. Better
get one with X11 support from
J. Sawataishi's website
or
from OS/2 software sites
-
A more convenient example, actually a poor man's un*x "lpr" clone
can be retrieved as a small
ZIP archive.
-
A Simple lpd-like daemon is available:
pmlpd102.zip
Citing the README:
This program looks for a specified file to be created. When the
file exists, a given process will be started. The program waits
until the process has ended, and then it will erase the file and
wait for a new one. It was written as a daemon for GhostScript.
-
Check out "lportd" or tools like "printmon"
(from OS/2 software sites.)
-
To deal with Postscript documents you can use the
psutils (e.g. from from
OS/2 software sites). They offer all kinds of
manipulation including printing 2 or n logical pages per sheet,
creating booklets or printing only selected pages of a document.
All this can be done from command line.