class Tick extends AbstractWriter

Methods

tick(array $position = [], array $config = [])

Adds a tick character to the PDF

void
configTick(array $config)

Sets the new tick configuration

array
getTickConfig()

Return the current Tick configuration values

Details

at line 116
tick(array $position = [], array $config = [])

Adds a tick character to the PDF

A symbol will be added to the PDF with a fixed position.

The $position is always calculated in millimeters and the units should NOT be included.

The default configuration is as follows, but can be overriden for each call:

  • markup: ✔ - The symbol to output
  • font: Dejavusanscondensed - The registered font name (use the Font Manager to install additional fonts)
  • font-size: 16pt - Controls the font size used
  • line-height: 16pt - Controls the line height used

This element will not be resized to fit within a container. The symbol will be wrapped in a DIV with the class tick for more convenient styling (don't try style the font, font-size or line-height as this method handles those styles automatically).

The font-size and line-height are always calculated in points and the units should NOT be included when changing the configuration defaults.

Example

 // Add tick positioned 20mm from the left and 50mm from the top
 $w->tick( [ 20, 50 ] );

 // Add X to PDF instead of default tick
 $w->tick( [ 20, 60 ], [ 'markup' => 'X' ] );

 // Change default font size
 $w->configTick( [
     'font-size' => 20,
     'line-height' => 20,
 ] );

 // Add tick that uses new defaults (20pt font and 20pt line-height)
 $w->tick( [ 20, 70 ] );

Parameters

array $position The X and Y position of the element
array $config Override the default configuration on a per-element basis. Accepted array keys include 'markup', 'font', 'font-size', 'line-height'

Exceptions

BadMethodCallException Called is $position does not contain two array elements, or if $config is not an array

at line 176
void configTick(array $config)

Sets the new tick configuration

Once called, all future calls to $w->tick() will use these defaults.

The font-size and line-height are always calculated in points and the units should NOT be included when changing the configuration defaults.

The default configuration is:

  • markup: ✔ - The symbol to output
  • font: Dejavusanscondensed - The registered font name (use the Font Manager to install additional fonts)
  • font-size: 16pt - Controls the font size used
  • line-height: 16pt - Controls the line height used

Example

 // Adds a tick with the defaults
 $w->tick( [ 100, 30 ] );

 // Changes the default config font size and line height
 $w->configTick( [
     'font-size' => 20,
     'line-height' => 20,
 ] );

 // Adds tick text with the new defaults
 $w->tick( [ 100, 40 ] );

Parameters

array $config Accepted array keys include 'markup', 'font', 'font-size', 'line-height'

Return Value

void

at line 215
array getTickConfig()

Return the current Tick configuration values

Example

 // Get the current Tick config
 $config = $w->getTickConfig();

 echo $config['markup'];
 echo $config['font'];
 echo $config['font-size'];
 echo $config['line-height'];

Return Value

array Returned array keys include 'markup', 'font', 'font-size', 'line-height'