5 use Mpdf\Utils\NumericString
;
10 public function open($attr, &$ahtml, &$ihtml)
13 // Added mPDF 3.0 Float DIV - CLEAR
14 if (isset($attr['STYLE'])) {
15 $properties = $this->cssManager
->readInlineCSS($attr['STYLE']);
16 if (isset($properties['CLEAR'])) {
17 $this->mpdf
->ClearFloats(strtoupper($properties['CLEAR']), $this->mpdf
->blklvl
);
21 $this->mpdf
->ignorefollowingspaces
= true;
24 $objattr['margin_top'] = 0;
25 $objattr['margin_bottom'] = 0;
26 $objattr['margin_left'] = 0;
27 $objattr['margin_right'] = 0;
28 $objattr['width'] = 0;
29 $objattr['height'] = 0;
30 $objattr['border_top']['w'] = 0;
31 $objattr['border_bottom']['w'] = 0;
32 $objattr['border_left']['w'] = 0;
33 $objattr['border_right']['w'] = 0;
34 $properties = $this->cssManager
->MergeCSS('', 'HR', $attr);
35 if (isset($properties['MARGIN-TOP'])) {
36 $objattr['margin_top'] = $this->sizeConverter
->convert(
37 $properties['MARGIN-TOP'],
38 $this->mpdf
->blk
[$this->mpdf
->blklvl
]['inner_width'],
39 $this->mpdf
->FontSize
,
43 if (isset($properties['MARGIN-BOTTOM'])) {
44 $objattr['margin_bottom'] = $this->sizeConverter
->convert(
45 $properties['MARGIN-BOTTOM'],
46 $this->mpdf
->blk
[$this->mpdf
->blklvl
]['inner_width'],
47 $this->mpdf
->FontSize
,
51 if (isset($properties['WIDTH'])) {
52 $objattr['width'] = $this->sizeConverter
->convert($properties['WIDTH'], $this->mpdf
->blk
[$this->mpdf
->blklvl
]['inner_width']);
53 } elseif (isset($attr['WIDTH']) && $attr['WIDTH'] != '') {
54 $objattr['width'] = $this->sizeConverter
->convert($attr['WIDTH'], $this->mpdf
->blk
[$this->mpdf
->blklvl
]['inner_width']);
56 if (isset($properties['TEXT-ALIGN'])) {
57 $objattr['align'] = self
::ALIGN
[strtolower($properties['TEXT-ALIGN'])];
58 } elseif (isset($attr['ALIGN']) && $attr['ALIGN'] != '') {
59 $objattr['align'] = self
::ALIGN
[strtolower($attr['ALIGN'])];
62 if (isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) === 'auto') {
63 $objattr['align'] = 'R';
65 if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) === 'auto') {
66 $objattr['align'] = 'L';
67 if (isset($properties['MARGIN-RIGHT']) && strtolower($properties['MARGIN-RIGHT']) === 'auto'
68 && isset($properties['MARGIN-LEFT']) && strtolower($properties['MARGIN-LEFT']) === 'auto') {
69 $objattr['align'] = 'C';
72 if (isset($properties['COLOR'])) {
73 $objattr['color'] = $this->colorConverter
->convert($properties['COLOR'], $this->mpdf
->PDFAXwarnings
);
74 } elseif (isset($attr['COLOR']) && $attr['COLOR'] != '') {
75 $objattr['color'] = $this->colorConverter
->convert($attr['COLOR'], $this->mpdf
->PDFAXwarnings
);
77 if (isset($properties['HEIGHT'])) {
78 $objattr['linewidth'] = $this->sizeConverter
->convert(
79 $properties['HEIGHT'],
80 $this->mpdf
->blk
[$this->mpdf
->blklvl
]['inner_width'],
81 $this->mpdf
->FontSize
,
88 if ($this->mpdf
->tableLevel
) {
89 $objattr['W-PERCENT'] = 100;
90 if (isset($properties['WIDTH']) && NumericString
::containsPercentChar($properties['WIDTH'])) {
91 $properties['WIDTH'] = NumericString
::removePercentChar($properties['WIDTH']); // make "90%" become simply "90"
92 $objattr['W-PERCENT'] = $properties['WIDTH'];
94 if (isset($attr['WIDTH']) && NumericString
::containsPercentChar($attr['WIDTH'])) {
95 $attr['WIDTH'] = NumericString
::removePercentChar($attr['WIDTH']); // make "90%" become simply "90"
96 $objattr['W-PERCENT'] = $attr['WIDTH'];
99 /* -- END TABLES -- */
101 $objattr['type'] = 'hr';
102 $objattr['height'] = $objattr['linewidth'] +
$objattr['margin_top'] +
$objattr['margin_bottom'];
103 $e = "\xbb\xa4\xactype=image,objattr=" . serialize($objattr) . "\xbb\xa4\xac";
106 // Output it to buffers
107 if ($this->mpdf
->tableLevel
) {
108 if ($this->mpdf
->cell
) {
109 if (!isset($this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['maxs'])) {
110 $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['maxs'] = $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['s'];
111 } elseif ($this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['maxs'] < $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['s']) {
112 $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['maxs'] = $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['s'];
114 $this->mpdf
->cell
[$this->mpdf
->row
][$this->mpdf
->col
]['s'] = 0; // reset
115 $this->mpdf
->_saveCellTextBuffer($e, $this->mpdf
->HREF
);
118 /* -- END TABLES -- */
119 $this->mpdf
->_saveTextBuffer($e, $this->mpdf
->HREF
);
123 public function close(&$ahtml, &$ihtml)