1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Swiss Payment Slip PDF |
4
|
|
|
* |
5
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php MIT License |
6
|
|
|
* @copyright 2012-2015 Some nice Swiss guys |
7
|
|
|
* @author Marc Würth <[email protected]> |
8
|
|
|
* @author Manuel Reinhard <[email protected]> |
9
|
|
|
* @author Peter Siska <[email protected]> |
10
|
|
|
* @link https://github.com/ravage84/SwissPaymentSlipPdf/ |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace SwissPaymentSlip\SwissPaymentSlipPdf\Examples; |
14
|
|
|
|
15
|
|
|
use SwissPaymentSlip\SwissPaymentSlipPdf\PaymentSlipPdf; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* An example implementation of PaymentSlipPdf |
19
|
|
|
*/ |
20
|
|
|
class ExamplePaymentSlipPdf extends PaymentSlipPdf |
21
|
|
|
{ |
22
|
|
|
protected function displayImage($background) |
23
|
|
|
{ |
24
|
|
|
echo sprintf('Display the background image "%s"<br>', $background); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
protected function setFont($fontFamily, $fontSize, $fontColor) |
28
|
|
|
{ |
29
|
|
|
echo sprintf('Set the font "%s" "%s" "%s"<br>', $fontFamily, $fontSize, $fontColor); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function setBackground($background) |
33
|
|
|
{ |
34
|
|
|
echo sprintf('Set the background "%s"<br>', $background); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function setPosition($posX, $posY) |
38
|
|
|
{ |
39
|
|
|
echo sprintf('Set the position to "%s"/"%s"<br>', $posX, $posY); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
protected function createCell($width, $height, $line, $textAlign, $fill) |
43
|
|
|
{ |
44
|
|
|
echo sprintf( |
45
|
|
|
'Create a cell; width: "%s"; height: "%s"; line: "%s"; textAlign: "%s"; fill: "%s"<br>', |
46
|
|
|
$width, |
47
|
|
|
$height, |
48
|
|
|
$line, |
49
|
|
|
$textAlign, |
50
|
|
|
$fill |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Normally it is not necessary to overwrite this method |
56
|
|
|
* |
57
|
|
|
* {@inheritDoc} |
58
|
|
|
*/ |
59
|
|
|
protected function writePaymentSlipLines($elementName, $element) |
60
|
|
|
{ |
61
|
|
|
echo sprintf('Write the element "%s"<br>', $elementName); |
62
|
|
|
parent::writePaymentSlipLines($elementName, $element); |
63
|
|
|
echo '<br>'; |
64
|
|
|
|
65
|
|
|
return $this; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
|
69
|
|
|
} |
70
|
|
|
|