Create labels: the report application (PHP)

A common use of reports is to create a page of labels, such as address labels. Creating labels requires you to create a report design document representing a single label and a report application that prints multiple labels on a page.

Create the report design document

The report design document (.4rp) contains the design for a single label. You can put anything you wish on the label, as long as it fits onto the page.

See Design labels for details on creating the single-label report design document (.4rp).

Example code snippet

This code snippet prints the labels on a physical page, two labels per row and six labels per column.
// Create the report engine
$designFile = "OrderLabels.4rp";      
$reportClassName = "OrderReport\OrderReport"
$greRunnerObj = new FourjsReportRuntime($designFile, $reportClassName);
$greRunnerObj->configureDistributedProcessing("127.0.0.1",7000);
// special settings for labels
$greRunnerObj->selectLogicalPageMapping("labels");
$greRunnerObj->setPaperMargins("5mm","5mm","4mm","4mm");
$greRunnerObj->configureLabelOutput("a4width","a4length",null,null,2,6);  
Figure: Output of labels on a physical page

This figure shows an example of output from a report configured to create Labels.