Does this site look plain?

This site uses advanced css techniques

In the process of developing a Windows printer driver, we ran into all kinds of problems with the Win32 Forms API. Our initial query work was done with our winprinfo tool, but eventually we needed a tool that could do more than just query: hence this program. Much more information on the background can be found in the Tech Tip: Managing Win32 Printserver "Forms".

Quick Links

Background

The Windows NT4 printspooler defines about 40 forms, and the Windows 2000 printspooler defines more than a hundred, and they are accessed via the Forms API. The forms all have a name, a type, and dimensions to a thousandths of a millimeter. A bit of example output run on a Win2000 system is shown here:

C> winforms
winforms 1.0.1 - 2003-10-19 - http://www.unixwiz.net/tools/

Querying printer "(local printserver)"
Printer (local printserver) is open

PRINTSERVER FORMS (121 forms, 7374 bytes)
 [  0] B 215.900 279.400 mm    Letter
 [  1] B 215.900 279.400 mm    Letter Small
 [  2] B 279.400 431.800 mm    Tabloid
 [  3] B 431.800 279.400 mm    Ledger
 [  4] B 215.900 355.600 mm    Legal
 [  5] B 139.700 215.900 mm    Statement
 [  6] B 184.150 266.700 mm    Executive

  ...  more

NOTE - this is a console-mode tool: it must be run in an MS-DOS/command window. If you try to run it from Explorer, it will flash a window and exit. This is not a GUI tool. It also is almost certain not to run on Win9x/ME systems.

Download / Build

Both source and binary are available:

We promise that the binary was built from this source and that it performs no shenanigans. We don't promise that it has no bugs. Use at your own risk.

This code was built with Microsoft Visual C++, but strictly in the command-line mode, not using the IDE. In addition, the makefile requires GNU Make (gmake.exe) because we simply cannot stand Microsoft's NMAKE. You can get a GNU Make executable for Win32 here.

We built this to run strictly on NT/Win2000/XP platforms: if it works at all on Win95/98/ME, we'd be very surprised.

Command Line Parameters

When winprinfo is run without command-line arguments, it reports a short "help" listing that summarizes the options available, which are expanded.

--help
Show a brief help listing, then exit.
--version
Show the program's version information, then exit.
--printer=P
Operate on printer name "P", which must be enclosed in quotes if it contains spaces. Example: --printer="Upstairs LaserJet". Case does not seem to be significant in the printer name. If this is missing, the local printserver is used instead (which works only on Win2000 or later).
--add=SPEC
Add a form by providing a "spec", which gives the name, type, and dimensions of the form. The spec is a quoted string of the form:
"name:type:width:height"
. type is either "P" for printer-form or "U" for user-form, and the dimensions are given in millimeters (which may include fractional parts).
Example: --add="Letter:P:215.9:279.4"
--del=F
Delete form F from the forms database. Builtin forms cannot be deleted.
--set=SPEC
With a SPEC (described in the --add section), change the type, width, height of the named form. The form must exist ahead of time, and builtin forms cannot be modified.
--set=oldname/SPEC
Attempt to rename the given form from oldname to the form described by SPEC. This doesn't really work right due to apparent bugs in the Win32 Forms API.
--inches
In addition to showing dimensions in mm, also show them in inches.
--points
As above, but also show PostScript "points" (1/72nd of an inch units).

Version history

This is a simple mirror of the revision log in our development environment, but it might lag a bit behind the version of the executable actually found on the web.

Sun Oct 19 17:18:36 PDT 2003 -- version 1.0.1
-- Initial release