PrintSetupPrinter

Displays the printer setup dialog box for PowerBuilder applications. Bypasses the printer setup dialog box for PocketBuilder applications.

To

Use

Display the printer setup dialog box

Syntax 1 For displaying the printer setup dialog box

Bypass the printer setup dialog box

Syntax 2 For bypassing the printer setup dialog box


Syntax 1 For displaying the printer setup dialog box

Description

Displays the printer setup dialog box.

Syntax

PrintSetupPrinter ( )

Returns

Integer. Returns 1 if the function succeeds, 0 for cancel, -1 if an error occurs.

Usage

Although you can call PrintSetupPrinter without any arguments in PocketBuilder, it does not change the current printer setup or display the printer setup dialog box.


Syntax 2 For bypassing the printer setup dialog box

Description

Bypasses the printer setup dialog box.

Syntax

PrintSetupPrinter ( Ipaddr, path, type, port, rate)

Argument

Description

Ipaddr

A string setting the IP address of a networked printer. If you use the path name instead of an IP address, you should enter an empty string for this argument.

path

A string for the network path of a host PC with a shared printer. If you use the IP address instead of a network path, you should enter an empty string for this argument.

type

A long value specifying the printer type. For example, you specify a a Hewlett-Packard PCL compatible laser printer with a value of 5. Printer types and their corresponding values are specified in the FieldSoftware PrinterCE Developer’s Guide.

port

A long value specifying the printer port. Example values for different ports are: 0 for COM1, 9 for a shared printer on a host PC, 10 for a printer with its own IP address. Available ports and their corresponding values are specified in the FieldSoftware PrinterCE Developer’s Guide.

rate

A long value specifying the baud rate. You can select the following values for available baud rates:

  • 0 for 4800 baud or for networked printers

  • 1 for 9600 baud printers

  • 2 for 19200 baud printers

  • 3 for 34800 baud printers

  • 4 for 57600 baud printers

  • 5 for 115200 baud printers

Returns

Integer. Returns 1 if the function succeeds, -1 if an error occurs.

Usage

You can enter either an IP address for the printer you want to set up or a complete network path to the printer. Although you must enter string values for the first two arguments of this function, one of these arguments should take an empty string (“ ”) for a value.

If you use the Ipaddr argument to specify the printer, you would typically use a value of 10 for the port argument. If you use the path argument to specify the printer, you would typically enter a value of 9 for the port argument.

NoteRequired third-party software You must install the FieldSoftware PrinterCE SDK before you can use print methods in PocketBuilder applications deployed to a device or emulator. An evaluation version of this software is available from the FieldSoftware Web site.

Examples

Example 1

The following example prints to an Epson Stylus compatible network printer:

li_rtn = PrintSetupPrinter ("10.18.61.20", "", 4, 10, 0)

Example 2

This example prints to an HP Laser Jet printer with a defined path at a 9600 baud rate:

PrintSetupPrinter ("", "\\MyPC\HPLaserJ", 5, 9, 1)