Winprint Notes
Do Winprint -width and -length work?
Is there any special consideration that we should take in order to use this facility?
Should we use escape codes to solve this and insert them in each output?
Printer vendors provide two interfaces via their printer drivers to their printers: interactive and non-interactive interfaces.
The interactive interface is the one you see when you (for example) you click on (F)ile, Page Set(u)p in MS Word. You can see this same interactive printer interface, if you use pass an APPX Printer Control or Form Control parameter of "-interactive".
Check to see if the operator-supplied lengths and widths work when you use this APPX Interactive printer interface option.
The non-interactive version of the Printer Vendor's printer driver does not stop for enduser interaction every time the printer is selected. It uses switches defined in your Printers or Forms Controls.
We pass our '-' parameters (including -length and -width) directly to the Windows Print Spooler Interface. Windows then passes these parameters to the printer driver.
We've run into a number of cases where the printer driver's interactive interface honors length and width specifications, but their non-interactive interface doesn't.
(This makes some sense, since most Windows apps require you to go thru the interactive interface, as opposed to APPX which has its own optional interactive interface in the form of the --- INPUT DISPOSITION process. So many Printer Vendors didn't bother initially to debug their non-interactive driver interface.)
Try a different printer model or manufacturer, to see if the -width and -length Form Control parameters work there. You'll probably find that it does.
If it works for the other printer, and for the current printer interactively but not non-interactively, your best bet is to try to download a newer driver from your Printer Vendor, or go to the Printer Vendor for support on this issue.
Or, you can require your endusers to use the "-interactive" switch in Forms Control, and thereby the Printer Vendor's interactive interface.
The WINPRINT.EXE program is invoked by APPX whenever a report is spooled to the printer. Winprint actually does the spooling.
Winprint.exe accepts the following command line arguments:
winprint [options] reportfile_name [reportfile_name*]
Winprint will process any options and the spool the text files named on the command line. (You can spool more than one text file).
Following are a few of the options winprint understands. For a complete list, double click on $APPXPATH/winprint.exe.
-orientation=
| text | landscape or portrait |
-font= | text | Windows printer font name |
-pitch= | integer | point size for output font |
-printer_id= | text | Windows name for target printer |
-form_id= | text | Windows name for target form |
-copies= | integer | number of copies to print |
-collate | boolean | if present, collate output |
-ruler | boolean | if present, print ruler |
-config= | text | path name of configuration file |
-printer_ctl= | text | additional printer options |
-form_ctl= | text | additional form options |
Notes:
options to winprint can come from four different sources:
-
Options specified on the command line
-
Options specified in the file specified by the "-config=" file
-
Options specified in the -printer_ctl= option
-
Options specified in the -form_ctl= option
When APPX invokes the winprint program, it first builds a Configuration file containing the above options, then invokes winprint with the following command line:
winprint -config=REPORT01.CFG REPORT01.
The values specified in the -config file are obtained as follows:
-
-banner --- PRINT BANNER
-
-copies --- PRINT COPIES
-
-date --- PRINT SPOOL DATE
-
-disposition --- PRINT FILE DISPOSITION
-
-format --- PRINT FORMAT
-
-mode --- PRINT MODE
-
-notify --- PRINT NOTIFY USER
-
-priority --- PRINT PRIORITY
-
-user OS User Name
-
-form_ctl Form Control string for -form_name
-
-form_id System Form ID for -form_name
-
-form_name --- PRINT FORM ID
-
-printer_ctl Printer Options string for -printer_name
-
-printer_id System Printer ID for -printer_name
-
-printer_name --- PRINT PRINTER ID
The System ID of an APPX Printer should be set to the Windows Printer name (as it appears in Control Panel - remember, you may have to shorten the Windows Printer Name).
If you want to specify -orientation, -font, -pitch, -collate, or -ruler, you must include the appropriate option in the Form or Printer control string.
For example, an APPX Form named "LANDSCAPE" should (probably) have a Form Control string of "-landscape".
-form_id is only supported under Windows NT
-banner, -date, -disposition, -format, -form_name, -mode, -notify, -priority, -printer_name, and -user are ignored by winprint.exe but may be present in the -config file.
Just so I'm clear; does winprint convert the -font and -pitch to printer specific codes so that these 2 switches will work with most printers?
Good question!!!!
Under Windows, we don't have a direct interface to the printer - in other words, we can't just send a stream of characters to the printer port like you would expect. Instead, we have to call a series of functions which paint the page image the way we want it printed, for example, move to "pixel" 10,20 and paint a 'w' in the currently selected font.
It is the job of the printer driver (supplied either by Microsoft or the printer manufacturer) to translate our painted pages into a sequence of escape sequences (or
postscript commands or PCL commands) specific to the printer.
Winprint doesn't know what kind of printer you have connected - you could even use a product like WinFax to send a FAX from APPX.
So the -font and -pitch flags are supported as long as the printer driver knows how to deal with them.
Note: Copy count, collation, orientation, and form size are also interpreted by the printer driver.
Comments:
Read what other users have said about this page or add your own comments.
--
ChrisBrower - 2011-06-21