Lines Matching +full:font +full:- +full:size +(+path:plugin +path:dw2pdf) -(+path:plugin +path:dw2pdf +path:lang)

106 		$this->mpdf = $mpdf;
107 $this->otl = $otl;
108 $this->colorConverter = $colorConverter;
109 $this->writer = $writer;
110 $this->formWriter = $formWriter;
113 $this->formExportType = 'xfdf'; // 'xfdf' or 'html'
114 $this->formSubmitNoValueFields = true; // Whether to include blank fields when submitting data
115 $this->formSelectDefaultOption = true; // for Select drop down box; if no option is explicitly maked as selected,
117 // - affects whether "required" attribute is relevant
118 $this->formUseZapD = true; // Determine whether to use ZapfDingbat icons for radio/checkboxes
121 $this->form_border_color = '0.6 0.6 0.72'; // RGB
122 $this->form_background_color = '0.975 0.975 0.975'; // RGB
123 $this->form_border_width = '1'; // 0 doesn't seem to work as it should
124 $this->form_border_style = 'S'; // B - Bevelled; D - Double
125 $this->form_button_border_color = '0.2 0.2 0.55';
126 $this->form_button_background_color = '0.941 0.941 0.941';
127 $this->form_button_border_width = '1';
128 $this->form_button_border_style = 'S';
129 $this->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
130 $this->form_radio_background_color = '0.9 0.9 0.9';
133 $this->textarea_lineheight = 1.25;
136 $this->form_element_spacing['select']['outer']['h'] = 0.5; // Horizontal spacing around SELECT
137 $this->form_element_spacing['select']['outer']['v'] = 0.5; // Vertical spacing around SELECT
138 $this->form_element_spacing['select']['inner']['h'] = 0.7; // Horizontal padding around SELECT
139 $this->form_element_spacing['select']['inner']['v'] = 0.7; // Vertical padding around SELECT
140 $this->form_element_spacing['input']['outer']['h'] = 0.5;
141 $this->form_element_spacing['input']['outer']['v'] = 0.5;
142 $this->form_element_spacing['input']['inner']['h'] = 0.7;
143 $this->form_element_spacing['input']['inner']['v'] = 0.7;
144 $this->form_element_spacing['textarea']['outer']['h'] = 0.5;
145 $this->form_element_spacing['textarea']['outer']['v'] = 0.5;
146 $this->form_element_spacing['textarea']['inner']['h'] = 1;
147 $this->form_element_spacing['textarea']['inner']['v'] = 0.5;
148 $this->form_element_spacing['button']['outer']['h'] = 0.5;
149 $this->form_element_spacing['button']['outer']['v'] = 0.5;
150 $this->form_element_spacing['button']['inner']['h'] = 2;
151 $this->form_element_spacing['button']['inner']['v'] = 1;
153 // INITIALISE non-configurable
154 $this->formMethod = 'POST';
155 $this->formAction = '';
156 $this->form_fonts = [];
157 $this->form_radio_groups = [];
158 $this->form_checkboxes = false;
159 $this->forms = [];
160 $this->pdf_array_co = '';
166 if ($this->mpdf->useActiveForms) {
192 $this->mpdf->SetTColor($objattr['color']);
194 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
221 $this->SetFormText($w, $h, $objattr['fieldname'], $val, $val, $objattr['title'], $flags, $fieldalign, false, (isset($objattr['maxlength']) ? $objattr['maxlength'] : false), $js, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false));
222 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
226 $w -= $this->form_element_spacing['input']['outer']['h'] * 2 / $k;
227 $h -= $this->form_element_spacing['input']['outer']['v'] * 2 / $k;
228 $this->mpdf->x += $this->form_element_spacing['input']['outer']['h'] / $k;
229 $this->mpdf->y += $this->form_element_spacing['input']['outer']['v'] / $k;
230 // Chop texto to max length $w-inner-padding
231 while ($this->mpdf->GetStringWidth($texto) > $w - ($this->form_element_spacing['input']['inner']['h'] * 2)) {
232 $texto = mb_substr($texto, 0, mb_strlen($texto, $this->mpdf->mb_enc) - 1, $this->mpdf->mb_enc);
236 if (preg_match('/([' . $this->mpdf->pregRTLchars . '])/u', $texto)) {
237 $this->mpdf->biDirectional = true;
239 // Use OTL OpenType Table Layout - GSUB & GPOS
240 if (!empty($this->mpdf->CurrentFont['useOTL'])) {
241 $texto = $this->otl->applyOTL($texto, $this->mpdf->CurrentFont['useOTL']);
242 $OTLdata = $this->otl->OTLdata;
245 $this->mpdf->magic_reverse_dir($texto, $this->mpdf->directionality, $OTLdata);
247 $this->mpdf->SetLineWidth(0.2 / $k);
249 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
250 $this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
252 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
253 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
255 $this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
256 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
258 $this->mpdf->Cell($w, $h, $texto, 1, 0, $rtlalign, 1, '', 0, $this->form_element_spacing['input']['inner']['h'] / $k, $this->form_element_spacing['input']['inner']['h'] / $k, 'M', 0, false, $OTLdata);
259 $this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
260 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
267 if ($this->mpdf->useActiveForms) {
287 $this->mpdf->SetTColor($objattr['color']);
289 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
312 $this->SetFormText($w, $h, $objattr['fieldname'], $texto, $texto, (isset($objattr['title']) ? $objattr['title'] : ''), $flags, $fieldalign, false, -1, $js, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false));
313 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
315 $w -= $this->form_element_spacing['textarea']['outer']['h'] * 2 / $k;
316 $h -= $this->form_element_spacing['textarea']['outer']['v'] * 2 / $k;
317 $this->mpdf->x += $this->form_element_spacing['textarea']['outer']['h'] / $k;
318 $this->mpdf->y += $this->form_element_spacing['textarea']['outer']['v'] / $k;
319 $this->mpdf->SetLineWidth(0.2 / $k);
321 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
322 $this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
324 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
325 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
327 $this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
328 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
330 $this->mpdf->Rect($this->mpdf->x, $this->mpdf->y, $w, $h, 'DF');
331 $ClipPath = sprintf('q %.3F %.3F %.3F %.3F re W n ', $this->mpdf->x * Mpdf::SCALE, ($this->mpdf->h - $this->mpdf->y) * Mpdf::SCALE, $w * Mpdf::SCALE, -$h * Mpdf::SCALE);
332 $this->writer->write($ClipPath);
334 $w -= $this->form_element_spacing['textarea']['inner']['h'] * 2 / $k;
335 $this->mpdf->x += $this->form_element_spacing['textarea']['inner']['h'] / $k;
336 $this->mpdf->y += $this->form_element_spacing['textarea']['inner']['v'] / $k;
339 $this->mpdf->MultiCell($w, $this->mpdf->FontSize * $this->textarea_lineheight, $texto, 0, '', 0, '', $blockdir, true, $objattr['OTLdata'], $objattr['rows']);
341 $this->writer->write('Q');
342 $this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
343 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
350 if ($this->mpdf->useActiveForms) {
360 if (!empty($objattr['multiple']) && isset($objattr['size']) && $objattr['size'] > 1) {
363 if (isset($objattr['size']) && $objattr['size'] < 2) {
370 if ((!isset($objattr['spellcheck']) || !$objattr['spellcheck']) || (isset($objattr['size']) && $objattr['size'] > 1) || (!isset($objattr['editable']) || !$objattr['editable'])) {
392 if (count($data['SEL']) === 0 && $this->formSelectDefaultOption) {
396 $this->mpdf->SetTColor($objattr['color']);
398 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
400 $this->SetFormChoice($w, $h, $objattr['fieldname'], $flags, $data, $rtlalign, $js);
401 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
403 $this->mpdf->SetLineWidth(0.2 / $k);
405 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
406 $this->mpdf->SetTColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
408 $this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
409 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
411 $w -= $this->form_element_spacing['select']['outer']['h'] * 2 / $k;
412 $h -= $this->form_element_spacing['select']['outer']['v'] * 2 / $k;
413 $this->mpdf->x += $this->form_element_spacing['select']['outer']['h'] / $k;
414 $this->mpdf->y += $this->form_element_spacing['select']['outer']['v'] / $k;
417 if (preg_match('/([' . $this->mpdf->pregRTLchars . '])/u', $texto)) {
418 $this->mpdf->biDirectional = true;
421 $this->mpdf->magic_reverse_dir($texto, $this->mpdf->directionality, $objattr['OTLdata']);
423 $this->mpdf->Cell($w - ($this->mpdf->FontSize * 1.4), $h, $texto, 1, 0, $rtlalign, 1, '', 0, $this->form_element_spacing['select']['inner']['h'] / $k, $this->form_element_spacing['select']['inner']['h'] / $k, 'M', 0, false, $objattr['OTLdata']);
424 $this->mpdf->SetFColor($this->colorConverter->convert(190, $this->mpdf->PDFAXwarnings));
425 $save_font = $this->mpdf->FontFamily;
426 $save_currentfont = $this->mpdf->currentfontfamily;
427 if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
428 if (($this->mpdf->PDFA && !$this->mpdf->PDFAauto) || ($this->mpdf->PDFX && !$this->mpdf->PDFXauto)) {
429 $this->mpdf->PDFAXwarnings[] = 'Core Adobe font Zapfdingbats cannot be embedded in mPDF - used in Form element: Select - which is required for PDFA1-b or PDFX/1-a. (Different character/font will be substituted.)';
431 $this->mpdf->SetFont('sans');
432 if ($this->mpdf->_charDefined($this->mpdf->CurrentFont['cw'], 9660)) {
437 $this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, $down, 1, 0, 'C', 1);
439 $this->mpdf->SetFont('czapfdingbats');
440 $this->mpdf->Cell($this->mpdf->FontSize * 1.4, $h, chr(116), 1, 0, 'C', 1);
442 $this->mpdf->SetFont($save_font);
443 $this->mpdf->currentfontfamily = $save_currentfont;
444 $this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
445 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
452 if ($this->mpdf->useActiveForms) {
463 $this->SetJSButton($w, $h, $objattr['fieldname'], (isset($objattr['value']) ? $objattr['value'] : ''), $js, $objattr['ID'], $objattr['title'], $flags, (isset($objattr['Indexed']) ? $objattr['Indexed'] : false));
465 $this->mpdf->y = $objattr['INNER-Y'];
466 $this->writer->write(sprintf('q %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q', $objattr['INNER-WIDTH'] * Mpdf::SCALE, $objattr['INNER-HEIGHT'] * Mpdf::SCALE, $objattr['INNER-X'] * Mpdf::SCALE, ($this->mpdf->h - ($objattr['INNER-Y'] + $objattr['INNER-HEIGHT'] )) * Mpdf::SCALE, $objattr['ID']));
467 if (!empty($objattr['BORDER-WIDTH'])) {
468 $this->mpdf->PaintImgBorder($objattr, $is_table);
476 if ($this->mpdf->useActiveForms) {
484 $this->mpdf->SetTColor($objattr['color']);
486 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
490 $this->SetFormButtonText($objattr['value']);
491 $this->SetFormReset($w, $h, $objattr['fieldname'], $objattr['value'], $objattr['title'], $flags, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false), (isset($objattr['noprint']) ? $objattr['noprint'] : false));
493 $url = $this->formAction;
494 $type = $this->formExportType;
495 $method = $this->formMethod;
496 $this->SetFormButtonText($objattr['value']);
497 $this->SetFormSubmit($w, $h, $objattr['fieldname'], $objattr['value'], $url, $objattr['title'], $type, $method, $flags, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false), (isset($objattr['noprint']) ? $objattr['noprint'] : false));
499 $this->SetFormButtonText($objattr['value']);
505 $this->SetJSButton($w, $h, $objattr['fieldname'], $objattr['value'], $js, 0, $objattr['title'], $flags, false, (isset($objattr['background-col']) ? $objattr['background-col'] : false), (isset($objattr['border-col']) ? $objattr['border-col'] : false), (isset($objattr['noprint']) ? $objattr['noprint'] : false));
508 $this->mpdf->SetTColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
510 $this->mpdf->SetLineWidth(0.2 / $k);
511 $this->mpdf->SetFColor($this->colorConverter->convert(190, $this->mpdf->PDFAXwarnings));
512 $w -= $this->form_element_spacing['button']['outer']['h'] * 2 / $k;
513 $h -= $this->form_element_spacing['button']['outer']['v'] * 2 / $k;
514 $this->mpdf->x += $this->form_element_spacing['button']['outer']['h'] / $k;
515 $this->mpdf->y += $this->form_element_spacing['button']['outer']['v'] / $k;
516 $this->mpdf->RoundedRect($this->mpdf->x, $this->mpdf->y, $w, $h, 0.5 / $k, 'DF');
517 $w -= $this->form_element_spacing['button']['inner']['h'] * 2 / $k;
518 $h -= $this->form_element_spacing['button']['inner']['v'] * 2 / $k;
519 $this->mpdf->x += $this->form_element_spacing['button']['inner']['h'] / $k;
520 $this->mpdf->y += $this->form_element_spacing['button']['inner']['v'] / $k;
523 if (preg_match('/([' . $this->mpdf->pregRTLchars . '])/u', $texto)) {
524 $this->mpdf->biDirectional = true;
526 // Use OTL OpenType Table Layout - GSUB & GPOS
527 if (!empty($this->mpdf->CurrentFont['useOTL'])) {
528 $texto = $this->otl->applyOTL($texto, $this->mpdf->CurrentFont['useOTL']);
529 $OTLdata = $this->otl->OTLdata;
532 $this->mpdf->magic_reverse_dir($texto, $this->mpdf->directionality, $OTLdata);
534 $this->mpdf->Cell($w, $h, $texto, '', 0, 'C', 0, '', 0, 0, 0, 'M', 0, false, $OTLdata);
535 $this->mpdf->SetFColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
542 if ($this->mpdf->useActiveForms) {
552 if ($this->formUseZapD) {
553 $save_font = $this->mpdf->FontFamily;
554 $save_currentfont = $this->mpdf->currentfontfamily;
555 $this->mpdf->SetFont('czapfdingbats');
557 $this->SetCheckBox($w, $h, $objattr['fieldname'], $objattr['value'], $objattr['title'], $checked, $flags, (isset($objattr['disabled']) ? $objattr['disabled'] : false));
558 if ($this->formUseZapD) {
559 $this->mpdf->SetFont($save_font);
560 $this->mpdf->currentfontfamily = $save_currentfont;
565 $lx = $x + (($w - $iw) / 2);
566 $ty = $y + (($h - $ih) / 2);
569 $this->mpdf->SetLineWidth(0.2 / $k);
571 $this->mpdf->SetFColor($this->colorConverter->convert(225, $this->mpdf->PDFAXwarnings));
572 $this->mpdf->SetDColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
574 $this->mpdf->SetFColor($this->colorConverter->convert(250, $this->mpdf->PDFAXwarnings));
575 $this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
577 $this->mpdf->Rect($lx, $ty, $iw, $ih, 'DF');
580 $this->mpdf->SetLineCap(1);
581 $this->mpdf->Line($lx, $ty, $rx, $by);
582 $this->mpdf->Line($lx, $by, $rx, $ty);
584 $this->mpdf->SetLineCap();
586 $this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
587 $this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
594 if ($this->mpdf->useActiveForms) {
604 if ($this->formUseZapD) {
605 $save_font = $this->mpdf->FontFamily;
606 $save_currentfont = $this->mpdf->currentfontfamily;
607 $this->mpdf->SetFont('czapfdingbats');
609 $this->SetRadio($w, $h, $objattr['fieldname'], $objattr['value'], (isset($objattr['title']) ? $objattr['title'] : ''), $checked, $flags, (isset($objattr['disabled']) ? $objattr['disabled'] : false));
610 if ($this->formUseZapD) {
611 $this->mpdf->SetFont($save_font);
612 $this->mpdf->currentfontfamily = $save_currentfont;
615 $this->mpdf->SetLineWidth(0.2 / $k);
616 $radius = $this->mpdf->FontSize * 0.35;
619 $color = $this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings);
624 $this->mpdf->SetFColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
625 $this->mpdf->SetDColor($this->colorConverter->convert(127, $this->mpdf->PDFAXwarnings));
627 $this->mpdf->SetFColor($color);
628 $this->mpdf->SetDColor($color);
630 $this->mpdf->Circle($cx, $cy, $radius, 'D');
632 $this->mpdf->Circle($cx, $cy, $radius * 0.4, 'DF');
634 $this->mpdf->SetFColor($this->colorConverter->convert(255, $this->mpdf->PDFAXwarnings));
635 $this->mpdf->SetDColor($this->colorConverter->convert(0, $this->mpdf->PDFAXwarnings));
643 if (isset($this->array_form_text_js[$form['T']])) {
644 if (isset($this->array_form_text_js[$form['T']]['F'])) {
647 if (isset($this->array_form_text_js[$form['T']]['K'])) {
650 if (isset($this->array_form_text_js[$form['T']]['V'])) {
653 if (isset($this->array_form_text_js[$form['T']]['C'])) {
660 if (isset($this->array_form_button_js[$form['T']])) {
663 if (isset($this->form_button_icon[$form['T']])) {
665 if ($this->form_button_icon[$form['T']]['Indexed']) {
673 if (!$this->formUseZapD) {
679 if (isset($this->array_form_choice_js[$form['T']])) {
689 foreach ($this->forms as $form) {
691 $totaladdnum += $this->getCountItems($form);
699 foreach ($this->forms as $form) {
702 $annotid += $this->getCountItems($form);
710 foreach ($this->forms as $val) {
713 $this->_putform_tx($val, $hPt);
716 $this->_putform_ch($val, $hPt);
719 $this->_putform_bt($val, $hPt);
730 foreach ($this->form_radio_groups as $name => $frg) {
731 $this->writer->object();
732 $this->pdf_acro_array .= $this->mpdf->n . ' 0 R ';
733 $this->writer->write('<<');
734 $this->writer->write('/Type /Annot ');
735 $this->writer->write('/Subtype /Widget');
736 $this->writer->write('/NM ' . $this->writer->string(sprintf('%04u-%04u', $n, 3000 + $key++)));
737 $this->writer->write('/M ' . $this->writer->string('D:' . date('YmdHis')));
738 $this->writer->write('/Rect [0 0 0 0] ');
739 $this->writer->write('/FT /Btn ');
745 $this->writer->write('/Ff ' . $this->_setflag($flags));
749 $kstr .= $this->forms[$kid['n']]['obj'] . ' 0 R ';
750 // $optstr .= ' '.$this->writer->string($kid['OPT']).' ';
752 $this->writer->write('/Kids [ ' . $kstr . ' ] '); // 11 0 R 12 0 R etc.
753 // $this->writer->write('/Opt [ '.$optstr.' ] ');
761 $this->writer->write('/V /' . $state . ' ');
762 $this->writer->write('/DV /' . $state . ' ');
763 $this->writer->write('/T ' . $this->writer->string($name) . ' ');
764 $this->writer->write('>>');
765 $this->writer->write('endobj');
771 if (isset($this->pdf_acro_array)) {
772 $this->writer->write('/AcroForm << /DA (/F1 0 Tf 0 g )');
773 $this->writer->write('/Q 0');
774 $this->writer->write('/Fields [' . $this->pdf_acro_array . ']');
776 foreach ($this->form_fonts as $fn) {
777 if (is_array($this->mpdf->fonts[$fn]['n'])) {
780 $f .= '/F' . $this->mpdf->fonts[$fn]['i'] . ' ' . $this->mpdf->fonts[$fn]['n'] . ' 0 R ';
782 $this->writer->write('/DR << /Font << ' . $f . ' >> >>');
784 if ($this->pdf_array_co) {
785 $this->writer->write('/CO [' . $this->pdf_array_co . ']');
787 $this->writer->write('/NeedAppearances true');
788 $this->writer->write('>>');
796 $this->array_form_button_js[$this->writer->escape($name)] = [
806 $this->array_form_choice_js[$this->writer->escape($name)] = [
818 $this->array_form_text_js[$this->writer->escape($name)][$format] = ['js' => $j];
837 function SetFormText($w, $h, $name, $value = '', $default = '', $title = '', $flags = [], $align = 'L', $hidden = false, $maxlen = -1, $js = '', $background_col = false, $border_col = false)
839 $this->formCount++;
850 if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
851 throw new \Mpdf\MpdfException('Field [' . $name . '] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)');
853 if ($this->mpdf->onlyCoreFonts) {
854 $value = $this->Win1252ToPDFDocEncoding($value);
855 $default = $this->Win1252ToPDFDocEncoding($default);
856 $title = $this->Win1252ToPDFDocEncoding($title);
858 if (isset($this->mpdf->CurrentFont['subset'])) {
859 $this->mpdf->UTF8StringToArray($value); // Add characters to font subset
860 $this->mpdf->UTF8StringToArray($default); // Add characters to font subset
861 $this->mpdf->UTF8StringToArray($title); // Add characters to font subset
864 $value = $this->writer->utf8ToUtf16BigEndian($value);
867 $default = $this->writer->utf8ToUtf16BigEndian($default);
869 $title = $this->writer->utf8ToUtf16BigEndian($title);
872 $bg_c = $this->mpdf->SetColor($background_col, 'CodeOnly');
874 $bg_c = $this->form_background_color;
877 $bc_c = $this->mpdf->SetColor($border_col, 'CodeOnly');
879 $bc_c = $this->form_border_color;
883 'n' => $this->formCount,
885 'page' => $this->mpdf->page,
886 'x' => $this->mpdf->x,
887 'y' => $this->mpdf->y,
898 'BS_W' => $this->form_border_width,
899 'BS_S' => $this->form_border_style,
903 'font' => $this->mpdf->FontFamily,
904 'fontsize' => $this->mpdf->FontSizePt,
905 'fontcolor' => $this->mpdf->TextColor,
910 $this->SetFormTextJS($name, $js);
912 if ($this->mpdf->keep_block_together) {
913 $this->mpdf->ktForms[] = $f;
914 } elseif ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) {
915 $this->mpdf->HTMLheaderPageForms[] = $f;
917 if ($this->mpdf->ColActive) {
918 $this->mpdf->columnbuffer[] = [
920 'col' => $this->mpdf->CurrCol,
921 'x' => $this->mpdf->x,
922 'y' => $this->mpdf->y,
925 $this->mpdf->columnForms[$this->mpdf->CurrCol][(int) $this->mpdf->x][(int) $this->mpdf->y] = $this->formCount;
927 $this->forms[$this->formCount] = $f;
929 if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
930 $this->form_fonts[] = $this->mpdf->FontFamily;
931 $this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
934 $this->mpdf->x += $w;
940 $this->formCount++;
941 if ($this->mpdf->blk[$this->mpdf->blklvl]['direction'] === 'rtl') {
946 if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
947 throw new \Mpdf\MpdfException('Field [' . $name . '] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)');
949 if ($this->mpdf->onlyCoreFonts) {
951 $array['VAL'][$i] = $this->Win1252ToPDFDocEncoding($array['VAL'][$i]);
952 $array['OPT'][$i] = $this->Win1252ToPDFDocEncoding($array['OPT'][$i]);
956 if (isset($this->mpdf->CurrentFont['subset'])) {
957 $this->mpdf->UTF8StringToArray($array['VAL'][$i]); // Add characters to font subset
958 $this->mpdf->UTF8StringToArray($array['OPT'][$i]); // Add characters to font subset
961 $array['VAL'][$i] = $this->writer->utf8ToUtf16BigEndian($array['VAL'][$i]);
964 $array['OPT'][$i] = $this->writer->utf8ToUtf16BigEndian($array['OPT'][$i]);
968 $f = ['n' => $this->formCount,
970 'page' => $this->mpdf->page,
971 'x' => $this->mpdf->x,
972 'y' => $this->mpdf->y,
979 'BS_W' => $this->form_border_width,
980 'BS_S' => $this->form_border_style,
981 'BC_C' => $this->form_border_color,
982 'BG_C' => $this->form_background_color,
984 'font' => $this->mpdf->FontFamily,
985 'fontsize' => $this->mpdf->FontSizePt,
986 'fontcolor' => $this->mpdf->TextColor,
990 $this->SetFormChoiceJS($name, $js);
992 if ($this->mpdf->keep_block_together) {
993 $this->mpdf->ktForms[] = $f;
994 } elseif ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) {
995 $this->mpdf->HTMLheaderPageForms[] = $f;
997 if ($this->mpdf->ColActive) {
998 $this->mpdf->columnbuffer[] = ['s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y,
1000 $this->mpdf->columnForms[$this->mpdf->CurrCol][(int) $this->mpdf->x][(int) $this->mpdf->y] = $this->formCount;
1002 $this->forms[$this->formCount] = $f;
1004 if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
1005 $this->form_fonts[] = $this->mpdf->FontFamily;
1006 $this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
1008 $this->mpdf->x += $w;
1014 $this->SetFormButton($w, $h, $name, $value, 'checkbox', $title, $flags, $checked, $disabled);
1015 $this->mpdf->x += $w;
1021 $this->SetFormButton($w, $h, $name, $value, 'radio', $title, $flags, $checked, $disabled);
1022 $this->mpdf->x += $w;
1030 $this->SetFormButton($w, $h, $name, $value, 'reset', $title, $flags, false, false, $background_col, $border_col, $noprint);
1031 $this->mpdf->x += $w;
1036 $this->SetFormButton($w, $h, $name, $value, 'js_button', $title, $flags, false, false, $background_col, $border_col, $noprint);
1039 $this->form_button_icon[$this->writer->escape($name)] = [
1046 $this->SetFormButtonJS($name, $js);
1048 $this->mpdf->x += $w;
1057 $this->SetFormButton($w, $h, $name, $value, 'submit', $title, $flags, false, false, $background_col, $border_col, $noprint);
1058 $this->forms[$this->formCount]['URL'] = $url;
1059 $this->forms[$this->formCount]['method'] = $method;
1060 $this->forms[$this->formCount]['exporttype'] = $typ;
1061 $this->mpdf->x += $w;
1066 if ($this->mpdf->onlyCoreFonts) {
1067 $ca = $this->Win1252ToPDFDocEncoding($ca);
1069 $rc = $this->Win1252ToPDFDocEncoding($rc);
1072 $ac = $this->Win1252ToPDFDocEncoding($ac);
1075 if (isset($this->mpdf->CurrentFont['subset'])) {
1076 $this->mpdf->UTF8StringToArray($ca); // Add characters to font subset
1078 $ca = $this->writer->utf8ToUtf16BigEndian($ca);
1080 if (isset($this->mpdf->CurrentFont['subset'])) {
1081 $this->mpdf->UTF8StringToArray($rc);
1083 $rc = $this->writer->utf8ToUtf16BigEndian($rc);
1086 if (isset($this->mpdf->CurrentFont['subset'])) {
1087 $this->mpdf->UTF8StringToArray($ac);
1089 $ac = $this->writer->utf8ToUtf16BigEndian($ac);
1092 $this->form_button_text = $ca;
1093 $this->form_button_text_over = $rc ?: $ca;
1094 $this->form_button_text_click = $ac ?: $ca;
1099 $this->formCount++;
1100 if (!preg_match('/^[a-zA-Z0-9_:\-]+$/', $name)) {
1101 throw new \Mpdf\MpdfException('Field [' . $name . '] must have a name attribute, which can only contain letters, numbers, colon(:), undersore(_) or hyphen(-)');
1103 if (!$this->mpdf->onlyCoreFonts) {
1104 if (isset($this->mpdf->CurrentFont['subset'])) {
1105 $this->mpdf->UTF8StringToArray($title); // Add characters to font subset
1106 $this->mpdf->UTF8StringToArray($value); // Add characters to font subset
1108 $title = $this->writer->utf8ToUtf16BigEndian($title);
1110 $uvalue = $this->writer->utf8ToUtf16BigEndian($value);
1112 $uvalue = $this->writer->utf8ToUtf16BigEndian($value);
1113 $value = mb_convert_encoding($value, 'Windows-1252', 'UTF-8');
1115 $value = $this->writer->utf8ToUtf16BigEndian($value);
1119 $title = $this->Win1252ToPDFDocEncoding($title);
1120 $value = $this->Win1252ToPDFDocEncoding($value); //// ??? not needed
1121 $uvalue = mb_convert_encoding($value, 'UTF-8', 'Windows-1252');
1122 $uvalue = $this->writer->utf8ToUtf16BigEndian($uvalue);
1125 if (!preg_match('/^[a-zA-Z0-9_:\-\.]+$/', $value)) {
1126 throw new \Mpdf\MpdfException("Field '" . $name . "' must have a value, which can only contain letters, numbers, colon(:), underscore(_), hyphen(-) or period(.)");
1130 if (!isset($this->form_radio_groups[$name])) {
1131 $this->form_radio_groups[$name] = [
1132 'page' => $this->mpdf->page,
1136 $this->form_radio_groups[$name]['kids'][] = [
1137 'n' => $this->formCount, 'V' => $value, 'OPT' => $uvalue, 'disabled' => $disabled
1140 $this->form_radio_groups[$name]['on'] = $value;
1144 $this->form_radio_groups[$name]['disabled'] = true;
1148 $this->form_checkboxes = true;
1156 $bg_c = $this->mpdf->SetColor($background_col, 'CodeOnly');
1158 $bg_c = $this->form_button_background_color;
1161 $bc_c = $this->mpdf->SetColor($border_col, 'CodeOnly');
1163 $bc_c = $this->form_button_border_color;
1165 $f = ['n' => $this->formCount,
1167 'page' => $this->mpdf->page,
1169 'x' => $this->mpdf->x,
1170 'y' => $this->mpdf->y,
1178 'CA' => $this->form_button_text,
1179 'RC' => $this->form_button_text_over,
1180 'AC' => $this->form_button_text_click,
1181 'BS_W' => $this->form_button_border_width,
1182 'BS_S' => $this->form_button_border_style,
1189 'font' => $this->mpdf->FontFamily,
1190 'fontsize' => $this->mpdf->FontSizePt,
1191 'fontcolor' => $this->mpdf->TextColor,
1194 if ($this->mpdf->keep_block_together) {
1195 $this->mpdf->ktForms[] = $f;
1196 } elseif ($this->mpdf->writingHTMLheader || $this->mpdf->writingHTMLfooter) {
1197 $this->mpdf->HTMLheaderPageForms[] = $f;
1199 if ($this->mpdf->ColActive) {
1200 $this->mpdf->columnbuffer[] = ['s' => 'ACROFORM', 'col' => $this->mpdf->CurrCol, 'x' => $this->mpdf->x, 'y' => $this->mpdf->y,
1202 $this->mpdf->columnForms[$this->mpdf->CurrCol][(int) $this->mpdf->x][(int) $this->mpdf->y] = $this->formCount;
1204 $this->forms[$this->formCount] = $f;
1206 if (!in_array($this->mpdf->FontFamily, $this->form_fonts)) {
1207 $this->form_fonts[] = $this->mpdf->FontFamily;
1208 $this->mpdf->fonts[$this->mpdf->FontFamily]['used'] = true;
1211 $this->form_button_text = null;
1212 $this->form_button_text_over = null;
1213 $this->form_button_text_click = null;
1220 $this->form_border_width = '1';
1223 $this->form_border_width = '2';
1226 $this->form_border_width = '3';
1229 $this->form_border_width = '0';
1232 $this->form_border_width = '0';
1241 $this->form_border_style = 'S';
1244 $this->form_border_style = 'D /D [3]';
1247 $this->form_border_style = 'B';
1250 $this->form_border_style = 'I';
1253 $this->form_border_style = 'U';
1256 $this->form_border_style = 'B';
1261 function SetFormBorderColor($r, $g = -1, $b = -1)
1263 $this->form_border_color = $this->getColor($r, $g, $b);
1266 function SetFormBackgroundColor($r, $g = -1, $b = -1)
1268 $this->form_background_color = $this->getColor($r, $g, $b);
1271 private function getColor($r, $g = -1, $b = -1)
1273 if (($r == 0 && $g == 0 && $b == 0) || $g == -1) {
1281 $this->SetFormBorderWidth($W);
1282 $this->SetFormBorderStyle($S);
1283 $this->SetFormBorderColor($BC);
1284 $this->SetFormBackgroundColor($BG);
1291 $flag += 1 << ($val - 1);
1299 $y = $hPt - ($y * Mpdf::SCALE);
1301 $y2 = $y - ($h * Mpdf::SCALE);
1312 foreach ($this->mpdf->images as $iid => $img) {
1314 $info = $this->mpdf->images[$iid];
1324 $this->writer->object();
1325 $this->writer->write('<<');
1326 $this->writer->write('/Type /XObject');
1327 $this->writer->write('/Subtype /Image');
1328 $this->writer->write('/BBox [0 0 1 1]');
1329 $this->writer->write('/Length ' . strlen($info['data']));
1330 $this->writer->write('/BitsPerComponent ' . $info['bpc']);
1333 $this->writer->write('/ColorSpace [/Indexed /DeviceRGB ' . (strlen($info['pal']) / 3 - 1) . ' ' . ($this->mpdf->n + 1) . ' 0 R]');
1335 $this->writer->write('/ColorSpace /' . $info['cs']);
1338 $this->writer->write('/Decode [1 0 1 0 1 0 1 0]');
1344 $this->writer->write('/Filter /' . $info['f']);
1348 $this->writer->write($info['parms']);
1351 $this->writer->write('/Width ' . $info['w']);
1352 $this->writer->write('/Height ' . $info['h']);
1353 $this->writer->write('>>');
1354 $this->writer->stream($info['data']);
1355 $this->writer->write('endobj');
1359 $filter = $this->mpdf->compress ? '/Filter /FlateDecode ' : '';
1360 $this->writer->object();
1361 $pal = $this->mpdf->compress ? gzcompress($info['pal']) : $info['pal'];
1362 $this->writer->write('<<' . $filter . '/Length ' . strlen($pal) . '>>');
1363 $this->writer->stream($pal);
1364 $this->writer->write('endobj');
1373 $this->writer->object();
1374 $n = $this->mpdf->n;
1377 $this->pdf_acro_array .= $n . ' 0 R '; // Add to /Field element
1380 $this->forms[$form['n']]['obj'] = $n;
1381 $this->writer->write('<<');
1382 $this->writer->write('/Type /Annot ');
1383 $this->writer->write('/Subtype /Widget');
1384 $this->writer->write('/NM ' . $this->writer->string(sprintf('%04u-%04u', $n, 7000 + $form['n'])));
1385 $this->writer->write('/M ' . $this->writer->string('D:' . date('YmdHis')));
1386 $this->writer->write('/Rect [ ' . $this->_form_rect($form['x'], $form['y'], $form['w'], $form['h'], $hPt) . ' ]');
1388 $form['noprint'] ? $this->writer->write('/F 0 ') : $this->writer->write('/F 4 ');
1390 $this->writer->write('/FT /Btn ');
1391 $this->writer->write('/H /P ');
1394 $this->writer->write('/T ' . $this->writer->string($form['T']));
1397 $this->writer->write('/TU ' . $this->writer->string($form['TU']));
1399 if (isset($this->form_button_icon[$form['T']])) {
1420 $radio_color = $this->form_radio_color;
1421 $radio_background_color = $this->form_radio_background_color;
1427 $this->writer->write('/BS << /W 1 /S /S >>');
1428 $this->writer->write("/MK << $temp >>");
1429 $this->writer->write('/Ff ' . $this->_setflag($form['FF']));
1432 $this->writer->write('/V /' . $this->writer->escape($form['V']) . ' ');
1433 $this->writer->write('/DV /' . $this->writer->escape($form['V']) . ' ');
1434 $this->writer->write('/AS /' . $this->writer->escape($form['V']) . ' ');
1436 $this->writer->write('/AS /Off ');
1439 if ($this->formUseZapD) {
1440 $this->writer->write('/DA (/F' . $this->mpdf->fonts['czapfdingbats']['i'] . ' 0 Tf ' . $radio_color . ' rg)');
1441 $this->writer->write('/AP << /N << /' . $this->writer->escape($form['V']) . ' ' . ($this->mpdf->n + 1) . ' 0 R /Off /Off >> >>');
1443 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$this->mpdf->CurrentFont['fontkey']]['i'] . ' 0 Tf ' . $radio_color . ' rg)');
1444 $this->writer->write('/AP << /N << /' . $this->writer->escape($form['V']) . ' ' . ($this->mpdf->n + 1) . ' 0 R /Off ' . ($this->mpdf->n + 2) . ' 0 R >> >>');
1447 $this->writer->write('/Opt [ ' . $this->writer->string($form['OPT']) . ' ' . $this->writer->string($form['OPT']) . ' ]');
1452 if ((isset($form['disabled']) && $form['disabled']) || (isset($this->form_radio_groups[$form['T']]['disabled']) && $this->form_radio_groups[$form['T']]['disabled'])) {
1456 $radio_color = $this->form_radio_color;
1457 $radio_background_color = $this->form_radio_background_color;
1460 $this->writer->write('/Parent ' . $this->form_radio_groups[$form['T']]['obj_id'] . ' 0 R ');
1466 $this->writer->write('/BS << /W 1 /S /S >>');
1467 $this->writer->write('/MK << ' . $temp . ' >> ');
1471 $this->writer->write('/Ff ' . $this->_setflag($form['FF']));
1473 if ($this->formUseZapD) {
1474 $this->writer->write('/DA (/F' . $this->mpdf->fonts['czapfdingbats']['i'] . ' 0 Tf ' . $radio_color . ' rg)');
1476 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$this->mpdf->CurrentFont['fontkey']]['i'] . ' 0 Tf ' . $radio_color . ' rg)');
1479 $this->writer->write('/AP << /N << /' . $this->writer->escape($form['V']) . ' ' . ($this->mpdf->n + 1) . ' 0 R /Off ' . ($this->mpdf->n + 2) . ' 0 R >> >>');
1482 $this->writer->write('/V /' . $this->writer->escape($form['V']) . ' ');
1483 $this->writer->write('/DV /' . $this->writer->escape($form['V']) . ' ');
1484 $this->writer->write('/AS /' . $this->writer->escape($form['V']) . ' ');
1486 $this->writer->write('/AS /Off ');
1488 $this->writer->write('/AP << /N << /' . $this->writer->escape($form['V']) . ' ' . ($this->mpdf->n + 1) . ' 0 R /Off ' . ($this->mpdf->n + 2) . ' 0 R >> >>');
1489 // $this->writer->write('/Opt [ '.$this->writer->string($form['OPT']).' '.$this->writer->string($form['OPT']).' ]');
1493 $temp .= $form['CA'] ? '/CA ' . $this->writer->string($form['CA']) . ' ' : '/CA ' . $this->writer->string($form['T']) . ' ';
1494 $temp .= $form['RC'] ? '/RC ' . $this->writer->string($form['RC']) . ' ' : '/RC ' . $this->writer->string($form['T']) . ' ';
1495 $temp .= $form['AC'] ? '/AC ' . $this->writer->string($form['AC']) . ' ' : '/AC ' . $this->writer->string($form['T']) . ' ';
1496 $this->writer->write("/BS << $bstemp >>");
1497 $this->writer->write('/MK << ' . $temp . ' >>');
1498 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$form['style']['font']]['i'] . ' ' . $form['style']['fontsize'] . ' Tf ' . $form['style']['fontcolor'] . ')');
1499 $this->writer->write('/AA << /D << /S /ResetForm /Flags 1 >> >>');
1501 $this->writer->write('/Ff ' . $this->_setflag($form['FF']));
1506 $temp .= $form['CA'] ? '/CA ' . $this->writer->string($form['CA']) . ' ' : '/CA ' . $this->writer->string($form['T']) . ' ';
1507 $temp .= $form['RC'] ? '/RC ' . $this->writer->string($form['RC']) . ' ' : '/RC ' . $this->writer->string($form['T']) . ' ';
1508 $temp .= $form['AC'] ? '/AC ' . $this->writer->string($form['AC']) . ' ' : '/AC ' . $this->writer->string($form['T']) . ' ';
1509 $this->writer->write("/BS << $bstemp >>");
1510 $this->writer->write("/MK << $temp >>");
1511 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$form['style']['font']]['i'] . ' ' . $form['style']['fontsize'] . ' Tf ' . $form['style']['fontcolor'] . ')');
1514 // Bit 3 (4) = HTML export format (charset chosen by Adobe)--- OR ---
1515 // Bit 6 (32) = XFDF export format (form of XML in UTF-8)
1524 if ($this->formSubmitNoValueFields) {
1529 $this->writer->write('/AA << /D << /S /SubmitForm /F (' . $form['URL'] . ') /Flags ' . $flag . ' >> >>');
1531 $this->writer->write('/Ff ' . $this->_setflag($form['FF']));
1536 if (isset($this->form_button_icon[$form['T']])) {
1538 $temp .= '/TP ' . $this->form_button_icon[$form['T']]['pos'] . ' ';
1539 $temp .= '/I ' . ($cc + $this->mpdf->n) . ' 0 R '; // Normal icon
1540 $temp .= '/RI ' . ($cc + $this->mpdf->n) . ' 0 R '; // onMouseOver
1541 $temp .= '/IX ' . ($cc + $this->mpdf->n) . ' 0 R '; // onClick / onMouseDown
1543 if ($this->form_button_icon[$form['T']]['Indexed']) {
1548 $temp .= $form['CA'] ? '/CA ' . $this->writer->string($form['CA']) . ' ' : '/CA ' . $this->writer->string($form['T']) . ' ';
1549 $temp .= $form['RC'] ? '/RC ' . $this->writer->string($form['RC']) . ' ' : '/RC ' . $this->writer->string($form['T']) . ' ';
1550 $temp .= $form['AC'] ? '/AC ' . $this->writer->string($form['AC']) . ' ' : '/AC ' . $this->writer->string($form['T']) . ' ';
1551 $this->writer->write("/BS << $bstemp >>");
1552 $this->writer->write("/MK << $temp >>");
1553 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$form['style']['font']]['i'] . ' ' . $form['style']['fontsize'] . ' Tf ' . $form['style']['fontcolor'] . ')');
1555 $this->writer->write('/Ff ' . $this->_setflag($form['FF']));
1557 if (isset($this->array_form_button_js[$form['T']])) {
1559 $this->writer->write('/AA << /D ' . ($cc + $this->mpdf->n) . ' 0 R >>');
1564 $this->writer->write('>>');
1565 $this->writer->write('endobj');
1570 $this->_put_button_icon($this->form_button_icon[$form['T']], $form['w'], $form['h']);
1575 $this->mpdf->_set_object_javascript($this->array_form_button_js[$form['T']]['js']);
1576 unset($this->array_form_button_js[$form['T']]);
1581 $filter = $this->mpdf->compress ? '/Filter /FlateDecode ' : '';
1584 if ($this->formUseZapD) {
1587 $r_on = 'q ' . $radio_color . ' rg BT /F' . $this->mpdf->fonts[$fi]['i'] . ' ' . $fs . ' Tf 0 0 Td (4) Tj ET Q';
1588 $r_off = 'q ' . $radio_color . ' rg BT /F' . $this->mpdf->fonts[$fi]['i'] . ' ' . $fs . ' Tf 0 0 Td (8) Tj ET Q';
1591 $fill = $radio_background_color . ' rg 3.778 -7.410 m 2.800 -7.410 1.947 -7.047 1.225 -6.322 c 0.500 -5.600 0.138 -4.747 0.138 -3.769 c 0.138 -2.788 0.500 -1.938 1.225 -1.213 c 1.947 -0.491 2.800 -0.128 3.778 -0.128 c 4.757 -0.128 5.610 -0.491 6.334 -1.213 c 7.056 -1.938 7.419 -2.788 7.419 -3.769 c 7.419 -4.747 7.056 -5.600 6.334 -6.322 c 5.610 -7.047 4.757 -7.410 3.778 -7.410 c h f ';
1592 $circle = '3.778 -6.963 m 4.631 -6.963 5.375 -6.641 6.013 -6.004 c 6.653 -5.366 6.972 -4.619 6.972 -3.769 c 6.972 -2.916 6.653 -2.172 6.013 -1.532 c 5.375 -0.894 4.631 -0.576 3.778 -0.576 c 2.928 -0.576 2.182 -0.894 1.544 -1.532 c 0.904 -2.172 0.585 -2.916 0.585 -3.769 c 0.585 -4.619 0.904 -5.366 1.544 -6.004 c 2.182 -6.641 2.928 -6.963 3.778 -6.963 c h 3.778 -7.410 m 2.800 -7.410 1.947 -7.047 1.225 -6.322 c 0.500 -5.600 0.138 -4.747 0.138 -3.769 c 0.138 -2.788 0.500 -1.938 1.225 -1.213 c 1.947 -0.491 2.800 -0.128 3.778 -0.128 c 4.757 -0.128 5.610 -0.491 6.334 -1.213 c 7.056 -1.938 7.419 -2.788 7.419 -3.769 c 7.419 -4.747 7.056 -5.600 6.334 -6.322 c 5.610 -7.047 4.757 -7.410 3.778 -7.410 c h f ';
1594 5.184 -5.110 m 4.800 -5.494 4.354 -5.685 3.841 -5.685 c 3.331 -5.685 2.885 -5.494 2.501 -5.110 c 2.119 -4.725 1.925 -4.279 1.925 -3.769 c 1.925 -3.257 2.119 -2.810 2.501 -2.429 c 2.885 -2.044 3.331 -1.853 3.841 -1.853 c 4.354 -1.853 4.800 -2.044 5.184 -2.429 c 5.566 -2.810 5.760 -3.257 5.760 -3.769 c 5.760 -4.279 5.566 -4.725 5.184 -5.110 c h
1599 $this->writer->object();
1600 $p = $this->mpdf->compress ? gzcompress($r_on) : $r_on;
1601 $this->writer->write('<<' . $filter . '/Length ' . strlen($p) . ' /Resources 2 0 R>>');
1602 $this->writer->stream($p);
1603 $this->writer->write('endobj');
1605 $this->writer->object();
1606 $p = $this->mpdf->compress ? gzcompress($r_off) : $r_off;
1607 $this->writer->write('<<' . $filter . '/Length ' . strlen($p) . ' /Resources 2 0 R>>');
1608 $this->writer->stream($p);
1609 $this->writer->write('endobj');
1614 if ($this->formUseZapD) {
1617 $cb_on = 'q ' . $radio_color . ' rg BT /F' . $this->mpdf->fonts[$fi]['i'] . ' ' . $fs . ' Tf 0 0 Td (4) Tj ET Q';
1618 $cb_off = 'q ' . $radio_color . ' rg BT /F' . $this->mpdf->fonts[$fi]['i'] . ' ' . $fs . ' Tf 0 0 Td (8) Tj ET Q';
1621 $fill = $radio_background_color . ' rg 7.395 -0.070 m 7.395 -7.344 l 0.121 -7.344 l 0.121 -0.070 l 7.395 -0.070 l h f ';
1622 $square = '0.508 -6.880 m 6.969 -6.880 l 6.969 -0.534 l 0.508 -0.534 l 0.508 -6.880 l h 7.395 -0.070 m 7.395 -7.344 l 0.121 -7.344 l 0.121 -0.070 l 7.395 -0.070 l h ';
1624 6.321 -1.352 m 5.669 -2.075 5.070 -2.801 4.525 -3.532 c 3.979 -4.262 3.508 -4.967 3.112 -5.649 c 3.080 -5.706 3.039 -5.779 2.993 -5.868 c 2.858 -6.118 2.638 -6.243 2.334 -6.243 c 2.194 -6.243 2.100 -6.231 2.052 -6.205 c 2.003 -6.180 1.954 -6.118 1.904 -6.020 c 1.787 -5.788 1.688 -5.523 1.604 -5.226 c 1.521 -4.930 1.480 -4.721 1.480 -4.600 c 1.480 -4.535 1.491 -4.484 1.512 -4.447 c 1.535 -4.410 1.579 -4.367 1.647 -4.319 c 1.733 -4.259 1.828 -4.210 1.935 -4.172 c 2.040 -4.134 2.131 -4.115 2.205 -4.115 c 2.267 -4.115 2.341 -4.232 2.429 -4.469 c 2.437 -4.494 2.444 -4.511 2.448 -4.522 c 2.451 -4.531 2.456 -4.546 2.465 -4.568 c 2.546 -4.795 2.614 -4.910 2.668 -4.910 c 2.714 -4.910 2.898 -4.652 3.219 -4.136 c 3.539 -3.620 3.866 -3.136 4.197 -2.683 c 4.426 -2.367 4.633 -2.103 4.816 -1.889 c 4.998 -1.676 5.131 -1.544 5.211 -1.493 c 5.329 -1.426 5.483 -1.368 5.670 -1.319 c 5.856 -1.271 6.066 -1.238 6.296 -1.217 c 6.321 -1.352 l h f Q ';
1627 $this->writer->object();
1628 $p = $this->mpdf->compress ? gzcompress($cb_on) : $cb_on;
1629 $this->writer->write('<<' . $filter . '/Length ' . strlen($p) . ' /Resources 2 0 R>>');
1630 $this->writer->stream($p);
1631 $this->writer->write('endobj');
1634 if (!$this->formUseZapD) {
1635 $this->writer->object();
1636 $p = $this->mpdf->compress ? gzcompress($cb_off) : $cb_off;
1637 $this->writer->write('<<' . $filter . '/Length ' . strlen($p) . ' /Resources 2 0 R>>');
1638 $this->writer->stream($p);
1639 $this->writer->write('endobj');
1648 $this->writer->object();
1649 $n = $this->mpdf->n;
1650 $this->pdf_acro_array .= $n . ' 0 R ';
1651 $this->forms[$form['n']]['obj'] = $n;
1653 $this->writer->write('<<');
1654 $this->writer->write('/Type /Annot ');
1655 $this->writer->write('/Subtype /Widget');
1656 $this->writer->write('/Rect [ ' . $this->_form_rect($form['x'], $form['y'], $form['w'], $form['h'], $hPt) . ' ]');
1657 $this->writer->write('/F 4');
1658 $this->writer->write('/FT /Ch');
1660 $this->writer->write('/Q ' . $form['Q'] . '');
1665 $this->writer->write("/BS << $temp >>");
1670 $this->writer->write('/MK << ' . $temp . ' >>');
1672 $this->writer->write('/NM ' . $this->writer->string(sprintf('%04u-%04u', $n, 6000 + $form['n'])));
1673 $this->writer->write('/M ' . $this->writer->string('D:' . date('YmdHis')));
1675 $this->writer->write('/T ' . $this->writer->string($form['T']));
1676 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$form['style']['font']]['i'] . ' ' . $form['style']['fontsize'] . ' Tf ' . $form['style']['fontcolor'] . ')');
1681 $opt .= '[ ' . $this->writer->string($form['OPT']['VAL'][$i]) . ' ' . $this->writer->string($form['OPT']['OPT'][$i]) . ' ] ';
1683 $this->writer->write('/Opt [ ' . $opt . ']');
1689 $selectName = $this->writer->string($form['OPT']['VAL'][$selectVal]);
1695 $this->writer->write('/V ' . $selectItem . ' ');
1696 $this->writer->write('/DV ' . $selectItem . ' ');
1698 $this->writer->write('/V [' . $selectItem . '] ');
1699 $this->writer->write('/DV [' . $selectItem . '] ');
1701 $this->writer->write('/I [' . $selectIndex . '] ');
1705 $this->writer->write('/Ff ' . $this->_setflag($form['FF']) . ' ');
1709 if (isset($this->array_form_choice_js[$form['T']])) {
1710 $this->writer->write('/AA << /V ' . ($this->mpdf->n + 1) . ' 0 R >>');
1714 $this->writer->write('>>');
1715 $this->writer->write('endobj');
1719 $this->mpdf->_set_object_javascript($this->array_form_choice_js[$form['T']]['js']);
1720 unset($this->array_form_choice_js[$form['T']]);
1730 $this->writer->object();
1731 $n = $this->mpdf->n;
1732 $this->pdf_acro_array .= $n . ' 0 R ';
1733 $this->forms[$form['n']]['obj'] = $n;
1735 $this->writer->write('<<');
1736 $this->writer->write('/Type /Annot ');
1737 $this->writer->write('/Subtype /Widget ');
1739 $this->writer->write('/Rect [ ' . $this->_form_rect($form['x'], $form['y'], $form['w'], $form['h'], $hPt) . ' ] ');
1740 $form['hidden'] ? $this->writer->write('/F 2 ') : $this->writer->write('/F 4 ');
1741 $this->writer->write('/FT /Tx ');
1743 $this->writer->write('/H /N ');
1744 $this->writer->write('/R 0 ');
1747 $this->writer->write('/Ff ' . $this->_setflag($form['FF']) . ' ');
1750 $this->writer->write('/MaxLen ' . $form['maxlen']);
1756 $this->writer->write("/BS << $temp >>");
1761 $this->writer->write('/MK <<' . $temp . ' >>');
1763 $this->writer->write('/T ' . $this->writer->string($form['T']));
1764 $this->writer->write('/TU ' . $this->writer->string($form['TU']));
1766 $this->writer->write('/V ' . $this->writer->string($form['V']));
1768 $this->writer->write('/DV ' . $this->writer->string($form['DV']));
1769 $this->writer->write('/DA (/F' . $this->mpdf->fonts[$form['style']['font']]['i'] . ' ' . $form['style']['fontsize'] . ' Tf ' . $form['style']['fontcolor'] . ')');
1771 $this->writer->write('/Q ' . $form['Q'] . '');
1774 $this->writer->write('/NM ' . $this->writer->string(sprintf('%04u-%04u', $n, 5000 + $form['n'])));
1775 $this->writer->write('/M ' . $this->writer->string('D:' . date('YmdHis')));
1778 if (isset($this->array_form_text_js[$form['T']])) {
1783 if (isset($this->array_form_text_js[$form['T']]['F'])) {
1785 $js_str .= '/F ' . ($cc + $this->mpdf->n) . ' 0 R ';
1787 if (isset($this->array_form_text_js[$form['T']]['K'])) {
1789 $js_str .= '/K ' . ($cc + $this->mpdf->n) . ' 0 R ';
1791 if (isset($this->array_form_text_js[$form['T']]['V'])) {
1793 $js_str .= '/V ' . ($cc + $this->mpdf->n) . ' 0 R ';
1795 if (isset($this->array_form_text_js[$form['T']]['C'])) {
1797 $js_str .= '/C ' . ($cc + $this->mpdf->n) . ' 0 R ';
1798 $this->pdf_array_co .= $this->mpdf->n . ' 0 R ';
1800 $this->writer->write('/AA << ' . $js_str . ' >>');
1803 $this->writer->write('>>');
1804 $this->writer->write('endobj');
1807 if (isset($this->array_form_text_js[$form['T']]['F'])) {
1808 $this->mpdf->_set_object_javascript($this->array_form_text_js[$form['T']]['F']['js']);
1809 unset($this->array_form_text_js[$form['T']]['F']);
1811 if (isset($this->array_form_text_js[$form['T']]['K'])) {
1812 $this->mpdf->_set_object_javascript($this->array_form_text_js[$form['T']]['K']['js']);
1813 unset($this->array_form_text_js[$form['T']]['K']);
1815 if (isset($this->array_form_text_js[$form['T']]['V'])) {
1816 $this->mpdf->_set_object_javascript($this->array_form_text_js[$form['T']]['V']['js']);
1817 unset($this->array_form_text_js[$form['T']]['V']);
1819 if (isset($this->array_form_text_js[$form['T']]['C'])) {
1820 $this->mpdf->_set_object_javascript($this->array_form_text_js[$form['T']]['C']['js']);
1821 unset($this->array_form_text_js[$form['T']]['C']);