dmCollate, dmColor, dmCopies, dmPaperBin, dmPaperBinName, dmPaperLength, dmPaperSize, dmPaperSizeName, dmPaperSizeX, dmPaperSizeY, dmPaperWidth, dmQuality, dmYRes Properties

Purpose

Return or set device mode properties of the Printer object.

Syntax

Printer.dmCollate [ = long ]
Printer.dmColor [ = long ]
Printer.dmCopies [ = long ]
Printer.dmPaperBin [ = string ]
Printer.dmPaperBinName(i%)
Printer.dmPaperSize [ = long ]
Printer.dmPaperSizeName(i%)
Printer.dmPaperSizeX(i%)
Printer.dmPaperSizeY(i%)
Printer.dmPaperLength [ = long ]
Printer.dmPaperWidth [ = long ]
Printer.dmQuality [ = long ]
Printer.dmYRes [ = long ]

Description

To inquire the Printer object for device-dependent information, use the dm-properties. These properties correspond to the DEVMODE structure, which is internally read by GFA-BASIC 32. By default, these properties return information on the system standard printer.

dmCollate = r/w, %) Determines whether document collation should be done when printing multiple copies: 0 - disabled, 1 - enabled.

dmColor = r/w, %) Determines whether a color printer prints output in color (2) or monochrome (1).

dmCopies = r/w, %) Specifies the number of copies on printers that support multiple-page copies (most laser printers).

dmPaperBin = r/w, $) Indicates the default paper bin on the printer from which paper is fed when printing. To set a paper bin by number use "#1" for upper bin, "#2" for lower bin, "#3" for middle bin, "#4" for manual, "#5" for envelope, "#6" for envelope manual, "#7" for Auto, "#8" for tractor feed, "#9" for small paper feeder, "#10" for large paper bin, "#11" for large capacity feeder, "#14" for attached cassette cartridge.

dmPaperBinName(i) = r, $) Returns the paper bin name for the given number. i% starts at 1, i% = 0 is current printer.

dmPaperSize = r/w, $) Returns or selects the size of the paper to print on. This member can be set to an empty string if the length and width of the paper are both set by the dmPaperLength and dmPaperWidth properties. Otherwise, the dmPaperSize member can be set to a string containing the name of a paper format, like "A4", "A4 (210 x 297 mm)", "Letter 8 1 / 2 x 11", etc. Rather than specifying a name, the size can also set using a number with a leading "#"; "#1" for "Letter", "#9" for DIN-A4, or "#69" for "Japanese Double Postcard 200 x 148 mm" or "#118" for " PRC Envelope #10 Rotated 458 x 324 mm" (PRC = Peoples Republic of China)

dmPaperSizeName(i) = r, $) Returns the name of the size of the paper for the given number. i% starts at 1, i% = 0 is current printer.

dmPaperSizeX(i) = r, %) Returns the horizontal size in tenth of a millimeter for the specified paper format. i% starts at 1, i% = 0 is current printer.

dmPaperSizeY(i) = r, %) Returns the vertical size in tenth of a millimeter for the specified paper format. i% starts at 1, i% = 0 is current printer.

dmPaperLength = r/w, %) Overrides the length of the paper specified by the dmPaperSize property, either for custom paper sizes or for devices such as dot-matrix printers, which can print on a page of arbitrary length. These values, along with all other values in this structure that specify a physical length, are in tenths of a millimeter. To initiate, invoke dmPaperSize = "" after setting dmPaperLength.

dmPaperWidthOverrides the width of the paper specified by the dmPaperSize member. To initiate, invoke dmPaperSize = "" after setting dmPaperWidth.

dmQuality = r/w, %) Indicating the printer resolution. -1 = Draft resolution, -2 = Low resolution, -3 = Medium resolution, -4 = High resolution. In addition to the predefined negative values, you can also set value to a positive dots per inch (dpi) value, such as 300.

dmYRes = r/w, %) Indicating the printer resolution in y-direction. Some printer drivers allow separate resolutions for horizontal and vertical directions. When a driver supports this, the dmQuality sets the x-resolution and dmYRes the y-resolution. Values are the same as with dmQuality.

Example

OpenW 1, 0, 0, 200, 200

Debug.Show

~SetWindowPos(Debug.hWnd, 0, 300, 0, 400, 700, $40)

Dim i As Int

Debug "-- PaperBins --" : Print "Paper Bins"

Trace Printer.dmPaperBin

For i = 1 To 14

Print AT(1, 2); "Processing Bin "; i ; " / 14"

If Len(Printer.dmPaperBinName(i)) _

Debug "#";i` Printer.dmPaperBinName(i)

Next

Debug "-- PaperSizes --" : Print AT(1, 4); "Paper Sizes"

Trace Printer.dmPaperSize       ' "A4"

Trace Printer.dmPaperSizeX(0)   ' 2100 (x 0.1 mm)

Trace Printer.dmPaperSizeY(0)   ' 2970 (x 0.1 mm)

For i = 1 To 256

Print AT(1, 5); "Processing Size "; i ; " / 256"

If Len(Printer.dmPaperSizeName(i)) _

Debug "#";i` Printer.dmPaperSizeName(i)

Next

Example 2

Debug.Show

Trace Printer.hDC

Trace Printer.dmCollate

Trace Printer.dmCopies

Trace Printer.dmColor

Trace Printer.dmPaperSize

Trace Printer.dmPaperLength

Trace Printer.dmPaperWidth

Trace Printer.Orientation

Trace Printer.Zoom

Trace Printer.Duplex

Trace Printer.PaperHeight  // ScaleMode; units

Trace Printer.PaperWidth   // ScaleMode; units

Remarks

Setting a printer's Height or Width property automatically sets dmPaperSize to "#256" (user-defined").

The PaperWidth and PaperHeight properties (read-only) return the size of the paper in ScaleMode units.

Other related device mode properties are Orientation, Zoom, Duplex.

To gather printer information before setting the Printer object, use App.PrintInfo.

See Also

Printer, ShowPageSetup, ShowPrint, SetPrinterByName, PrinterInfo (App), PrinterName (App), Orientation, Zoom, Duplex

{Created by Sjouke Hamstra; Last updated: 03/10/2014 by James Gaite}