Printing

From Br Wiki
Jump to: navigation, search

See also Category:Printing

Contents

Simple Printing

In BR, printing to a printer has traditionally been controlled by the statement OPEN #255. This short sample program will demonstrate how to print:

00010 OPEN #255: "name=PREVIEW:/DEFAULT,recl=32000", DISPLAY,OUTPUT
00020 PRINT #255: "HELLO WORLD!"
00030 CLOSE #255: 

In the above example, PREVIEW will print to a preview window before sending it to the default printer. DEFAULT could be substituted with the name of a printer or SELECT to allow the user to choose which printer. Recl refers to record length and should be high, so that the printer does not perform an untimely carriage return.

To format printing, PRINTER.SYS provides shortcuts to refer to the different styles and fonts available when printing. For example:

00020 PRINT #255: "[BLUE]HELLO WORLD!" 
00020 PRINT #255: "[TAHOMA]HELLO WORLD!"

will print in blue, when Printer.sys is in the file and BRConfig.sys has the line "Include Printer.sys"

To print data from a file, simply add the variable names to the PRINT statement (after OPENing and READing the file of course), for example:

00030 PRINT #255: "NAME$" 

An empty PRINT statement will skip lines, for example:

00500 PRINT #255: "Dear NAME$"
00510 PRINT #255:


Printing to New Printers

Originally, programs were written to print on the default BR printer named PRN:/10. In order to print to other printers, you must either use the OPEN #255 statement, or point to the actual printing device using a SUBSTITUTE statement in BRconfig.sys, for example:

SUBSTITUTE PRN:/10 PRN:/printername-or-devicename

Three types of print direction are supported under Windows:

1) Device Names

If NAME=PRN:/LPT1 (or COM1, etc.) is specified, printed output goes directly to the device. You can also specify NAME=PRN:/\\servername\queuename. To find out what printers are available on your network, perform a mock ADD PRINTER sequence under Windows and click Browse when it asks which printer. This can be important because printer network share names can be different from their local Windows printer names.

Note that printer names are the names of the printers that the local user sees, whereas QUEUE names are the "shared" names associated with those printers.

2) SPOOLCMD

If SPOOLCMD is specified in BRCONFIG.SYS then normal spooling is performed under the direction of SPOOLCMD. Note you can also specify SPOOLPATH if you wish, to state where the temporary files are to be stored.

SPOOLCMD can also be used to print to Windows printers by mapping LPTn: devices to them (using capture under Windows) or, in Windows specifying the shared printer name in quotes. e.g. SPOOLCMD COPY [SPOOLFILE] "\\server\hp_laser2"

3) Printer Names

If SPOOLCMD is not specified, NAME=PRN:/windows-printer will enable spooled output to the specified printer. If the NAME= is PRN:/10, PRN:/default, PRN:/select, or PRN:/windows-printer-name, print output will be directed to the Windows Print Manager in pass through (unformatted) mode.

NAME=PRN:/SELECT enables users to dynamically select from the set of printers active in Windows. When BR opens a file with this value in a Windows environment, BR offers the standard Windows dialog box for user printer selection, and directs the output accordingly.

PRN:/DEFAULT does the same, except instead of letting the user select, it sends the output to the current Windows default printer.

Printer_List(Mat A$)

PRINTER_LIST(<Mat array name>)

The Printer_List internal function returns the number of elements in A$ after redimensioning A$ to the number of active Windows printers. The contents of A$ show the printer names used by Windows, and the default printer is the first element. These names are also suitable OPEN NAME= values to direct output to the respective devices. For example:

10 DIM A$(1)*100
20 LET X=PRINTER_LIST(A$)
30 PRINT MAT A$

This program will display a list of printer names defined on the local machine in the manner the OS 'sees' them.

Also, to make easier use of PRINTER_LIST(A$) returned values, any matching substring of an A$ element will suffice after PRN:/ in the following example:

10 DIM A$(1)*60, SELECTION$*60
20 LET X=PRINTER_LIST(A$)       ! Get Windows Printer List
30 FOR LOOP = 1 TO X
40    A$(LOOP) = A$(LOOP)(1:POS(A$(LOOP),"@")-1) ! Trim device address
50 NEXT LOOP
60 GOSUB USER_SELECT_PRINTER    !  Custom Routine to Select From A$
                                 --- place result into SELECTION$ ---
70 OPEN #255: "Name=PRN:/"& SELECTION$, DISPLAY, OUTPUT

Troubleshooting hint when printing under Windows

From the printers folder, click on the printer that's not working, select properties, details, and spoolsettings. Then make sure the "spool data format" option is set to "RAW," not "EMP".


Printer Initialization Statements

CAUTION - Although BR bypasses the Windows print drivers (but not the selection routines), Windows often initialized printers in some strange ways. So you should use the PRINTER INIT config statement to initialize your printers the way you expect them to be, when running under Windows.

set specific: PRINTER PRN:/10 INIT hexcodes - to - reset - printer

set default: PRINTER INIT hexcodes - to - reset - printer

The BRCONFIG.SYS PRINTER statement syntax has been expanded to relate a Windows printer description with a printer type referenced by subsequent PRINTER statements. An example of its use is:

                                NT style printer names
==========================
PRINTER TYPE HPLASER  SELECT   Mary's HP Laser@43NE
PRINTER TYPE EPSONDOT SELECT   Main Server Wide Plain@29TD
printer HPLASER INIT LPP 66,"\E&k2G\E(s10H\E&l6D\E&l0O" ! Init to 10 CPI, 6 LPI, Portrait
printer HPLASER LPP 66 [ COLS=80],"\E(s10H"        ! 10 CPI
printer HPLASER LPP 66 [ COLS=96],"\E(s16.66H"     ! 16.66 CPI
printer HPLASER LPP 66 [ COLS=100],"\E(s16.66H"    ! 16.66 CPI
printer HPLASER LPP 66 [ COLS=120],"\E(s16.66H"    ! 16.66 CPI
printer HPLASER LPP 66 [ COLS=132],"\E(s16.66H"    ! 16.66 CPI
printer HPLASER LPP 51 [ COLS=158],"\E(s16.66H\E&l1O"    ! 16.66 CPI Landscape
printer HPLASER LPP 51 [ COLS=170],"\E(s16.66H\E&l1O"    ! 16.66 CPI Landscape
printer HPLASER [ RESET+],"\E(s10H\E&l6D\E&l0O"          ! Reset all prior settings
printer HPLASER [ LEGAL],"\E&l3A"          ! start printing on legal size paper
printer HPLASER [ LETTER],"\E&l2A"         ! start printing on letter size paper
printer HPLASER [ COLS=224],"[COLS=224] IS INVALID"      ! Not Possible
printer HPLASER [ CPI=10],"\E(s10H"       ! 10 CPI
printer HPLASER [ CPI=12],"\E(s0p12H"     ! 12 CPI N/A
printer HPLASER [ CPI=17],"\E(s16.66H"    ! 16.66 CPI
printer HPLASER [ LPI=6],"\E&l6D"         ! 6 Vertical LPI
printer HPLASER [ LPI=8],"\E&l8D"         ! 8 Vertical LPI
printer HPLASER [ BOLD+],"\E(s3B"         ! Set Bold
printer HPLASER [ BOLD-],"\E(s0B"         ! Cancel Bold
printer HPLASER [ DW+],                   ! Set Double Width N/A
printer HPLASER [ DW-],                   ! Cancel Double Width N/A
printer HPLASER [ LQ+],                   ! Set Letter Quality N/A
printer HPLASER [ LQ-],                   ! Cancel Letter Quality N/A
printer HPLASER [ ITALICS+],"\E(s1S"      ! Set Italics
printer HPLASER [ ITALICS-],"\E(s0S"      ! Cancel Italics
printer HPLASER [ PS+],"\E(s1P"           ! Set Proportional Spacing
printer HPLASER [ PS-],"\E(s0P"           ! Cancel Proportional Spacing

REM   NAME=EPSONDOT Epson Wide Carriage Dot Matrix & Compatibles
printer EPSONDOT INIT LPP 66,"\E@"                 ! Init using RESET command
printer EPSONDOT LPP 66 [COLS=80],12"\EP"          ! 10 CPI
printer EPSONDOT LPP 66 [COLS=96],12"\EP"        ! 10 CPI
printer EPSONDOT LPP 66 [COLS=100],12"\EP"       ! 10 CPI
printer EPSONDOT LPP 66 [COLS=120],12"\EP"       ! 10 CPI
printer EPSONDOT LPP 66 [COLS=132],12"\EP"       ! 10 CPI
printer EPSONDOT LPP 66 [COLS=158],"\EM"           ! 12 CPI
printer EPSONDOT LPP 66 [COLS=170],0F              ! 17.1 CPI
printer EPSONDOT LPP 66 [COLS=224],0F              ! 17.1 CPI
printer EPSONDOT [RESET+],"\E@"                    ! Reset all prior settings
printer EPSONDOT [LEGAL],                  ! START PRINTING ON LEGAL SIZE PAPER
printer EPSONDOT [LETTER],                 ! START PRINTING ON LETTER SIZE PAPER
printer EPSONDOT [CPI=10],12"\EP"       ! 10 CPI
printer EPSONDOT [CPI=12],"\EM"           ! 12 CPI
printer EPSONDOT [CPI=17],0F              ! 17.1 CPI
printer EPSONDOT [LPI=6],"\E2"            ! 6 Vertical LPI
printer EPSONDOT [LPI=8],"\E0"            ! 8 Vertical LPI
printer EPSONDOT [BOLD+],"\EE\EG"         ! Set Bold (Emphasized+Enhanced)
printer EPSONDOT [BOLD-],"\EF\EH"         ! Cancel Bold
printer EPSONDOT [DW+],0E                 ! Set Double Width
printer EPSONDOT [DW-],14                 ! Cancel Double Width
printer EPSONDOT [LQ+],"\Ex1"             ! Set Letter Quality
printer EPSONDOT [LQ-],"\Ex0"             ! Cancel Letter Quality
printer EPSONDOT [ITALICS+],"\E4"         ! Set Italics
printer EPSONDOT [ITALICS-],"\E5"         ! Cancel Italics
printer EPSONDOT [PS+],"\Ep1"             ! Set Proportional Spacing
printer EPSONDOT [PS-],"\Ep0"             ! Cancel Proportional Spacing

The preceding example would permit the program to specify PRN:/SELECT or PRN:/DEFAULT in place of PRN:/10, and after the printer was selected the appropriate printer init string would be executed. To do so, BR would tie the lengthy multi-word Windows printer description to the appropriate printer type and escape sequence.

BR PERMITS ANY MATCHING SUBSTRING after the SELECT keyword, so the following would also work:

PRINTER TYPE HPLASER  SELECT   Mary's
PRINTER TYPE EPSONDOT SELECT   Main

Descriptions that follow SELECT:

  • are case sensitive.
  • can be a substring (part of name).
  • are matched against the OPEN Name= value.
  • if no Name= match then matched against the selected printer name.

Printing in BR can be accomplished in a number of ways. A print job can be written to a file and then "copied" to a printer either programmatically or through the BR SPOOLCMD function. Alternatively BR can send the print job "DIRECTLY" to the printer by specifying the printer name. Or BR can use the services of the Windows(r) printer driver through NWP (Native Windows Printing). The use of NWP allows BR to provide a preview display of the print file, however NWP does not support all of the HP PCL coding that can be implemented by DIRECT printing when the print job is directed to a PCL compliant printer.

See also: SPOOLCMD, PAGEOFLOW, and Error Conditions


Opening a Print File

A print file or printer direction is a DISPLAY FILE (see Category:File Operations). The default length for a record of a display file is 128 characters, this can be changed in the open statement to be as large as 32,000. A record written to a display file by default is right trimmed and followed by a line ending sequence that is dependent upon the operating system. For example, a Windows system will append a carriage return and a line feed. The right trim of a display file record can be overridden by setting an option (see OPTION) only if the EOL code is changed to NONE.

Opening a display file with the number 255: uses the default BR printer configuration unless other parameters are specified in the open string.

00100 open #255:"name=PRN:WORD/\\\server1\\HP4,recl=32000,eol=NONE", display,output

The above line will open a printer that utilizes the BR SPOOLCMD functionality IF SPOOLCMD has been specified in the BRCONFIG.SYS file. The string "WORD" will be passed to the spoolcommand function in the position of the PRINTQUEUE parameter, no end of line characters will be added at the end of each line, all lines will be trimmed of any space characters between the last non-space and the end of the line, no line will be wrapped unless it exceeds 32,000 characters (Note that because the EOL is set to NONE there will never be any effective line wrapping.)

1.) Opening a display file with {\b Name=WIN:/nn} does the same thing as PRN:/nn except the use of SPOOLCMD is suppressed only for that file and the print job is directed to the Windows print driver for the named printer.
2.) Opening a display file with {\b Name=DIRECT:/nn} does the same thing as PRN:/nn except the use of SPOOLCMD is suppressed only for that file and the print job is directed to port specified by the Windows print driver for the named printer without having the output processed by the print driver.

3.) Opening a display file with {\b Name=PREVIEW:/nn} does the same thing as WIN:/nn except the print output is displayed as a preview after being processed by the printer driver, but before being sent to the named printer. See NWP only print codes for acceptable escape sequences for WIN and PREVIEW (NWP) mode.

If EOL is not set to NONE and it is desired that the print file, or display file, NOT be right trimmed then the file should not be opened as a display file, but rather as an EXTERNAL file (see Category:File Operations). If using an external file and EOL should be Carriage Return and Line Feed then the record length of the external file should be set a two characters longer than the desired record length and the last two positions of each line should be written with these characters (CHR$(13)&CHR$(10)).


Spooled Printing

Printer Name and Canceled Print Job

FILE$() now shows what printer was selected in the case of PRN:/SELECT. After the user selects the printer and OPENs it, FILE$(nnn) returns the name of the selected printer. If a print job is canceled during printer selection, the FILE$(nnn) returns "CANCELED" and FILE(nnn) will return 30.

Printer Reset

We have added support for the PRINTER RESET statement in BRConfig.sys for the Windows model. The format is:

  PRINTER [ type ] RESET, initialization string

The initialization string will be appended to each report formatted for the specified printer, or all printers if no type is specified.

As an aside, the following combination is supported in both new and old GUI models (3.92+):

  Printer name:  Lexmark Laser 123
  Open:    PRN:/123  -or-  PRN:/MARK

  PRINTER TYPE HP-WIN SELECT Lex
  PRINTER HP-WIN  INIT ....

This will apply the HP init string to the referenced printer.

printer HP-WIN  INIT "\\E(s2b3t17H"  ! NWP compressed

Note that when printing directly to an HP compatible printer (not NWP), it is sometimes necessary to specify HP in the INIT statement (see example). This causes BR to output certain key values that some printers require in order to print ordinary text. This pertains to versions 4.0 and later:

printer PRN: init HP

or if you want to have an escape sequence as well

PRINTER PRN: init HP, "\\E(s18v-whatever"
[E] ESC Key (used for generating your own PCL code)
*[RESET] Reset the printer, clearing all other specifications

You will need to send a [RESET] to the printer at the end of the job before you close the printer. Otherwise, you will find that the final page in the print job will stick in the printer, waiting for the user to tell it to finish.


Direct Printing

Direct Printing is printing direct to the port, formerly known as "pass-through" printing. Printer language and control vary for each printer, so for this reason this legacy method of printing has mostly been replaced with Native Windows Printing.

PCL and PJL are popular examples of the proprietary languages used by printers during the process of direct printing.

Printing directly to a network, indicated by NAME=PRN:/ can set a printer as the direct port printer, instead of the original PRN:/10

Also, another printer initialization keyword is supported for direct printing:

 PRINTER xxx INIT HP "..."

This adds certain required keywords to the printer initialization sequence. Some laser printers require these settings for Direct printing. They were previously provided automatically by pass-through printing (the predecessor to Direct printing).

The Printing article contains information about this and other printing processes.


SPOOLPATH and Client Server Printing Extensions

SPOOLCMD attempts to perform drive substitution before issuing the specified spool command.

For example:

DRIVE C:,\\SERVER2\BR_SHARED,zz,\COMPANY2
SPOOLCMD  COPY [SPOOLFILE] C:\REPORTS

Any reports printed to #255 will be copied to the \\SERVER2\BR_SHARED\REPORTS directory.

SPOOLCMD and SPOOLPATH had a case sensitivity conflict. BR creates wbspool files with lower case names.

Ctrl-P in Windows (or the Windows client) directs the screen print to PRN:/SELECT.

  • Client side reports* are always created in a spool file on the client. This includes both WIN:/ and 'SPOOLCMD @' reports.

Two SPOOLPATH statements are allowed, one for the server and one for the client. The client SPOOLPATH should have '@' right after the SPOOLPATH keyword (e.g. SPOOLPATH @ ...) to designate where on the client spool files should be placed.

SPOOLCMD now supports the -w flag which avoids the use of a DOS shell command when calling Windows applications directly. The new SPOOLCMD syntax is:

SPOOLCMD [@] [-w] command  parm-1 parm-2 ...

SPOOLCMD now honors BR drive substitution on the command itself. e.g. DRIVE J:,M:\\myapp,j,\\

SPOOLCMD J:\\mylib\spooler [SPOOLFILE] [COPIES]

This finds 'spooler' in M:\myapp\mylib.

NWP honors the pre-existing landscape/portrait settings.

SPOOLCMD calls use the -m flag (lower case) to enable batch file access for debugging purposes. -M calls do not appear on the task bar. -m calls do.

Printing was essentially rewritten to support Native Windows Printing and Remote Printing (available in 4.0 and 4.1).

Native Windows Printing

Native Windows Printing is commonly referred to as NWP, is a newer technology which allows BR! to print to any properly installed windows printer driver.

See also NWP.DOC.

Note that WIN: has new meaning with release 4.15+. It still overrides SPOOLCMD, but it also turns on NWP. See OPTIONS for instructions on how to suppress NWP.

Requirements

  • Must be BR! 4.0 or later, several features require 4.16+.
  • Must be BR! 4.18+ for Centering.
  • Must specify WIN:/.... as the device type. ( This can be done with SUBSTITUTE statements. )
Specify "CONFIG OPTION 31" to suppress NWP.
Specify "CONFIG OPTION 31 OFF" to resume NWP.

Error 6245 indicates an invalid or unsupported (by BR) escape sequence has been printed under Native Windows Printing. Note that such escape sequences are not processed until the end of each print line. So lines that end with a semicolon typically will not generate this error. This error can be suppressed with OPTION 32.

PCL is case sensitive. The last control character of an escape sequence must be a capital letter which signifies the end of the sequence.

Non-PCL keywords such as font= must be lower case.

Print Preview

To activate the Print Preview feature:

  Substitute WIN:/  PREVIEW:/

This will cause your Native Windows Printers to generate a report preview window before the report is actually printed.

There are two ways to use the print preview feature:

1.) by specifying the following in the BRConfig.sys:
Substitute WIN:/  PREVIEW:/
2.) by opening the printer with:
00100 OPEN #255: "name=preview:/select",display,output

This will cause your Native Windows Printers to generate a report preview window after the print setup window, before the report is actually printed.

As of 4.2, BR saves the PREVIEW window "position" and "maximized" settings across sessions.

During PREVIEW, clicking "Print (all)" produces a standard Windows print dialog box so the user can specify copies, range and other printing options.

The PREVIEW window continues to be non-modal (permitting multiple concurrent previews), but we suppress the raising of the initiating window in response to waiting for keyboard entry until the PREVIEW window is closed. This avoids the eclipsing of the preview window by the initiating window.

PrintScreen GUI

If the config statement PrintScreen GUI is specified in conjunction with a Windows printer (WIN:/printer or PREVIEW:/...) the printscreen will be graphical. Additionally, PrintScreen GUI implies WIN:/SELECT instead of PRN:/SELECT so it is not necessary to specify the PrintScreen device.

Test change 3

Epson Compatible Codes

Notation- 2 -> chr$(2) -> hex$("02")

'2' -> chr$(50) -> hex$("32") Codes that trigger print property changes:


\\r go to col 0 chr$(13) -> hex$("0D")
\\n line feed chr$(10) -> hex$("0A")
12 new page
27 escape
15 begin compressed print
18 end compressed print

Escape followed by

'0' 8 lines per inch
'2' 6 lines per inch
'4' begin italics
'5' end italics
'@' Epson - reset
'&' HP PCL code - see below
'(' HP PCL code - see below
'-' underline - 1 (on) or 0 (off) {\b e.g. "\\E-1"}
'_' overscore - 1 (on) or 0 (off)
'g' 15 cpi
'k' select typeface -

00000 - default    1 - roman    2 - swiss    3 - modern (fixed)
00004 - script     5 - decorative    6 - default

Also, for version 4.14, see list of specific facenames below.
'x' letter quality (1) or utility mode (draft - 0)
'E' begin emphasized printing
'F' end emphasized printing
'G' begin enhanced printing (letter quality)
'H' end enhanced printing
'M' 12 cpi - Elite
'P' 10 cpi - pica
'W' double width printing - 1 (on) or 0 (off)

HP Compatible Codes Supported By NWP

Escape '&' followed by

'l' letter L in lowercase and then a number (NWP supports fractions, HP doesn't), followed by: 'C' VMI (vertical motion index) number of 48ths of an inch
'D' Line Spacing - lines per inch 1,2,3,4,6,8,12,16,24,48
Both of the above codes set VMI.

'E' Top margin in lines (VMI increments) from the top of page. The default is 1/2 inch from the top of page.

'P' Page Length in lines
'F' Page Length in lines
These two values are treated synonymously by BR. They both set the bottom margin in relation to the top margin based on the current VMI. The default is 1/2 inch from the bottom.

'H' set paper source 4.17+ only

2 Manual Feed
3 Manual Envelope Feed
4 Paper Tray 2 (lower tray)
5 Paper Tray 3 (optional paper source)

Other paper source codes are available. However, because these codes are not universal and vary by printer you will need to query the printer driver to determine the proper code. This can be done by sending a simple print job to an NWP printer as WIN:\\SELECT. This option will allow you to select a windows printer and set the properties to the correct printer drawer or source. Once the print job has been processed BR will set an environmental variable named env$("XXXXXXX"). Typing PRINT ENV$("XXXXX)" from a command line will return the value needed to address the selected drawer.

'O' letter O, page orientation

0=portrait
1=landscape

Note: THIS MODE NEEDS TO BE SELECTED BEFORE ANY OTHER OPTIONS.

'A': designates the size of the paper which in turn defines the size of the logical page

1 - Executive (7.25 x 10.5 in.)
2 - Letter (8.5 x 11 in.)
3 - Legal (8.5 x 14 in.)
6 - Ledger (11 x 17 in.)
26 - A4 (210mm x 297mm)
27 - A3 (297mm x 420mm)
ENVELOPES
80 - Monarch (Letter - 3 7/8 x 7.5 in.)
81 - Com-10 (Business - 4 1/8 x 9.5 in.)
90 - International DL (110mm x 220mm)
91 - International C5 (162mm x 229mm)
100 - International B5 (176mm x 250mm)

'a' reposition in 720ths of an inch (decipoints) BR 4.14+ only
'V' number of decipoints from top of page
'H' number of decipoints from left edge
'C' number of columns (CPI units) from left edge
'R' number of rows (VMI units) from top of page

Specify plus or minus ahead of the number for relative positioning.

Examples- 
"\\E&l1O" Set page orientation.. must come before other sequences.
"\\E&ll6D" Set to 16 lines per inch.
"\\E&l40P" Set to 40 lines per page.
"\\E&a720h1440V" Set position to one inch from the left margin and two inches from the top margin. (BR 4.14+ only)

'f' stack (0) or restore (1) current page position
'S' terminate save or restore value

' The stack depth is 20.


'k'
'G' line termination

0:CR=CR, LF=LF, FF=FF
1:CR=CR+LF, LF=LF, FF=FF
2:CR=CR, LF=CR+LF, FF=FF
3:CR=CR+LF, LF=CR+LF, FF=CR+FF "\\E&k3G" Set to CR=CR+LF, LF=CR+LF, FF=CR+FF

'H': set horizontal motion index (HMI)

the number of 1/120's of an inch per character
fixed fonts use CPI instead
normally the size of one blank character

'S' 0: uncompressed 10 cpi

2: compressed 16.67 cpi
4: uncompressed 12 cpi

Escape '(' followed by Symbol set selection, language, etc. *cannot combine commands
's': e.g. for Stroke Weight: Ec(s#B
'B' Stroke Weight -7 --0-- +7

'H' Pitch in characters per inch, e.g. 10 = 10 cpi
'S' Style|0: normal

1: italics

'T' TypeFace Family|0 - default

1 - roman
2 - swiss
3 - modern (fixed)
4 - script
5 - decorative
6 - default

'T' Specific TypeFace (version 4.14 only)

Value Family Name
00000 MODERN "Line Printer"
04099 MODERN "Courier New"
04101 ROMAN "CG Times"
04102 MODERN "Letter Gothic"
04113 SWISS "CG Omega"
04116 SCRIPT "Coronet"
04140 ROMAN "Clarendon Condensed"
04148 SWISS "Univers"
04168 SWISS "Antique Olive"
04197 ROMAN "Garamond"
04287 SCRIPT "Marigold"
04362 SWISS "Albertus Medium"
16602 SWISS "Arial"
16901 ROMAN "Times New Roman"
16686 ROMAN "Symbol"
31402 DECORATIVE "Wingdings"

[\RTFBOX]

'V' font height in points ( 72nd of an inch ) *can be fractional
eg. "\\E(s17h4102t2B" Set to 17cpi, letter gothic, bold weight
Note- only the last terminator character should be capitalized.

version 4.14+ only
Escape '*' followed by

(see the HP PCL.PDF file for examples of fill chars)

p - reposition on page
'X' number of PCL units(pixels) from the left edge.
Specify plus or minus ahead of the number for relative positioning. *see &a#H and &a#V for decipoint positioning. -

'Y' number of PCL units from the top edge.

c - fill space

'H' horizontal fill distance in decipoints
'V' vertical fill distance in decipoints

On an HP printers you can specify patterns and and corresponding images to be applied to the bitmap workspace. Many effects are possible. Text may be greyed or striped like a candy cane.

    • First the pattern (small bitmap - tiled) is used to fill the image, which may be a graphic image or a font character. Then the result is applied to the bitmap space.**

Both applications are performed in accordance with transparency settings (0 = logical OR, 1 = copy).

'G' set the current shading or cross hatch pattern
The HP_PCL.PDF file describes the available shading and cross hatch patterns on pages 274-276.

'P' FILL the Horizontal/Vertical area using:

00000 black (default)
00001 white
00002 shaded (based on *c#G value)
00003 cross-hatch  (based on *c#G value)
00005 use current pattern mode (*v#T value)
v

'T' set the current pattern mode

00000 black (default)
00001 white
00002 shaded (based on *c#G value)
00003 cross-hatch (based on *c#G value)

Note- *v#T is not supported by BR except to support *c5P.

'N' set the 'apply image' transparency mode

00000 is transparent (ORs bits), 1 is opaque (copies bits).

The net result is that white bits are copied in opaque mode, whereas source white bits are ignored in transparent mode.
Note that *v1N copies the framing whitespace of an image or font character.

'O' (letter oh) set the 'apply pattern' mode

00000 is transparent (ORs bits), 1 is opaque (copies bits).

'p' pattern rotation

'R' this command is ignored by BR

This will apply the HP init string to the referenced printer:.
printer HP-WIN INIT "\\E(s3b17H"  ! NWP compressed
printer HP-WIN INIT "\\E(s2b3t17H"  ! NWP compressed

HP and NWP Font Sizing and Positioning

Non-Proportional (fixed width) fonts vary in height based on characters per inch (CPI). Proportional fonts ignore CPI specifications.

HP PCL Compatible equipment chooses font sizes from among those available based on several characteristics that may be specified (mainly font height). This is true for both proportional and fixed fonts. HP equipment does no stretching of font height or width.

Windows, allows for independent specification of true type font height versus width. Under NWP the font height, width of a space character, and the vertical movement to go to the next line are all specified independently. The affect of this is dependent on whether the selected font is proportional or fixed width.

Fixed width fonts are stretched by Windows as needed to meet specifications. Proportional fonts are not stretched, but they are scaled based on height.

NWP considers CPI and LPI when positioning and boxing with both fixed and proportional fonts.

Positioning can be done in terms of rows and columns, 720ths of an inch (decipoints), PCL units (pixels), or simply inches (with decimal fractions). Font pitch (width) is given in CPI. Font height is given in points (72/inch). Picture sizes are given in inches.

The following statements will set the Printer into Proportional Spacing mode.

*[PS] Set Proportional Spacing
*[/PS] Cancel Proportional Spacing


Proportional Spacing is Character spacing based on the width of each character. The printer must be set into this mode before you may change the font size, or use any proportional fonts.

HP Hardware Font Selection Methodology

HP printers select font based the following criteria in order of importance.

1.) Symbol Set - the characters this font contains
2.) Spacing - proportional or non-proportional (fixed width)
3.) Font width - if spacing is fixed, the width of the font is very important
4.) Height - point size (this is regarded as less important then width)
5.) Style - italics, outline, boldness (how dark and bold it is)
6.) Typeface - the specific font that is specified
7.) Resolution
8.) Location
9.) Orientation

On an HP printer the typeface is given the lowest priority. In NWP typeface is given the highest priority.

Symbol set and Spacing are ignored. On an HP printer, font can be set as condensed or expanded. In NWP, this is reflected by changing the font width. On an HP printer, fonts are always scaled the same in both axis. In NWP, we scale the fonts in a manner that allows both CPI and font height to be set.

HMI and VMI (Horizontal and Vertical Motion Indicators)

An HP printer has a separate concept for HMI and VMI - the horizontal and vertical motion indexes. This is how far the cursor moves for a newline or when printing a character (fixed spacing only). In an HP printer, setting the font PITCH sets the HMI, but setting HMI does not set pitch. VMI and font height are completely separated.

In NWP, this separation between HMI, VMI, font width, and font height is not always made. In addition, NWP only honors HMI for the tab character. It does not currently honor HMI for the space character or for fixed pitch fonts.

NWP Only Codes

Font Selection

NWP adds support for a totally new way to implement font changes in your programs. With NWP, we have added a new Escape sequence that allows you to set your font to any of the installed fonts on your computer. The command looks like this:

\\Efont='fontname'

e.g.

brconfig.sys  PRINTER HP [Tahoma], "\\Efont='Tahoma'"
00020 PRINT #255: [Tahoma]

Note- All such keywords such as "font=" must be lower case, but Tahoma is case insensitive in both instances.

Printer.sys includes a few pre-mapped font substitute statements to make this even easier.
[FONT_MICR]|Sets the font to Micr
[FONT_TIMES]|Sets the font to Times New Roman
[FONT_ARIAL]|Sets

the font to Arial

[FONT_LINEPRINTER]|Sets the font to Line Printer
[George Tisdale]|Sets Font to Blue Regular 12 pt Arial
[FONT]|becomes "\\Efont=". Specify any font such as [FONT]'WingDings'

Font Sizes

If you want to change the font size, you can even do that!

[TINY] 6 pt font
[SMALL] 8 pt font
[LITTLE] 10 pt font
[MEDIUM] 12 pt font
[ESSAY] 14 pt font
[LARGE] 18 pt font
[155POINT] 15.5 pt font


One thing to note, printer.sys is just a brconfig.sys file, and it can easily be customized and modified. If you need a font size that I left out, or if you want easier to remember names, these changes are very easy to implement. And many of these options can be simplified by using "Parameterized Substitution Values", which is discussed later in this chapter.

Page Position

You can specify POSITION on the page as:

\\Eposition='horizontal,vertical'

Where 'horizontal' and 'vertical' are given as inches from the edge of the page, or may be signed to denote inches from the current position.

Bold/Underline/Italics

These next few statements control various common font modifiers.[UNDERLINE] [/UNDERLINE][ITALICS] [/ITALICS][BOLD] [/BOLD]

Font Color

With NWP, we have implemented an easy way to make Colors work, as well. Its actually remarkably similar to the syntax for FONTS. It looks like:

Current font COLOR may be specified as
\\Ecolor=#rrggbb, eg.
The following colors are predefined for your printing pleasure (only in NWP)

[RED]
[GREEN]
[BLUE]
[MAGENTA]
[CYAN]
[YELLOW]
[ORANGE]
[PURPLE]
[BLACK]
[WHITE]

The following substitution statement is also available:

[COLOR].....Becomes "\\Ecolor=". Specify any html color such as [COLOR]'#0000FF'

Underline/Overline

NWP has its own syntax for specifying Underline and Overline.

[UNDERLINE] becomes "\\E-1" Turn on Underline
[/UNDERLINE] becomes "\\E-0" Turn off Underline
*[OVERLINE] becomes "\\E_1" Turn on Overline
*[/OVERLINE] becomes "\\E_0" Turn off Overline
Rotation

One of the remaining advantages to using PCL is the ability to print in different directions on the page. This can be done in PCL with the following:

*[ROTATE0] Sets the page direction normal
*[ROTATE90] Sets the page direction to 90° CC
*[ROTATE180] Sets the page direction to 180° CC
*[ROTATE270] Sets the page direction to 270° CC
Position

The following commands all set the position. You can reset the position to the top left of the page, or you can modify the commands in the text file to reset the position to any specific location on the page you want. You may also, of course, simply print the PCL codes.

[TOPLEFT] Places the cursor at the top left of the page


The PCL command for positioning allows for three ways to set the current position. You may do it based on Decipoints (1/720h of an inch). You may also set the position based rows and columns, or PCL units (pixels). If you append a +/- to the position numbers, you will set the relative position, relative to the current cursor position.

The following syntaxes work for setting the position. YYY is the vertical coordinate, and XXX is the horizontal coordinate. \\E represents the escape character.

"\\E&aYYYvXXXh" Set Position in Decipoints
"\\E&aYYYrXXXC" Set Position in Rows and Columns
"\\E*pYYYyXXXx" Set Position in PCL units


With NWP, you have one additional option for setting your cursor position. There is a new NWP only escape sequence: "\\Eposition='x,y' ". If you prefix your numbers with a +/- then BR will interpret them as a relative position, and it will simply adjust from the current position. Position must be specified in Inches for this new escape sequence.

A single substitution statement has been added to aid you with this. It is simply:

  • [POSITION]|Becomes "\\Eposition=". Set the cursor to any position. An example of its usage would be:
00200 PRINT #255: "[POSITION]'3,2'The Middle."

Position may else be specified with "Parameterized Substitution Values", discussed in this chapter.

You might make some statements like the following (which are already in printer.sys):

*[TOPLEFT] "\\Eposition='0,0'" ! Set cursor to top left
*[SHIFTDOWN] "\\Eposition='0,+1'" ! Move cursor right one inch


With NWP, you may, of course, also use the PCL style positioning statements.

Printing Pictures

It's really nice to be able to print pictures. Hot off the press for the new NWP is the ability to print full color pictures straight from a file, using one simple escape sequence. This escape sequence is:

\\Epicture='width,height,imagefile.jpg [: TILE|NORESIZE|ISOTROPIC ]'

Where 'width' and 'height' are given in inches, and the remainder of the image specification matches that of New GUI Console pictures.

NWP will print any file that you can display, including jpg, gif, bmp, ico, and many others. If you have a color printer, they will be printed in color.

There is again a simple substitute statement for the use of this new escape function.

[PICTURE] becomes "\\Epicture=".................Use like [PICTURE]'2,2,logo.jpg'


I would suggest using a picture statement with a position statement. To print a logo in the top right of the page, you would say:

00300 PRINT #255: "[POSITION]'6,0'[PICTURE]'2,2,logo.jpg'"

....or....

00300 PRINT #255: "[PUSH][POSITION]'6,0'[PICTURE]'2,2,logo.jpg'[POP]"

....to restore the cursor to its original position. These statements will print the logo.jpg file 2 sq" in the top right corner of the page.

[E]|ESC Key (used for generating your own PCL code)

Paper Source

A new NWP only syntax is supported for paper tray selection. When you print to WIN:/SELECT or PREVIEW:/SELECT then you are given the opportunity to select a paper source tray. Then a new ENV$ keyword can be used to obtain a number associated with the paper source:

TRAY$ = ENV$("LAST_TRAY_SELECTED")

Finally the value associated with the selection can be applied as [ \\Etray='value' ] to specify that the paper should be taken from that source. Note that paper tray selection and page orientation must be specified before printing any displayable data.

Page Setup Options

The following Substitute codes work in NWP. Those with a * will work only in NWP.

Initial configuration

The following must be done before anything is printed to the printer.

[PORTRAIT] Sets the printer to print portrait
[LANDSCAPE] Sets the printer to print landscape


The next six settings change the logical page size for printing on different sized pages
[EXECUTIVE] Set the logical page for Executive size paper (7.25 x 10.5)
[LETTER] Set the logical page for Letter size paper (8.5 x 11)
[LEGAL] Set the logical page for Legal size paper (8.5 x 14)
[LEDGER] Set the logical page for Ledger size paper (11 x 17)
[A4PAPER] Set the logical page for A4 size paper (210mm x 297mm)
[A7PAPER] Set the logical page for A7 size paper (297mm x 420mm)


The next five settings change the logical page size for printing on envelopes
[MONARCH] (3 7/8 x 7.5)
[COM-10] (4 1/8 x 9.5)
[INTERNATIONAL DL] (110mm x 220mm)
[INTERNATIONAL C5] (162mm x 229mm)
[INTERNATIONAL B5] (176mm x 250mm)


The following six options set the paper source. By default it is set to Auto, and can be changed in printer preferences
[PAPERSOURCEAUTO] Feed from Printer Default
[PAPERSOURCEMANUAL] Feed from manual feeder
[PAPERSOURCEMANUALENVELOPE] Feed Envelope from manual feeder
[PAPERSOURCETRAY2] Feed from Lower Tray
[PAPERSOURCEOPTIONAL] Feed from Optional Input
[PAPERSOURCEOPTIONALENVELOPE] Feed from Optional Envelope Feeder (Must set to Envelope size first)
Real Time Printing

All of the following PCL commands can be executed in the middle of a printing job.

The following commands modify the LPI settings for the printer:[4LPI] [6LPI] [8LPI] [10LPI]
This setting controls the number of lines printed per inch vertically on the page.
The following commands modify the CPI settings for the printer:[4CPI] [6CPI] [8CPI] [10CPI] [12CPI] [14CPI] [17CPI] (16.7) [20CPI] This setting controls the number of characters printed per inch horizontally on the page.
Boxing & Shading

Perhaps the most exciting new feature of Native Windows Printing is a new NWP-only escape sequence for printing Boxes and Shading. With this command, it has never been easier to generate grids and boxes, columns and tables for all your reporting needs.

The way it works is simple. You simply turn Boxing on, and all the text you print is covered at the top and bottom with a box border. To print the sides of the box, you simply need to print a "" (pipe) character. BR will replace the pipe character with a line drawn at the correct place (according to the current CPI settings) to make a column border, or the edge of the box, except that proportional text can force the closing sidebar to the right.

You may use the escape sequence "\\Ebegin_box" to turn on boxing.

If you wish to print only the sides and the top of the box, you may do so by printing "\\Ebegin_boxtop". This will print the border on the top, and it will print a vertical border anywhere you print a "". This is in case you would like to print a box that spans multiple rows.

When you then want to print the bottom of the box, you may send the escape sequence "\\Ebegin_boxbottom". This will print a line below the text, but not above. The "" symbols will still be interpreted as vertical borders.

For all those rows in the middle of the box, you have the command "\\Ebegin_verticals". This will print nothing on the top or the bottom, but it will still print the vertical bar wherever you print a "".

Finally, to turn off boxing features, simply issue an "\\Eend_box" command.

Occasionally it is necessary to extend a field to the length it would be if it contained vertical box lines. e.g.

------------------------------|------------------------|-------------|
  xxxxxxxxxxxxxxxxxxx         |  xxxxxxxxxxxxx         |  xxxxxxxxxx |
------------------------------|------------------------|-------------|
  xxxxxxxxxx                  |   an extended field is needed here   |
------------------------------|--------------------------------------|

This can be done by appending a CHR$(5) character to the field contents. That will cause a fill character to be added to the printed field length. CHR$(5) is recognized only in one of the BOXING modes.

To make your reports look extra nice, we have included two commands to turn on and off shading. This will shade the background of the text using the current shade density. This is great for lightly shading every second row of a report so that they stand out, and its easy to see what goes with what. To turn shading on, issue a "\\Ebegin_shade". To turn it back off, issue an "\\Eend_shade" command.

To change the current shading density by hand, I am afraid, you will have to resort to good old PCL. The command to do this is ""\\E*c##G" where ## is the shading density, by percent.

\\E*c20G \\Ebegin_shade set shading density to 20 percent and begin

\\Eend_shade

\\Ebegin_boxtop = enclose sides and above
\\Ebegin_boxbottom - enclose sides and below
\\Ebegin_verticals - enclose only sides
\\Eend_box - end box mode

Possible configuration statements in BRConfig.sys might include:

PRINTER NWP [BOX], "\\Ebegin_box"
PRINTER NWP [BOXTOP], "\\Ebegin_boxtop"
PRINTER NWP [BOXOVER], "\\Ebegin_boxtop"
PRINTER NWP [BOXVERTICALS], "\\Ebegin_verticals"
PRINTER NWP [SIDES], "\\Ebegin_verticals"
PRINTER NWP [BOXBOTTOM], "\\Ebegin_boxbottom"
PRINTER NWP [BOXUNDER], "\\Ebegin_boxbottom"
PRINTER NWP [NOBOX], "\\Eend_box"
PRINTER NWP [SHADE], "\\E*c20G\\Ebegin_shade"
PRINTER NWP [NOSHADE], "\\Eend_shade"

Luckily, {\b printer.sys} has the following shortcuts defined to help you out.

[BOX] Begin Box Mode
[/BOX] End Box Mode
[BOXTOP] Begin Box Top Mode
[BOXOVER] Synonym for BOXTOP
[BOXVERTICALS] Begin Box Verticals
[BOXSIDES] Synonym for BOXVERTICALS
[BOXBOTTOM] Begin Box Bottom
[BOXUNDER] Synonym for BOXBOTTOM
[SHADE] Turn on Shading
[/SHADE] Turn off Shading
[SET_SHADE0] White
[SET_SHADE20] Light
[SET_SHADE40] Kinda Light
[SET_SHADE60] Kinda Dark
[SET_SHADE80] Dark
[SET_SHADE100] Black
Push/Pop

Next we have commands for storing the current position on the Stack. This will save the current position into printer memory and allow you to do anything you want with it. When you are done doing what you wanted to do, you may then pop the value back off the stack, and the cursor goes right back to where it was. The syntax is:

[PUSH] Push!
[POP] *Pop*


HP Printers have a stack in their printer memory which you can use to store the current position. Use the stack to save the current cursor position with a [PUSH] command. You many move it wherever you like and print whatever you like, and when you are ready to continue from where you left off, you simply [POP] and the cursor goes right back where it was. A stack is like a FOR loop, you can nest your [PUSH] and [POP] statements.

One great use I can see for these commands is functions that you wish to use to place graphics on your printout. It would be a nice idea for a polite function in modern society to push the current cursor position before processing (to draw a box or whatever) and then pop the cursor position back to where it was. This way, if you are in the middle of printing a report, and you want to put lines on the report to underline something while you know where you are, you can call your function. When you are done, the function will place you right back where you were before you called it, and you may just finish printing the line as usual.

Parameterized Substitution Values

We have a new format for specifying printer substitute statements. The format works as follows:

Currently, you may specify the shading density with a substitute statement such as the following:

PRINTER NWP [SET_SHADE20], "\\E*c20G"

With this new syntax, you will be able to specify a value to pass to the substitution statement which will be placed in the actual replacement text of the statement, as follows:

PRINTER NWP [SET_SHADE(Percent)], "\\E*cPercentG" ! Set to whatever you want

Now you may use a printing statement such as the following:

PRINT #255: "[SET_SHADE(57)]"

And the correct codes would be generated to set the shading density to 57 percent.

With this new syntax, the following items are available (Note "*" items work ONLY with NWP:

[SETDPPOSITION(YYY,XXX)] Set Position in Decipoints
[SETRCPOSITION(YYY,XXX)] Set Position in Rows and Columns
[SETPCLPOSITION(YYY,XXX)] Set Position in PCL units
*[SETPOSITION(xx,yy) Set Position in inches
[SET_SHADE(Percent)] Sets the Shading percent
[SETFONT(FontNumber)] Set current font by number
[SETSIZE(PointSize)] Set current font size
[CPI(XXX)] Set CPI
[SETSTYLE(StyleCode)] Set current font style
*[SETCOLOR(CLRCODE)] Set the Color
[PAPERSOURCE(PSCode)] Set the current paper source
*[SHOWPICTURE(2,2,Logo.jpg)] Show a picture called Logo.jpg 2" by 2"
*[SHOWISOPICTURE(YY,XX,IMGNAME)] Show a picture Isotropically
*[SHOWTILEPICTURE(YY,XX,IMGNAME)] Tile a picture

Old

BRconfig.sys PRINTER statements have traditionally supported:

PRINTER identifier [mode-setting], escape-sequence, e.g.

PRINTER Laserjet [8-LPI], "\\E&l8D"

Then in the program you can activate the setting with:

02000 Print #255: "[8-LPI]";

New

The above method requires a separate configuration statement for each possible LPI setting. We have since added the capability of specifying in the print process values to be substituted in the actual escape sequences as in:

02000 Print #255: "[LPI(8)]";

Then the configuration statement would read:

PRINTER Laserjet [LPI(XXX)], "\\E&lXXXD"

Where XXX is any unique case sensitive identifier.



NWP Color Shading

In versions 4.2 and higher NWP supports color shading via the specification "\Eshade_color='#rrggbb'". This works in conjunction with the other NWP shade syntax. Note that if no shading is implemented the this specification has no effect.

BR now saves the PREVIEW window "position" and "maximized" settings across sessions.

During PREVIEW- Print (all) produces a standard Windows print diaglog box so the user can specify copies, range and other printing options.

Windows Themes Suppression

Sometimes themes alter the way Windows displays fields (elements within controls). For example different themes may display buttons and captions differently, including rounding corners and highlighting. Future versions of windows may do different things when it comes to displaying controls which may affect the colors and shapes of displayed fields.

Microsoft first began using themes with XP. The 'classic look' is the Windows 2000 appearance, which is what is produced when themes are suppressed. Vista permits users to select from among several themes as a part of the user's desktop settings. Sometimes theme processing can slow down the display of large quantities of data, and sometimes it can create an appearance that is less desirable than the classic look.

In versions 4.2 and higher BR offers three methods for suppressing the use of Windows Themes:

A new field attribute is defined that may be specified in ATTRIBUTE statements and in FIELDS leading attributes:

^NOTHEME    indicates prevent use of Windows Themes

OPTION 50 ! suppress Windows themes for text boxes only

Config WINDOWS_THEMES OFF | ON This entirely suppresses the use of Windows themes.

Field Justification

(As of 4.2) CHR$(6) implies right justify the previous field for printed output. This works just like \Eright_justify except \Eright_justify applies to the following text whereas CHR$(6) pertains to the preceding text.

Page Number

\Epage_number - is replaced with the page number.

Duplex Printing

NWP supports DUPLEX printing ( &l#S )where: 0 indicates simplex 1 indicates duplex long edge 2 indicates duplex short edge

Cursor Positioning Mode

\Emove_cursor - moves the cursor.

\Estop_cursor - mode where the cursor does not move horizontally except when tabbing.

  • Center uses the current position as the center
  • Right justify uses the current position as the right endpoint
  • The cursor does not move when printing text
  • Newline positioning is honored, but carriage return positioning is ignored.
  • Tab positioning is honored

Printer.Sys

Printer.sys is an easy way to do NWP and PCL (Printer.CLS adds HTML and Text). By taking advantage of various printer substitution statements, you now have an easier way to take advantage of BR's printing features.

There are a few things you can do with PCL that you still cannot do using NWP, but the programmers of Business Rules! are working to give the NWP programmer access to a very comprehensive set of PCL coding and features.

There are also several NWP only features - new escape sequences which BR! will interpret to do many powerful things not easily available in PCL.

Note: Printer.sys is just a brconfig.sys file, and it can easily be included customized and/or modified. If you need a font size that I left out, or if you want names that are easier to remember, these changes are very simple to implement. Just include your changes after you include Printer.Sys. BR! uses the last occurrence of each matching Printer substitution statement.

Printer.Sys is a shared project in which standardized printer substitutions are shared by everyone who uses it. Printer.sys was originally developed by Gabriel Bakker.

Printer.Sys

Welcome to printer.sys. This document is divided into two sections. The first section explains the syntax available for PCL, and the second explains the syntax available for NWP printing.

PCL

The following Substitute codes work in PCL. Those with a * will work only in PCL.

Initial configuration

Orientation

The following must be done before anything is printed to the printer.

  • [PORTRAIT] Sets the printer to print portrait
  • [LANDSCAPE] Sets the printer to print landscape
Paper Size
Standard

The next six settings change the logical page size for printing on different sized pages.

  • [EXECUTIVE] Set the logical page for Executive size paper (7.25 x 10.5)
  • [LETTER] Set the logical page for Letter size paper (8.5 x 11)
  • [LEGAL] Set the logical page for Legal size paper (8.5 x 14)
  • [LEDGER] Set the logical page for Ledger size paper (11 x 17)
  • [A4PAPER] Set the logical page for A4 size paper (210mm x 297mm)
  • [A7PAPER] Set the logical page for A7 size paper (297mm x 420mm)
Envelope

The next five settings change the logical page size for printing on envelopes.

  • [MONARCH] (3 7/8 x 7.5)
  • [COM-10] (4 1/8 x 9.5)
  • [INTERNATIONAL DL] (110mm x 220mm)
  • [INTERNATIONAL C5] (162mm x 229mm)
  • [INTERNATIONAL B5] (176mm x 250mm)
Paper Source*

The following six options set the paper source. By default it is set to Auto, and can be changed in printer preferences.

  • [PAPERSOURCE AUTO]* Feed from Printer Default
  • [PAPERSOURCE MANUAL]* Feed from manual feeder
  • [PAPERSOURCE MANUALENVELOPE]* Feed Envelope from manual feeder
    • (Must set to Envelope size first)
  • [PAPERSOURCE TRAY2]* Feed from Lower Tray
  • [PAPERSOURCE OPTIONAL]* Feed from Optional Input
  • [PAPERSOURCE OPTIONALENVELOPE]* Feed from Optional Envelope Feeder
    • (Must set to Envelope size first)
  • [PAPERSOURCE(SOURCE)]* Set the current paper source
    • SOURCE is the PCL Paper Source Code
Copies*

The following option will set the printer to print multiple copies.

  • [COPIES(##)]* Will generate the pcl to make any number of copies

Use it like “[COPIES(14)]” to generate the pcl to instruct the printer to make 14 copies.

Duplex Mode*

These three options set the printer to print in Duplex mode.

  • [SIMPLEX]* Standard one sided printing
  • [DUPLEX]* Long edge binding double sided environmental printing
  • [DUPLEX SHORTEDGE]* Short edge binding double sided printing

Long edge binding is like your standard book. Short edge binding would be used for a calendar or one of those funky long picture books.

Top Margin

The following six options set the top margin: how many rows at the top of the logical page to reserve for blank space.

  • [TOP0] Begin printing at the top of the logical page
  • [TOP1] Skip one line, then begin printing
  • [TOP2] Skip two lines, then begin printing
  • [TOP3] Skip three lines, then begin printing
  • [TOP4] Skip seventeen lines, then begin printing
  • [TOP5] Skip five lines, then begin printing
  • [TOP(##)] Skip ## lines, then begin printing

Real Time Printing

All of the following PCL commands can be executed in the middle of a printing job.

LPI

The following commands modify the LPI settings for the printer:

 [4LPI]
 [6LPI]
 [8LPI]
 [10LPI]
 [LPI(##)]

This setting controls the number of lines printed per inch vertically on the page.

CPI

The following commands modify the CPI settings for the printer:

 [4CPI]
 [6CPI]
 [8CPI]
 [10CPI]
 [12CPI]
 [14CPI]
 [16CPI]
 [20CPI]
 [CPI(##)]

This setting controls the number of characters printed per inch horizontally on the page.

Font Changes

The next couple substitution statements are examples of the PCL syntax for setting fonts. These codes are supported under NWP, but we also have a better way to do this in NWP.

 [FONT TIMES]                  Times New Roman
 [FONT ARIAL]                  Arial
 [FONT LINEPRINTER]            Good ole fashioned Line Printer
 [SETFONT(FontNumber)]*        Set current font by number (see HpPcl.pdf)
 NOTE: setfont works in NWP as well, but you specify your font by name instead of number.
Font Size

If you want to change the font size, you can even do that!

 [TINY]                        6 pt font
 [SMALL]                       8 pt font
 [LITTLE]                      10 pt font
 [MEDIUM]                      12 pt font
 [ESSAY]                       14 pt font
 [LARGE]                       18 pt font
 [JUMBO]                       36 pt font
 [GARGANTUAN]                  96 pt font
 [155POINT]                    15.5 pt font
 [SETSIZE(PointSize)]          Set current font size

Remember: printer.sys is just a brconfig.sys file, and it can easily be customized and modified. It's easy to customize the names or font sizes available for use.

Bold/Underline/Italics

These next few statements control various common font modifiers.

 [UNDERLINE] [/UNDERLINE] [UL] [/UL]
 [ITALICS] [/ITALICS]
 [BOLD] [/BOLD]
Rotation*

One of the remaining advantages to using PCL is the ability to print in different directions on the page. This can be done in PCL with the following:

 [ROTATE0]*                    Sets the page direction normal
 [ROTATE90]*                   Sets the page direction to 90
 [ROTATE180]*                  Sets the page direction to 180
 [ROTATE270]*                  Sets the page direction to 270 CC
Position

The following commands all set the cursor position:

 [TOPLEFT]                     Places the cursor at the top left of the page
 [DECIPOS(XXX,YYY)]            Set Position in Decipoints
 [ROWCOL(XXX,YYY)]             Set Position in Rows and Columns
 [POS(XXX,YYY)]                Set Position in Rows and Columns
 [PCLPOS(XXX,YYY)]             Set Position in PCL units

The PCL command for positioning provides three ways to set the current position. You may do it based on Decipoints (1/720th of an inch). You may also set the position based rows and columns, or PCL units (pixels). If you append a +/- to the position numbers, you will set the relative position, relative to the current cursor position. XXX is the horizontal coordinate, and YYY is the vertical coordinate.

Push/Pop

Next we have commands for storing the current position on the Stack. This will save the current position into printer memory and allow you to do anything you want with it. When you are done doing what you wanted to do, you may then pop the value back off the stack, and the cursor goes right back to where it was. The syntax is:

 [PUSH]                        Push!
 [POP]                         *Pop*


HP Printers have a stack in their printer memory which you can use to store the current position. Use the stack to save the current cursor position with a [PUSH] command. You many move it wherever you like and print whatever you like, and when you are ready to continue from where you left off, you simply [POP] and the cursor goes right back where it was. A stack is like a FOR loop; you can nest your [PUSH] and [POP] statements.

One great use I can see for these commands is functions that you wish to use to place graphics on your printout. It would be a nice idea for a polite function in modern society to push the current cursor position before processing (to draw a box or whatever) and then pop the cursor position back to where it was. This way, if you are in the middle of printing a report, and you want to put lines on the report to underline something while you know where you are, you can call your function. When you are done, the function will place you right back where you were before you called it, and you may just finish printing the line as usual.

Proportional Spacing*

The following statements will set the Printer into Proportional Spacing mode.

 [PS]*                         Set Proportional Spacing
 [/PS]*                        Cancel Proportional Spacing

Proportional Spacing is Character spacing based on the width of each character. The printer must be set into this mode before you may change the font size, or use any proportional fonts. The fonts that we have shortcuts for will automatically set [PS] mode accordingly, so they will work, but you will need [PS] mode anytime you wish to set your own fonts.


ESC Key
 [E]                           ESC Key (used for generating your own PCL code)

Parameterized Substitute Statements

We have a new format for specifying printer substitute statements.

With the old syntax, you are able to specify the number of copies with a substitute statement such as the following:

 PRINTER PCL [COPIES10], “\E&l10X”

With the new syntax, you are able to specify a value to pass to the substitution statement that will be placed in the actual replacement text of the statement! For example:

 PRINTER PCL [COPIES(YYY)], "\E&lYYYX" ! Print as many as you want

Now you may use a printing statement such as the following:

 PRINT #255: “[COPIES(57)]”

And the correct PCL would be generated to set the printer to print 57 copies.

NWP

The following Substitute codes work in NWP. Those with a * will work only in NWP. In this document [E] represents chr$(27), the ESC key. You may use [E] directly in your programs, as long as you are using printer.sys.

Initial configuration

Orientation

The following must be done before anything is printed to the printer.

 [PORTRAIT]                    Sets the printer to print portrait
 [LANDSCAPE]                   Sets the printer to print landscape
Paper Size
Standard

The next six settings change the logical page size for printing on different sized pages.

 [EXECUTIVE]                   Set the logical page for Executive size paper (7.25 x 10.5)
 [LETTER]                      Set the logical page for Letter size paper (8.5 x 11)
 [LEGAL]                       Set the logical page for Legal size paper (8.5 x 14)
 [LEDGER]                      Set the logical page for Ledger size paper (11 x 17)
 [A4PAPER]                     Set the logical page for A4 size paper (210mm x 297mm)
 [A7PAPER]                     Set the logical page for A7 size paper (297mm x 420mm)
Envelope

The next five settings change the logical page size for printing on envelopes.

 [MONARCH]                     (3 7/8 x 7.5)
 [COM-10]                      (4 1/8 x 9.5)
 [INTERNATIONAL DL]            (110mm x 220mm)
 [INTERNATIONAL C5]            (162mm x 229mm)
 [INTERNATIONAL B5]            (176mm x 250mm)
Dot Matrix Compatability Settings*

NWP contains several formatting options for printing on older dot matrix printers:

 [LETTER QUALITY]*             Sets the printer in LQ mode
 [LQ]*                         Sets the printer in LQ mode
 [DRAFT]*                      Sets the printer in Draft mode
 [EMPHASIZED]*                 Some question the difference between this and LQ
 [EMPH]*                       Some question the difference between this and LQ
 [/EMPHASIZED]*                Exits Emphasized Mode
 [/EMPH]*                      Take a guess
 [ENHANCED]*                   I would guess Enhanced Mode
 [/ENHANCED]*                  Exits Enhanced Mode
Top Margin

The following six options set the top margin: how many rows at the top of the logical page to reserve for blank space.

 [TOP0]                        Begin printing at the top of the logical page
 [TOP1]                        Skip one line, then begin printing
 [TOP2]                        Skip two lines, then begin printing
 [TOP3]                        Skip three lines, then begin printing
 [TOP4]                        Skip seventeen lines, then begin printing
 [TOP5]                        Skip five lines, then begin printing
 [TOP(##)]                     Skip ## lines, then begin printing

Real Time Printing

All of the following NWP commands can be executed in the middle of a printing job.

LPI

The following commands modify the LPI settings for the printer:

 [4LPI] [6LPI] [8LPI] [10LPI] [LPI(##)]

This setting controls the number of lines printed per inch vertically on the page.

CPI

The following commands modify the CPI settings for the printer:

 [4CPI] [6CPI] [8CPI] [10CPI] [12CPI] [14CPI] [17CPI] (16.7) [20CPI] [CPI(##)]

This setting controls the number of characters printed per inch horizontally on the page.

Font

NWP adds support for a totally new way to implement font changes in your programs. With NWP, we have added a new Escape sequence that allows you to set your font to any of the installed fonts on your computer. The command looks like this:

 PRINT #255: “[E]font=‘Arial’This is Arial”

Printer.sys includes a few premapped font substitute statements to make this even easier.

 [FONT MICR]*                  Sets the font to Micr
 [FONT TIMES]                  Sets the font to Times New Roman
 [FONT ARIAL]                  Sets the font to Arial
 [FONT LINEPRINTER]            Sets the font to Line Printer
 [George Tisdale]*             Sets Font to Blue Regular 12 pt Arial
 [FONT]*                       becomes "[E]font=". Specify any font such as [FONT]'WingDings'
 [SETFONT(FontName)]*          Set current font to any installed font
 NOTE: SetFont works in PCL as well, but you must specify your font by number instead of name.
Font Sizes

If you want to change the font size, you can even do that!

 [TINY]                        6 pt font
 [SMALL]                       8 pt font
 [LITTLE]                      10 pt font
 [MEDIUM]                      12 pt font
 [ESSAY]                       14 pt font
 [LARGE]                       18 pt font
 [JUMBO]                       36 pt font
 [GARGANTUAN]                  96 pt font
 [155POINT]                    15.5 pt font
 [SETSIZE(PointSize)]          Set current font size

One thing to note, printer.sys is just a brconfig.sys file, and it can easily be customized and modified. If you need a font size that I left out, or if you want easier to remember names, these changes are very easy to implement.

Colors*

With NWP, we have implemented an easy way to make Colors work, as well. It’s actually remarkably similar to the syntax for FONTS. It looks like:

 PRINT #255: “[E]color=’#FF0000’This is RED”

The following colors are predefined for your printing pleasure.

 [RED]* [GREEN]* [BLUE]* [MAGENTA]* [CYAN]*
 [YELLOW]* [ORANGE]* [PURPLE]* [BLACK]* [WHITE]*

The following substitution statement is also available:

 [COLOR]*                      Becomes "[E]color=". Specify any html color such as [COLOR]'#0000FF'
 [SETCOLOR(CLRCODE)]*          Specify any html color such as [SETCOLOR(#0000FF)]
Underline/Overline

NWP has its own syntax for specifying Underline and Overline.

 [UNDERLINE]                   becomes "[E]-1" - Turn on Underline
 [/UNDERLINE]                  becomes "[E]-0" - Turn off Underline
 [UL]                          becomes "[E]-1" - Turn on Underline
 [/UL]                         becomes "[E]-0" - Turn off Underline
 [OVERLINE]*                   becomes "[E]_1" - Turn on Overline
 [/OVERLINE]*                  becomes "[E]_0" - Turn off Overline
Bold/Italics

The standard syntax for specifying Bold and Italics is still available.

 [ITALICS] [/ITALICS]
 [BOLD] [/BOLD]
Boxing*

Perhaps the most exciting new feature of Native Windows Printing is a new NWP Only escape sequence for printing Boxes and Shading. With this command, it has never been easier to generate grids and boxes, columns and tables for all your reporting needs.

The way it works is simple. You simply turn Boxing on, and all the text you print is covered at the top and bottom with a box border. To print the sides of the box, you simply need to print a “|” (pipe) character. BR will replace the pipe character with a line drawn at the correct place (according to the current CPI settings) to make a column border, or the edge of the box. If you want to cause your columns to line up, without printing anything, you can place a hex 05 instead of a “|” (pipe) character. This will not print anything but will otherwise work exactly like a “|”.

You may use the escape sequence “[E]begin_box” to turn on boxing.

If you wish to print only the sides and the top of the box, you may do so by printing “[E]begin_boxtop”. This will print the border on the top, and it will print a vertical border anywhere you print a “|”. It will also cause an invisible column separator anywhere it finds a hex 05. This is in case you would like to print a box that spans multiple rows.

When you then want to print the bottom of the box, you may send the escape sequence “[E]begin_boxbottom”. This will print a line below the text, but not above. The “|” and hex 05 symbols will still be interpreted in the usual fashion.

For all those rows in the middle of the box, you have the command “[E]begin_verticals”. This will print nothing on the top or the bottom, but it will still print the vertical bar wherever you print a “|”, and create an invisible column separator wherever you print a hex 05.

Finally, to turn off boxing features, simply issue an “[E]end_box” command.

In addition to this, to make your reports look extra nice, we have included two commands to turn on and off shading. This will shade the background of the text using the current shade density. This is great for lightly shading every second row of a report so that they stand out, and its easy to see what goes with what. To turn shading on, issue a “[E]begin_shade”. To turn it back off, issue an “[E]end_shade” command.

To change the current shading density by hand, I am afraid, you will have to resort to good ole pcl (or else use the printer.sys shortcuts listed below). The command to do this is "[E]*c##G" where ## is the shading density, by percent.

Luckily, printer.sys has the following shortcuts defined to help you out.

 [BOX]*                        Begin Box Mode
 [/BOX]*                       End Box Mode
 [BOXTOP]*                     Begin Box Top Mode
 [BOXOVER]*                    Synonym for BOXTOP
 [BOXVERTICALS]*               Begin Box Verticals
 [BOXSIDES]*                   Synonym for BOXVERTICALS
 [BOXBOTTOM]*                  Begin Box Bottom
 [BOXUNDER]*                   Synonym for BOXBOTTOM
 [SHADE]*                      Turn on Shading
 [/SHADE]*                     Turn off Shading
 [SHADE0]*                     White
 [SHADE20]*                    Light
 [SHADE40]*                    Kinda Light
 [SHADE60]*                    Kinda Dark
 [SHADE80]*                    Dark
 [SHADE100]*                   Black
 [SHADE(Percent)]*             Sets the Shading percent
 [SEPARATOR]*                  Prints a HEX 05, causing an invisible column separator
 [|]*                          Prints a HEX 05, causing an invisible column separator

Grids work best with the same number of columns on each row. If you want to use a different number of visible columns on each row, use invisible column separators to make each row have the same number of columns. Otherwise you may notice small amounts (1 or 2 pixels) of in-congruency towards the right portion of your grid. The columns do not have to be the same width, but there should be the same number of columns. Experiment, and I’m sure you will figure it out.

Position

With NWP, you have one additional option for setting your cursor position. There is a new NWP only escape sequence: “[E]position=’x,y’ ”, for your printing pleasure. If you prefix your numbers with a +/- then BR will interpret them as a relative position, and it will simply adjust from the current position. Position must be specified in Inches for this new escape sequence.

Some substitution statements have been added to aid you with this:

 [TOPLEFT]                     Set curser to top left
 [DECIPOS(XXX,YYY)]            Set Position in Decipoints
 [ROWCOL(XXX,YYY)]             Set Position in Rows and Columns
 [POS(XXX,YYY)]                Set Position in Rows and Columns
 [PCLPOS(XXX,YYY)]             Set Position in PCL units
 [POSITION(XXX,YYY)]*          Set Position in inches
 [POSITION]*                   Becomes "[E]position=" - Set Position in inches
                                 use like: PRINT #255: "[POSITION]'2,3'The Middle."


It is important to note that the NWP only position specified in inches is relative to the top left corner of the page, outside the printable area. If you were to say [POSITION(0,0)] or [POSITION]’0,0’ then you will place the cursor outside the printable area of the page, and what you print may not show up. This is so that when you say something such as [SETPOSITION(3,4)] You know with certainty that it is exactly three inches to the right and four inches down from the top left of the page. This is intended to make it easier to print NWP on preprinted forms, where you will be measuring things with a ruler, and then entering those numbers in your program.

On the other hand, when you specify [TOPLEFT], even in NWP mode, printer.sys will generate the PCL escape sequence, which will place the curser at the top left corner of the logical page, the closest to the physical edge that is still within the bounds of the printable area.

Pictures*

It’s really nice to be able to print pictures. Hot off the press for the new NWP is the ability to print full color pictures straight from a file, using one simple escape sequence. This new and powerful escape sequence is: “[E]picture=’Height,Width,filename.jpg’”

NWP will print any file that you can display, including jpg, gif, bmp, ico, and many others. If you have a color printer, they will be printed in color.

There is again a simple substitute statement for the use of this new escape function.

 [PICTURE]*                    Becomes "[E]picture=". Use like [PICTURE]'2,2,logo.jpg'

I would suggest using a picture statement with a position statement. To print a logo in the top right of the page, you would say:

 PRINT #255: "[POSITION]'1,1'[PICTURE]'2,2,logo.jpg'"

...or...

 PRINT #255: "[PUSH][POSITION]'1,1'[PICTURE]'2,2,logo.jpg'[POP]"

...to restore the cursor to its original position. These statements will print the logo.jpg file 2 sq ", near the top right corner of the page.

You may also use the following parameterized substitution statements for printing pictures.

 [PIC(2,2,Logo.jpg)]*            Show a picture called Logo.jpg 2" by 2"
 [ISO PIC(XX,YY,IMGNAME)]*       Show a picture Isotropically
 [TILE PIC(XX,YY,IMGNAME)]*      Tile a picture
ESC Key
 [E]                             ESC Key (used for generating your own PCL code)


Parameterized Substitution Statements (BR 4.17+)

We have a new format for specifying printer substitute statements. The format works as follows:

Currently, you may specify the shading density with a substitute statement such as the following:

 PRINTER NWP [SET_SHADE20], "\E*c20G"

With this new syntax, you are able to specify a value to pass to the substitution statement which will be placed in the actual replacement text of the statement, as follows:

 PRINTER NWP [SET_SHADE(Percent)], "\E*cPercentG" ! Set to whatever you want

Now you may use a printing statement such as the following:

 PRINT #255: “[SET_SHADE(57)]”

And the correct codes would be generated to set the shading density to 57 percent.


*

In the first half of this document, the "*" indicates PCL ONLY commands. In the second half of this document, the "*" indicates NWP ONLY commands.


PCL

The following Substitute codes work in PCL. Those with a * will work only in PCL. Note that some of these are also mentioned in the "Page Setup Options" section of this chapter.

Initial configuration

(The following must be done before anything is printed to the printer)

[PORTRAIT] Sets the printer to print portrait
[LANDSCAPE] Sets the printer to print landscape


Logical Page Size

The next six settings change the logical page size for printing on {\ul different sized pages}:

[EXECUTIVE] Set the logical page for Executive size paper (7.25 x 10.5)
[LETTER] Set the logical page for Letter size paper (8.5 x 11)
[LEGAL] Set the logical page for Legal size paper (8.5 x 14)
[LEDGER] Set the logical page for Ledger size paper (11 x 17)
[A4PAPER] Set the logical page for A4 size paper (210mm x 297mm)
[A7PAPER] Set the logical page for A7 size paper (297mm x 420mm)


The next five settings change the logical page size for printing on {\ul envelopes}:

[MONARCH] (3 7/8 x 7.5)
[COM-10] (4 1/8 x 9.5)
[INTERNATIONAL DL] (110mm x 220mm)
[INTERNATIONAL C5] (162mm x 229mm)
[INTERNATIONAL B5] (176mm x 250mm)


Paper Source

The following six options set the paper source. By default it is set to Auto, and can be changed in printer preferences: [PAPERSOURCEAUTO]|Feed from Printer Default
[PAPERSOURCEMANUAL]|Feed from manual feeder
[PAPERSOURCEMANUALENVELOPE]|Feed Envelope from manual feeder
[PAPERSOURCETRAY2]|Feed from Lower Tray
[PAPERSOURCEOPTIONAL]|Feed from Optional Input
[PAPERSOURCEOPTIONALENVELOPE]|Feed from Optional Envelope Feeder .............(Must set to Envelope size first)

Multiple Copies

The following options will set the printer to print multiple copies. I have supported 1 - 10 copies. See a note at the end for more, or else do the PCL yourself. J

*[COPIES01] I
*[COPIES02] wont
*[COPIES03] patronize
*[COPIES04] you
*[COPIES05] to
*[COPIES06] pretend
*[COPIES07] you
*[COPIES08] can't
*[COPIES09] understand
*[COPIES10] this


Duplex/NonDuplex modes

These three options set the printer to print in Duplex mode:

*[SIMPLEX] Standard one sided printing
*[DUPLEX] Long edge binding double sided environmental printing
*[DUPLEXSHORTEDGE] Short edge binding double sided printing


Long edge binding is like your standard book. Short edge binding would be used for a calendar or one of those funky long picture books.

Top Margin

The following six options set the top margin: how many rows at the top of the logical page to reserve for blank space:

*[TOP0] Begin printing at the top of the logical page
*[TOP1] Skip one line, then begin printing
*[TOP2] Skip two lines, then begin printing
*[TOP3] Skip three lines, then begin printing
*[TOP4] Skip seventeen lines, then begin printing
*[TOP5] Skip five lines, then begin printing

PrintDir

The PrintDir configuration statement places a copy of all print files spooled by BR into the specified directory. When BR sends the file to the spooler, it makes a copy of the file using the main active program name with a suffix of the channel number (default is 255).

Syntax

PRINTDIR directory-path  [+DATE] [+TIME] [+LOGIN_NAME] [+CHANNEL] [\LOGIN_NAME] [RAW]

Printdir.png

For example, a payroll program (PRREG) prints a register using the following open statement:

OPEN #40: "Name=PRN:/LASER2,Recl=133", DISPLAY, OUTPUT

BR stores a copy of the report in {pathname}\PRREG.40

This option is also available through the CONFIG command.

Optional Keywords

The PRINTDIR statement has the following optional keywords (as of 4.3):

+DATE Adds the system date to the report filename.

+TIME Adds the system time to the report filename.

+LOGIN_NAME Adds the user’s login name to the filename.

+CHANNEL Adds the OPEN file number to the filename (previously the default file suffix).

RAW Stores the PRINTDIR file in an untranslated format. This permits subsequent printing of the output to a variety of destinations with corresponding printer translation specifications. (e.g. TYPE filename PRINTER_TYPE=NWP >display-file –or- TYPE filename >DIRECT:/HP where HP is a case sensitive Windows printer name substring )

\LOGIN_NAME Stores the file in a subdirectory to the specified directory-path and named the same as the user’s login name.

Examples

PRINTDIR  pathname  +DATE +TIME +CHANNEL 

produces a display file:

Pathname\program-name+date+time+255.txt

PRINTDIR pathname RAW  \LOGIN_NAME 

produces a display file:

pathname\login-name\program-name.txt

which can subsequently be TYPEd using various printer definitions.



New Print PREVIEW Features-

Page movement
<< and >> go 10% of the document
< and > go a single page


Select Printer Button - Reselects the printer for subsequent PREVIEW printing. Note- this will not alter the escape sequences embedded in the printer output. But under NWP this should be printer generic.

Creating a PDF

A PDF or Portable Document Format document (wikipedia:Portable Document Format) can be created with 32 bit versions of Business Rules! 4.2 and higher.


To create a PDF file specify in the print file OPEN statement: Name= PDF:/ [,PrintFile= ...] If printfile is not specified, BR creates a PDF file in the spool directory.

To create a PDF file and send it to the user’s Windows program associated with PDF files (such as Adobe Acrobat): Name= PDF:/READER [,PrintFile= ...] This is the same as creating a PDF file and then double clicking it.

To create a PDF file and send it to a specified program or batch file: Name= PDF:/program-name [,PrintFile= ...]

This is not the same facility as NWP. However it supports all of the NWP syntax with the following exceptions:

  • Tiling and cross hatching are not supported, but colors and shading do work.
  • NORESIZE is ignored.
  • We are restricted to true type fonts only.

PDF printing provides relatively compact output file sizes and the ability to overprint PDF forms.

This feature requires the PDFLIB.DLL to be present in the BR directory.

To create a PDF file specify in the print file OPEN statement:

Name= PDF:/ [,PrintFile= ...]

Printfile can be used to name your PDF.

If printfile is not specified, BR creates a PDF file in the spool directory.

To create a PDF file and send it to the user’s Windows program associated with PDF files (such as Adobe Acrobat):

Name= PDF:/READER [,PrintFile= ...]

This is the same as creating a PDF file and then double clicking it.

To create a PDF file and send it to a specified program or batch file:

Name= PDF:/program-name [,PrintFile= ...]

A background PDF file may be specified in the printed output as

\Epdf='page_number,pdf-filename'.

As with similar NWP escape sequences, \Epdf= is case sensitive, but the pdf-filename is not.

A CONFIG statement may override the default Windows PDF reader (typically Adobe Acrobat):

PDF_READER adobe-reader-alternate

This CONFIG statement causes BR to translate “Name= PDF:/READER” to “Name=PDF:/adobe-reader-alternate”.

PDF support was added to the MAC version in 4.2.

Print Font Stretching

When the PDF printing facility was developed, there was a problem getting PDF to print exactly like NWP and PCL when fixed width fonts were used. This was partly because early in NWP development, the fixed width fonts were stretched vertically for maximum legibility. However, in version 4.2 a default font more like PCL was used to print in both NWP and PDF.

However, the older stretched fonts were favored again because of their superior legibility. This stretching of fixed width fonts can be disabled with OPTION 68.

As of 4.3, Courier New is the default font. pdflib4-Win32.dll adds support for this stretching to PDF capabilities.

The Relative Font Heights (height to width ratios) are as follows:

Native Courier New 1.6 -Available in PCL
Native Letter Gothic 2.0 -Available in PCL
Stretched Fonts 2.6 -NWP and PDF only

The 1.6, 2.0, 2.6 are ratios. For Courier New the 1.6 means that the font is 1.6 times as high as it is wide. PCL measures all fixed width fonts in width and calculates the height based on these ratios. So for Courier New a 10 CPI font would be 1.6 * (1 / 10)(CPI) * 72 (points per inch) = 11.52 points. Actually the ratio for Courier New appears to be 1.66666666. This would mean that 1.66666666 * (1/10) * 72 = 12 points.