Example 8

Description

The first line is a solid line with default color black and a default extent of 0.1mm
Then follows a solid line with an extent of 1mm
Next is a centered solid line with a length of 100mm and an extent of 0.5mm. The color of the line has been set to green.
Then a red dashed line with a length of 120mm, left aligned.
Then a blue dotted line with a length of 50mm, right aligned.
At last there is a grey dash-dotted line.

Output

<?php

include_once "../src/Report.php";

use Adi\ReportLib as ReportLib;

// Create report instance
//  default format A4, portrait with margins left = 20mm, top = 10mm, right = 10mm and bottom = 10mm
$report = new ReportLib\Report();

// Get ref to the report body
$body = $report->getBody();

// Print a default line
$body->AddHLine();
$body->AddVDistance(5.0);

// Print a default line but with an extent of 1mm
$body->AddHLine(1.0);
$body->AddVDistance(5.0);

// Print a centered line
$body->AddLine(100.0, 'H', 'C', 'T', 0.5, "#00FF00");
$body->AddVDistance(5.0);

// Print a left aligned dashed line
$lf = new ReportLib\LineFrame('H');
$pen = new ReportLib\Pen(0.2, "#FF0000", 'dash');
$lf->setPen($pen);
$lf->setLength(120.0);
$body->addFrame($lf);
$body->AddVDistance(5.0);

// Print a right aligned dotted line
$lf = new ReportLib\LineFrame('H');
$pen = new ReportLib\Pen(0.2, "#0000FF", 'dot');
$lf->setPen($pen);
$lf->setLength(50.0);
$lf->setHAlignment('R');
$body->addFrame($lf);
$body->AddVDistance(5.0);

// Print a grey dash-dotted line
$lf = new ReportLib\LineFrame('H');
$pen = new ReportLib\Pen(0.2, "#CCCCCC", 'dashdot');
$lf->setPen($pen);
$body->addFrame($lf);
$body->AddVDistance(5.0);

// Produce the output of the report
//  uses the same params as TCPDF (F = File, I = Preview etc.)
$report->output(__DIR__ . "/example_008.pdf", 'I');