Skip to main content
Version: 20 R7 BETA

SET PRINTABLE MARGIN

SET PRINTABLE MARGIN ( left ; top ; right ; bottom )

ParameterTypeDescription
leftIntegerLeft margin
topIntegerTop margin
rightIntegerRight margin
bottomIntegerBottom margin

This command is not thread-safe, it cannot be used in preemptive code.

Description

The SET PRINTABLE MARGIN command sets the values of various printing margins by using the Print form, PRINT SELECTION and PRINT RECORD commands.

You can pass one of the following values in the left, top, right and bottom parameters:

  • 0 = use paper margins
  • -1 = use printer margins
  • value > 0 = margin in pixels (remember that 1 pixel in 72 dpi represents approximately 0.4 mm)

The values of the right and bottom parameters relate to the right and bottom edges of the paper respectively.

Note: For more information regarding Printing management and terminology in 4D, refer to the GET PRINTABLE MARGIN command description.

By default, 4D bases its printouts on the printer margins. Once the SET PRINTABLE MARGIN command is executed, the modified parameters are retained in the same process for the entire session.

Example 1

The following example gets the size of the dead margin:

 SET PRINTABLE MARGIN(-1;-1;-1;-1) //Sets the printer margin
 GET PRINTABLE MARGIN($l;$t;$r;$b)
  //$l, $t, $r and $b correspond to the dead margins of the sheet

Example 2

The following example gets the paper size:

 SET PRINTABLE MARGIN(0;0;0;0) //Sets the paper margin
 GET PRINTABLE AREA($height;$width)
  //For size A4: $height=842 ; $width=595 pixels

See also

GET PRINTABLE MARGIN
Get printed height
Print form