5 class FormFeed
extends Tag
9 public function open($attr, &$ahtml, &$ihtml)
11 $tag = $this->getTagName();
12 if (isset($attr['SHEET-SIZE'])) {
13 // Convert to same types as accepted in initial mPDF() A4, A4-L, or array(w,h)
14 $prop = preg_split('/\s+/', trim($attr['SHEET-SIZE']));
15 if (count($prop) == 2) {
16 $newformat = [$this->sizeConverter
->convert($prop[0]), $this->sizeConverter
->convert($prop[1])];
18 $newformat = $attr['SHEET-SIZE'];
24 $save_blklvl = $this->mpdf
->blklvl
;
25 $save_blk = $this->mpdf
->blk
;
26 $save_silp = $this->mpdf
->saveInlineProperties();
27 $save_ilp = $this->mpdf
->InlineProperties
;
28 $save_bflp = $this->mpdf
->InlineBDF
;
29 $save_bflpc = $this->mpdf
->InlineBDFctr
; // mPDF 6
31 $mgr = $mgl = $mgt = $mgb = $mgh = $mgf = '';
32 if (isset($attr['MARGIN-RIGHT'])) {
33 $mgr = $this->sizeConverter
->convert($attr['MARGIN-RIGHT'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
35 if (isset($attr['MARGIN-LEFT'])) {
36 $mgl = $this->sizeConverter
->convert($attr['MARGIN-LEFT'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
38 if (isset($attr['MARGIN-TOP'])) {
39 $mgt = $this->sizeConverter
->convert($attr['MARGIN-TOP'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
41 if (isset($attr['MARGIN-BOTTOM'])) {
42 $mgb = $this->sizeConverter
->convert($attr['MARGIN-BOTTOM'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
44 if (isset($attr['MARGIN-HEADER'])) {
45 $mgh = $this->sizeConverter
->convert($attr['MARGIN-HEADER'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
47 if (isset($attr['MARGIN-FOOTER'])) {
48 $mgf = $this->sizeConverter
->convert($attr['MARGIN-FOOTER'], $this->mpdf
->w
, $this->mpdf
->FontSize
, false);
50 $ohname = $ehname = $ofname = $efname = '';
51 if (isset($attr['ODD-HEADER-NAME'])) {
52 $ohname = $attr['ODD-HEADER-NAME'];
54 if (isset($attr['EVEN-HEADER-NAME'])) {
55 $ehname = $attr['EVEN-HEADER-NAME'];
57 if (isset($attr['ODD-FOOTER-NAME'])) {
58 $ofname = $attr['ODD-FOOTER-NAME'];
60 if (isset($attr['EVEN-FOOTER-NAME'])) {
61 $efname = $attr['EVEN-FOOTER-NAME'];
63 $ohvalue = $ehvalue = $ofvalue = $efvalue = 0;
64 if (isset($attr['ODD-HEADER-VALUE']) && ($attr['ODD-HEADER-VALUE'] == '1' ||
strtoupper($attr['ODD-HEADER-VALUE']) === 'ON')) {
66 } elseif (isset($attr['ODD-HEADER-VALUE']) && ($attr['ODD-HEADER-VALUE'] == '-1' ||
strtoupper($attr['ODD-HEADER-VALUE']) === 'OFF')) {
69 if (isset($attr['EVEN-HEADER-VALUE']) && ($attr['EVEN-HEADER-VALUE'] == '1' ||
strtoupper($attr['EVEN-HEADER-VALUE']) === 'ON')) {
71 } elseif (isset($attr['EVEN-HEADER-VALUE']) && ($attr['EVEN-HEADER-VALUE'] == '-1' ||
strtoupper($attr['EVEN-HEADER-VALUE']) === 'OFF')) {
74 if (isset($attr['ODD-FOOTER-VALUE']) && ($attr['ODD-FOOTER-VALUE'] == '1' ||
strtoupper($attr['ODD-FOOTER-VALUE']) === 'ON')) {
76 } elseif (isset($attr['ODD-FOOTER-VALUE']) && ($attr['ODD-FOOTER-VALUE'] == '-1' ||
strtoupper($attr['ODD-FOOTER-VALUE']) === 'OFF')) {
79 if (isset($attr['EVEN-FOOTER-VALUE']) && ($attr['EVEN-FOOTER-VALUE'] == '1' ||
strtoupper($attr['EVEN-FOOTER-VALUE']) === 'ON')) {
81 } elseif (isset($attr['EVEN-FOOTER-VALUE']) && ($attr['EVEN-FOOTER-VALUE'] == '-1' ||
strtoupper($attr['EVEN-FOOTER-VALUE']) === 'OFF')) {
85 if (isset($attr['ORIENTATION']) && (strtoupper($attr['ORIENTATION']) === 'L' ||
strtoupper($attr['ORIENTATION']) === 'LANDSCAPE')) {
87 } elseif (isset($attr['ORIENTATION']) && (strtoupper($attr['ORIENTATION']) === 'P' ||
strtoupper($attr['ORIENTATION']) === 'PORTRAIT')) {
90 $orient = $this->mpdf
->CurOrientation
;
94 if (!empty($attr['PAGE-SELECTOR'])) {
95 $pagesel = $attr['PAGE-SELECTOR'];
98 // mPDF 6 pagebreaktype
99 $pagebreaktype = $this->mpdf
->defaultPagebreakType
;
100 if ($tag === 'FORMFEED') {
101 $pagebreaktype = 'slice';
102 } // can be overridden by PAGE-BREAK-TYPE
103 $startpage = $this->mpdf
->page
;
104 if (isset($attr['PAGE-BREAK-TYPE'])) {
105 if (strtolower($attr['PAGE-BREAK-TYPE']) === 'cloneall'
106 ||
strtolower($attr['PAGE-BREAK-TYPE']) === 'clonebycss'
107 ||
strtolower($attr['PAGE-BREAK-TYPE']) === 'slice') {
108 $pagebreaktype = strtolower($attr['PAGE-BREAK-TYPE']);
111 if ($tag === 'TOCPAGEBREAK') {
112 $pagebreaktype = 'cloneall';
113 } elseif ($this->mpdf
->ColActive
) {
114 $pagebreaktype = 'cloneall';
115 } // Any change in headers/footers (may need to _getHtmlHeight), or page size/orientation, @page selector, or margins - force cloneall
116 elseif ($mgr !== '' ||
$mgl !== '' ||
$mgt !== '' ||
$mgb !== '' ||
$mgh !== '' ||
$mgf !== '' ||
117 $ohname !== '' ||
$ehname !== '' ||
$ofname !== '' ||
$efname !== '' ||
118 $ohvalue ||
$ehvalue ||
$ofvalue ||
$efvalue ||
119 $orient != $this->mpdf
->CurOrientation ||
$newformat ||
$pagesel) {
120 $pagebreaktype = 'cloneall';
123 // mPDF 6 pagebreaktype
124 $this->mpdf
->_preForcedPagebreak($pagebreaktype);
126 $this->mpdf
->ignorefollowingspaces
= true;
132 if (isset($attr['RESETPAGENUM'])) {
133 $resetpagenum = $attr['RESETPAGENUM'];
135 if (isset($attr['PAGENUMSTYLE'])) {
136 $pagenumstyle = $attr['PAGENUMSTYLE'];
138 if (isset($attr['SUPPRESS'])) {
139 $suppress = $attr['SUPPRESS'];
143 if ($tag === 'TOCPAGEBREAK') {
145 } elseif (isset($attr['TYPE'])) {
146 $type = strtoupper($attr['TYPE']);
149 if ($type === 'E' ||
$type === 'EVEN') {
150 $this->mpdf
->AddPage(
173 } elseif ($type === 'O' ||
$type === 'ODD') {
174 $this->mpdf
->AddPage(
197 } elseif ($type === 'NEXT-ODD') {
198 $this->mpdf
->AddPage(
221 } elseif ($type === 'NEXT-EVEN') {
222 $this->mpdf
->AddPage(
246 $this->mpdf
->AddPage(
272 if ($tag === 'TOCPAGEBREAK') {
274 $this->tableOfContents
->m_TOC
[$this->toc_id
]['TOCmark'] = $this->mpdf
->page
;
276 $this->tableOfContents
->TOCmark
= $this->mpdf
->page
;
281 // mPDF 6 pagebreaktype
282 $this->mpdf
->_postForcedPagebreak($pagebreaktype, $startpage, $save_blk, $save_blklvl);
284 $this->mpdf
->InlineProperties
= $save_ilp;
285 $this->mpdf
->InlineBDF
= $save_bflp;
286 $this->mpdf
->InlineBDFctr
= $save_bflpc; // mPDF 6
287 $this->mpdf
->restoreInlineProperties($save_silp);
290 public function close(&$ahtml, &$ihtml)