# Configuring a Windows printer for the Windows GDI driver

Configuring a Windows printer for the Windows GDI Driver
entails creating the Windows printer device and then associating a
spooler assignment with the Windows printer control item in the DEVICES
file.

- Run the dev-make command to configure a Windows printer. This requires specifying a printer type of NTPrinter and a printer path appended with ,wingdiprinter. For example: ```
dev-make –t NTPrinter -n 100 -a “\\Svr-print\SPP-HP4200,wingdiprinter”
``` Note: If the printer path doesn’t have ,wingdiprinter appended to it, the standard printer process code is configured. See dev-make command (Windows) for more information on creating printer devices.

- Run the startptr command to start the printer.

- Execute the assignfq and sp-assign commands to associate a spooler assignment with the Windows printer control item in the DEVICES file. The example below illustrates associating a spooler assignment with a Windows printer control item: ```
assignfq 1,wincontrolitem
sp-assign f1
``` where wincontrolitem is the Windows printer control item (DEVICES file, item ID, wincontrolitem). Warning: The specified wincontrolitem is limited to a maximum of 12 characters. See sp-assign command and assignfq (Windows) command for more information on associating spooler assignments.

- Create a program that employs @() function codes to embed character sequences into the print data stream. See the Program Examples section below for examples.

## Program examples

**Example 1**The example
below illustrates a program that prints text to a specified location
(x,y coordinates) on the paper.

```
PRINT_AT_LOC
001 *
002 ** Set output to printer
003 *
004 PRINTER ON
005 *
006 ** Set location (x,y coordinate)
007 *
008 PRINT @(-350,600): @(-351,900):
009 *
010 ** Print to specified location
011 *
012 PRINT "PRINT AT SPECIFIED LOCATION"
013 *
014 ** Reset output to printer
015 *
016 PRINTER OFF
017 *
018 STOP
```
**Example 2**The example below illustrates a program
that prints an ellipse graphic.

```
PRINT_ELLIPSE
001 *
002 ** Set output to printer
003 *
004 PRINTER ON
005 *
006 ** Load brush fields
007 *
008 x = @(-324,0) ;* style
009 x = @(-325,12237498) ;* color
010 x = @(-326,0) ;* hatch style
011 *
012 ** Create brush and assign as brush number 3
013 *
014 PRINT @(-341,3):
015 *
016 ** Select brush number 3 as current brush
017 *
018 PRINT @(-348,3):
019 *
020 ** Set rectangle 2 (left, top, right, bottom)
021 *
022 x = @(-304,2)
023 x = @(-332,900)
024 x = @(-333,800)
025 x = @(-334,2200)
026 x = @(-335,1100)
027 *
028 ** Draw ellipse with rectangle 2
029 *
030 PRINT @(-364,2):
031 *
032 ** Set location (x,y coordinate)
033 *
034 PRINT @(-350,1200): @(-351,900):
035 *
036 ** Print line at specified
037 ** location within ellipse
038 *
039 PRINT "PRINT ELLIPSE"
040 *
041 ** Reset output to printer
042 *
043 PRINTER OFF
044 *
045 STOP
```
**Example 3**The example below illustrates a program
that prints text using a specific font.

```
PRINT_CREATE_SELECT_FONT
001 *
002 ** Set output to printer
003 *
004 PRINTER ON
005 *
006 ** Load font fields
007 *
008 x = @(-310,265) ;* character height
009 x = @(-311,100) ;* character width
010 x = @(-312,0) ;* escapement angle
011 x = @(-313,0) ;* orientation angle
012 x = @(-314,700) ;* weight
013 x = @(-315,0) ;* italic flag
014 x = @(-316,1) ;* underline flag
015 x = @(-317,0) ;* strike out flag
016 x = @(-318,1) ;* character set
017 x = @(-319,0) ;* output precision
018 x = @(-320,0) ;* pitch and family
019 x = @(-321,2) ;* font name
020 *
021 ** Create font and assign as font number 1
022 *
023 PRINT @(-340,1):
024 *
025 ** Select font number 1 as current font
026 *
027 PRINT @(-347,1):
028 *
029 ** Set location (x,y coordinate)
030 *
031 PRINT @(-350,600): @(-351,900):
032 *
033 ** Print line using selected font
034 *
035 PRINT "PRINT LINE USING SELECTED FONT"
036 *
037 ** Reset output to printer
038 *
039 PRINTER OFF
040 *
041 STOP
```
**Example 4**The example below illustrates a program
that prints text in landscape orientation.

```
PRINT_LANDSCAPE
001 *
002 ** Set output to printer
003 *
004 PRINTER ON
005 *
006 ** Select landscape orientation
007 *
008 PRINT @(-357,2):
009 *
010 ** Print line using selected font
011 *
012 PRINT "OUTPUT SHOULD BE LANDSCAPE-ORIENTED"
013 *
014 ** Close print job, open a new one
015 *
016 PRINTER OFF
017 PRINTER CLOSE
018 PRINTER ON
019 *
020 ** Select portrait orientation
021 *
022 PRINT @(-357,1):
023 *
024 ** Print line using selected font
025 *
026 PRINT "OUTPUT SHOULD BE PORTRAIT-ORIENTED ON A NEW PAGE"
027 *
028 ** Reset output to printer
029 *
030 PRINTER OFF
031 *
032 STOP
```

---
Source: https://d3codex.com/tcl/configuring-a-windows-printer-for-the-windows-gdi-driver/ - part of the D3Codex reference.
