Syntax 1 For printing a visual object in a print job
Description
Includes a visual object, such as a window or a graph control,
in a print job that you have started with the PrintOpen function.
Controls
Any object
Syntax
|
1 |
<span>objectname</span>.<span>Print</span> ( <span>printjobnumber</span>, <span>x</span>, <span>y </span>{, <span>width</span>, <span>height</span> } ) |
|
Argument |
Description |
|---|---|
|
objectname |
The name of the object that you want |
|
printjobnumber |
The number the PrintOpen function |
|
x |
An integer whose value is the x coordinate |
|
y |
An integer whose value is the y coordinate |
|
width |
An integer specifying the printed width |
|
height |
An integer specifying the printed height |
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.
PowerBuilder copies the area of the screen occupied by the
control to the printer. If any other window or application displays
on the screen in that area in front of the control while the control
is being printed, that window or application will also be printed.
Print area and margins
The print area is the physical page size minus any margins
in the printer itself.
Examples
This example prints the CommandButton cb_close in
its original size at location 500, 1000:
|
1 |
long Job |
|
1 |
Job = PrintOpen( ) |
|
1 |
cb_close.<span>Print</span>(Job, 500,1000) |
|
1 |
PrintClose(Job) |
This example opens a print job, which defines a new
page, then prints a title using the third syntax of Print.
Then it uses this syntax of Print to print a
graph on the first page and a window on the second page:
|
1 |
long Job |
|
1 |
Job = PrintOpen( ) |
|
1 |
Print(Job, "Report of Year-to-Date Sales") |
|
1 |
gr_sales1.<span>Print</span>(Job, 1000,PrintY(Job)+500, & |
|
1 |
   6000,4500) |
|
1 |
PrintPage(Job) |
|
1 |
w_sales.<span>Print</span>(Job, 1000,500, 6000,4500) |
|
1 |
PrintClose(Job) |