source: trunk/client/inc/hpdf5/spipu/html2pdf/src/Tag/Svg/Rect.php@ 347

Last change on this file since 347 was 347, checked in by roby, 3 years ago

Aggiornamento per compatibilità con php7.4

File size: 1.4 KB
Line 
1<?php
2/**
3 * Html2Pdf Library - Tag class
4 *
5 * HTML => PDF converter
6 * distributed under the OSL-3.0 License
7 *
8 * @package Html2pdf
9 * @author Laurent MINGUET <webmaster@html2pdf.fr>
10 * @copyright 2017 Laurent MINGUET
11 */
12namespace Spipu\Html2Pdf\Tag\Svg;
13
14use Spipu\Html2Pdf\Tag\AbstractSvgTag;
15
16/**
17 * Tag Rect
18 */
19class Rect extends AbstractSvgTag
20{
21 /**
22 * @inheritdoc
23 */
24 public function getName()
25 {
26 return 'rect';
27 }
28
29 /**
30 * @inheritdoc
31 */
32 protected function drawSvg($properties)
33 {
34 $styles = $this->parsingCss->getSvgStyle($this->getName(), $properties);
35 $style = $this->pdf->svgSetStyle($styles);
36
37 $x = 0.;
38 if (isset($properties['x'])) {
39 $x = $this->cssConverter->convertToMM($properties['x'], $this->svgDrawer->getProperty('w'));
40 }
41
42 $y = 0.;
43 if (isset($properties['y'])) {
44 $y = $this->cssConverter->convertToMM($properties['y'], $this->svgDrawer->getProperty('h'));
45 }
46
47 $w = 0.;
48 if (isset($properties['w'])) {
49 $w = $this->cssConverter->convertToMM($properties['w'], $this->svgDrawer->getProperty('w'));
50 }
51
52 $h = 0.;
53 if (isset($properties['h'])) {
54 $h = $this->cssConverter->convertToMM($properties['h'], $this->svgDrawer->getProperty('h'));
55 }
56
57 $this->pdf->svgRect($x, $y, $w, $h, $style);
58 }
59}
Note: See TracBrowser for help on using the repository browser.