Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Syntax 2 For printing text in a print job – PB Docs 150 – PowerBuilder Library

Syntax 2 For printing text in a print job – PB Docs 150

Syntax 2 For printing text in a print job

Description

Sends one or more lines of text as part of a print job that
you have opened with the PrintOpen function.
You can specify tab settings before or after the text. The tab settings
control the text’s horizontal position on the page.

Controls

Not object-specific

Syntax

Argument

Description

printjobnumber

The number the PrintOpen function
assigned to the print job.

tab1
(optional)

The position, measured from the left
edge of the print area in thousandths of a inch, to which the print
cursor should move before string is printed.
If the print cursor is already at or beyond the position or if you
omit tab1, Print starts
printing at the current position of the print cursor.

string

The string you want to print. If the
string includes carriage return-newline character pairs (~r~n),
the string will print on multiple lines. However, the initial tab
position is ignored on subsequent lines.

tab2
(optional)

The new position, measured from the left
edge of the print area in thousandths of a inch, of the print cursor
after string printed. If the print cursor is
already at or beyond the specified position, Print ignores tab2 and
the print cursor remains at the end of the text. If you omit tab2,
Print moves the print cursor to the beginning of a new line.

Return Values

Integer. Returns 1 if it succeeds and
-1 if an error occurs. If any argument’s value is null,
Print returns null.

Usage

PowerBuilder manages print jobs by opening the job, sending
data, and closing the job. When you use Syntax 2 or 3, you must
call the PrintOpen function and the PrintClose or PrintCancel functions
yourself to manage the process.

Print cursor

In a print job, PowerBuilder uses a print cursor to keep track
of the print location. The print cursor stores the coordinates of
the upper-left corner of the location at which print will being.
PowerBuilder updates the print cursor after printing text with Print.

Line spacing when printing text

Line spacing in PowerBuilder is proportional to character
height. The default line spacing is 1.2 times the character height.
When Print starts a new line, it sets the x coordinate
of the cursor to 0 and increases the y coordinate by the current
line spacing. You can change the line spacing with the PrintSetSpacing function,
which lets you specify a new factor to be multiplied by the character
height.

Because Syntax 3 of Print increments the y coordinate each
time it creates a new line, it also handles page breaks automatically.
When the y coordinate exceeds the page size, PowerBuilder automatically
creates a new page in the print job. You do not need to call the PrintPage function,
as you would if you were using the printing functions that control
the cursor position (for example, PrintText or PrintLine).

Print area and margins

The print area is the physical page size minus any margins
in the printer itself.

Using fonts

You can use PrintDefineFont and PrintSetFont to
specify the font used by the Print function when
you are printing a string.

Fonts for multiple languages

The default font for print functions is the system font, but
multiple languages cannot be printed correctly using the system
font. The Tahoma font typically produces good results. However,
if the printer font is set to Tahoma and the Tahoma font is not
installed on the printer, PowerBuilder downloads the entire font
set to the printer when it encounters a multilanguage character.
Use the PrintDefineFont and PrintSetFont functions
to specify a font that is available on users’ printers
and supports multiple languages.

Examples

This example opens a print job, prints the string Sybase
Corporation
in the default font, and then starts
a new line:

This example opens a print job, prints the string Sybase
Corporation
in the default font, tabs 5 inches
from the left edge of the print area but does not start a new line:

The first Print statement below
tabs half an inch from the left edge of the print area, prints the
string Sybase Corporation,
and then starts a new line. The second Print statement
tabs one inch from the left edge of the print area, prints the string Directors:,
and then starts a new line:

The first Print statement below
tabs half an inch from the left edge of the print area prints the
string Sybase Corporation,
and then tabs 6 inches from the left edge of the print area but
does not start a new line. The second Print statement
prints the current date and then starts a new line:

In a window that displays a database error message
in a MultiLineEdit mle_message, the
following script for a Print button prints a title with the date and
time and the message:

See Also


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x