Change paper and page settings with PHP APIs

The default paper settings for a report are specified in the .4rp file. Override the defaults in your report program with PHP reporting APIs.

Each report design document includes details about the page orientation, the page size of the report, and the report margins. These values are set when a report is first created, and can be altered by the report designer.

In the PHP report application, you can override these report page and paper settings, thanks to the order of precedence for paper settings:

Paper settings order of precedence

The following areas determine the paper settings for a report, listed here in the order of precedence:
  1. In the report application using reporting APIs.
  2. In the report design document (.4rp).
  3. GRW default values.

Change the page height and width

The initial page height is specified in the report design document (.4rp). In the PHP application, use the configurePageSize(pageWidth,pageHeight) function to modify the page height and width. For example:
$greRunnerObj->configurePageSize(
    "11inch", # pageWidth String,
    "8.5inch" # pageHeight String
);

Change the report margins

The initial page margins are specified in the report design document (.4rp). In the PHP application, use the setPaperMargins(topMargin,bottomMargin,leftMargin,rightMargin) function to modify the page margins. For example:

// Configure the physical margins of a report.
$greRunnerObj->setPaperMargins(
    "5mm", # topMargin STRING,
    "5mm", # bottomMargin STRING,
    "4mm", # leftMargin STRING,
    "4mm"  # rightMargin STRING 
);

Set page orientation

The report orientation is set in the report design document (.4rp). You cannot change the page orientation from the PHP program.