Lines Matching refs:this

51       return $this->object_id;
55 return $this->generation_id;
76 if (!$handler->is_object_written($this->get_object_id())) {
77 $handler->offsets[$this->get_object_id()] = strlen($handler->buffer);
78 $handler->_out($handler->_indirect_object($this));
80 $this->_out_nested($handler);
99 $this->object_id = $object_id;
100 $this->generation_id = $generation_id;
104 return $handler->_dictionary($this->_dict($handler));
118 $this->PDFIndirectObject($handler,
124 $this->annotations[] =& $annotation;
128 return $handler->_reference_array($this->annotations);
139 $this->PDFIndirectObject($handler,
143 $this->_content = $content;
154 'Length' => strlen($this->_content)
159 $content .= $handler->_stream($this->_content);
169 $this->PDFIndirectObject($handler,
187 $this->x = $x;
188 $this->y = $y;
189 $this->w = $w;
190 $this->h = $h;
194 return $handler->x_coord($this->x);
198 return $handler->x_coord($this->x+$this->w);
202 return $handler->y_coord($this->y);
206 return $handler->y_coord($this->y+$this->h);
211 $this->left($handler),
212 $this->top($handler),
213 $this->right($handler),
214 $this->bottom($handler)));
227 $this->PDFAnnotation($handler,
231 $this->rect = $rect;
232 $this->link = $link;
239 'Rect' => $this->rect->pdf($handler),
241 … 'A' => "<</S /URI /URI ".$handler->_textstring($this->link).">>"
255 $this->PDFAnnotation($handler,
259 $this->rect = $rect;
260 $this->link = $link;
271 $l = $handler->links[$this->link];
290 'Rect' => $this->rect->pdf($handler),
307 $this->PDFAnnotation($handler,
311 $this->_rect = $rect;
317 'Rect' => $this->_rect->pdf($handler)));
332 $this->PDFIndirectObject($handler,
340 $group_name = sprintf("FieldGroup%d", $this->get_object_id());
342 $this->_group_name = $group_name;
344 $this->_kids = array();
360 foreach ($this->_kids as $kid) {
363 $this->_group_name,
373 if (!$this->_check_field_name($field)) {
382 $this->_kids[] =& $field;
383 $field->set_parent($this);
388 array("Kids" => $handler->_reference_array($this->_kids),
389 "T" => $handler->_textstring($this->_group_name)));
396 foreach ($this->_kids as $field) {
424 $this->PDFAnnotationWidget($handler,
434 $field_name = sprintf("FieldObject%d", $this->get_object_id());
437 $this->_field_name = $field_name;
441 if ($this->_field_name) {
442 return $this->_field_name;
444 return sprintf("FormObject%d", $this->get_object_id());
450 array("Parent" => $handler->_reference($this->_parent),
451 "T" => $handler->_textstring($this->get_field_name())));
455 return $handler->_dictionary($this->_dict($handler));
459 $this->_field_name = $value;
463 $this->_parent =& $form;
467 return $this->_parent;
487 $this->PDFField($handler,
493 $this->_value = $value;
494 $this->_checked = $checked;
496 $this->_appearance_on = new PDFAppearanceStream($handler,
501 $this->_appearance_off = new PDFAppearanceStream($handler,
514 … 'DV' => $this->_checked ? $handler->_name($this->_value) : "/Off",
515 … 'V' => $this->_checked ? $handler->_name($this->_value) : "/Off",
517 $this->_value,
518 $handler->_reference($this->_appearance_on),
519 $handler->_reference($this->_appearance_off))
527 $this->_appearance_on->out($handler);
528 $this->_appearance_off->out($handler);
540 $this->_appearance->out($handler);
549 $this->PDFField($handler,
554 $this->fontindex = $fontindex;
555 $this->fontsize = $fontsize;
557 $this->_appearance = new PDFAppearanceStream($handler,
575 $this->fontindex,
576 $this->fontsize),
577 'AP' => "<< /N ".$handler->_reference($this->_appearance)." >>",
578 'AA' => $this->_action($handler)
595 $this->PDFFieldPushButton($handler,
602 $this->_link = $link;
603 $this->set_field_name($field_name);
609 'F' => $handler->_textstring($this->_link),
610 … 'Fields'=> $handler->_reference_array(array($this->get_parent())),
631 $this->PDFFieldPushButton($handler,
638 $this->_link = $link;
639 $this->_caption = $value;
640 $this->set_field_name($field_name);
646 'F' => $handler->_textstring($this->_link),
647 … 'Fields'=> $handler->_reference_array(array($this->get_parent())),
663 $this->PDFFieldPushButton($handler,
704 $this->PDFAnnotationWidget($handler,
709 $this->_value = $value;
711 $this->_appearance_on = new PDFAppearanceStream($handler,
716 $this->_appearance_off = new PDFAppearanceStream($handler,
726 'Parent' => $handler->_reference($this->_parent),
728 $this->_value,
729 $handler->_reference($this->_appearance_on),
730 $handler->_reference($this->_appearance_off))
737 $this->_appearance_on->out($handler);
738 $this->_appearance_off->out($handler);
747 $this->_parent =& $parent;
761 … 'DV' => $this->_checked ? $handler->_name($this->_checked) : "/Off",
762 … 'V' => $this->_checked ? $handler->_name($this->_checked) : "/Off",
765 "Parent" => $handler->_reference($this->_parent)
781 $this->PDFFieldGroup($handler,
786 $this->_checked = null;
793 return $this->_group_name;
797 $this->_checked = $value;
801 $this->_parent =& $parent;
811 foreach ($this->_options as $arr) {
822 'V' => $handler->_textstring($this->_value), // Current value
823 'DV' => $handler->_textstring($this->_value), // Default value
835 $this->PDFField($handler,
841 $this->_options = $options;
842 $this->_value = $value;
865 'V' => $handler->_textstring($this->_value), // Current value
866 'DV' => $handler->_textstring($this->_value), // Default value
870 $this->fontindex,
871 $this->fontsize),
888 $this->PDFField($handler,
894 $this->fontindex = $fontindex;
895 $this->fontsize = $fontsize;
896 $this->_value = $value;
924 $this->PDFFieldText($handler,
1005 $this->_out(sprintf("%.2f %.2f m",
1006 $this->x_coord($x),
1007 $this->y_coord($y)));
1011 $this->_out(sprintf("%.2f %.2f l",
1012 $this->x_coord($x),
1013 $this->y_coord($y)));
1017 $this->_out("h");
1021 $this->_out("S");
1025 return isset($this->offsets[$id]);
1029 return $x * $this->k;
1033 return ($this->h - $y)*$this->k;
1056 $object_string = $object->pdf($this);
1058 $this->offsets[$object_number] = strlen($this->buffer);
1095 $array_str .= $this->_reference($object_array[$i])." ";
1097 return $this->_array($array_str);
1101 $this->n++;
1102 return $this->n;
1106 $form = new PDFFieldGroup($this,
1107 $this->_generate_new_object_number(), // Object identifier
1110 $this->_forms[] =& $form;
1114 $field =& new PDFFieldSelect($this,
1115 $this->_generate_new_object_number(), // Object identifier
1122 $current_form =& $this->current_form();
1125 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1141 $field =& new PDFFieldCheckBox($this,
1142 $this->_generate_new_object_number(), // Object identifier
1148 $current_form =& $this->current_form();
1151 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1155 if (count($this->_forms) == 0) {
1161 $id = $this->_generate_new_object_number();
1167 $form = new PDFFieldGroup($this,
1171 $this->_forms[] =& $form;
1174 return $this->_forms[count($this->_forms)-1];
1178 if (isset($this->_form_radios[$group_name])) {
1179 $field =& $this->_form_radios[$group_name];
1181 $field =& new PDFFieldRadioGroup($this,
1182 $this->_generate_new_object_number(),
1186 $current_form =& $this->current_form();
1189 $this->_form_radios[$group_name] =& $field;
1192 $radio =& new PDFFieldRadio($this,
1193 $this->_generate_new_object_number(),
1200 $this->_pages[count($this->_pages)-1]->add_annotation($radio);
1216 $field =& new PDFFieldText($this,
1217 $this->_generate_new_object_number(),
1222 $this->CurrentFont['i'],
1223 $this->FontSizePt);
1225 $current_form =& $this->current_form();
1228 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1232 $field =& new PDFFieldMultilineText($this,
1233 $this->_generate_new_object_number(),
1238 $this->CurrentFont['i'],
1239 $this->FontSizePt);
1241 $current_form =& $this->current_form();
1244 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1260 $field =& new PDFFieldPassword($this,
1261 $this->_generate_new_object_number(),
1266 $this->CurrentFont['i'],
1267 $this->FontSizePt);
1269 $current_form =& $this->current_form();
1272 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1276 $field =& new PDFFieldPushButtonImage($this,
1277 $this->_generate_new_object_number(),
1280 $this->CurrentFont['i'],
1281 $this->FontSizePt,
1286 $current_form =& $this->current_form();
1289 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1293 $field =& new PDFFieldPushButtonSubmit($this,
1294 $this->_generate_new_object_number(),
1297 $this->CurrentFont['i'],
1298 $this->FontSizePt,
1303 $current_form =& $this->current_form();
1306 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1310 $field =& new PDFFieldPushButtonReset($this,
1311 $this->_generate_new_object_number(),
1315 $this->CurrentFont['i'],
1316 $this->FontSizePt);
1318 $current_form =& $this->current_form();
1321 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1325 $field =& new PDFFieldPushButton($this,
1326 $this->_generate_new_object_number(),
1330 $this->CurrentFont['i'],
1331 $this->FontSizePt);
1333 $current_form =& $this->current_form();
1336 $this->_pages[count($this->_pages)-1]->add_annotation($field);
1343 $this->_out(sprintf("[%d %d] 0 d", $x*2, $y*2));
1347 return preg_split("/[\[\]\s]+/", $this->CurrentFont['desc']['FontBBox']);
1352 $up=$this->CurrentFont['up'];
1353 $ut=$this->CurrentFont['ut'];
1354 $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
1356 $x*$this->k,
1357 ($this->h-($y-$up/1000*$this->FontSize))*$this->k,
1358 $w*$this->k,
1359 -$ut/1000*$this->FontSizePt);
1363 $bbox = $this->_GetFontBBox();
1366 $ut=$this->CurrentFont['ut'];
1368 $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
1370 $x*$this->k,
1371 ($this->h-($y-$up/1000*$this->FontSize))*$this->k,
1372 $w*$this->k,
1373 -$ut/1000*$this->FontSizePt);
1377 $bbox = $this->_GetFontBBox();
1380 $ut=$this->CurrentFont['ut'];
1381 $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
1383 $x*$this->k,
1384 ($this->h-($y-$up/1000*$this->FontSize))*$this->k,
1385 $w*$this->k,
1386 -$ut/1000*$this->FontSizePt);
1390 $this->underline = $underline;
1391 $this->overline = $overline;
1392 $this->strikeout = $strikeout;
1400 $this->MakePath($path);
1401 $this->Clip();
1405 $this->_out("W n");
1411 if (!isset($this->fonts[$fontkey])) {
1421 if (!file_exists($this->_getfontpath().$fontkey.'.php')) {
1426 $this->_getfontpath(),
1432 $this->AddFont($fontkey, $family, "", $encoding, $fontkey.'.php', $embed);
1441 $fontkey = $this->_MakeFontKey($name, $encoding);
1442 $this->_LoadFont($fontkey, $name, $encoding, '');
1443 return $this->fonts[$fontkey]['desc']['Ascent'] / 1000;
1447 $fontkey = $this->_MakeFontKey($name, $encoding);
1448 $this->_LoadFont($fontkey, $name, $encoding, '');
1449 return -$this->fonts[$fontkey]['desc']['Descent'] / 1000;
1453 function Save() { $this->_out("q"); }
1454 function Restore() { $this->_out("Q"); }
1457 $this->_out(sprintf("1 0 0 1 %.2f %.2f cm", $dx, $dy));
1461 $this->_out(sprintf("%.2f %.2f %.2f %.2f 0 0 cm",
1470 $this->_out(sprintf("%d Tr", $mode));
1474 $this->_out(sprintf("%.2f %.2f m", $path[0]['x'], $path[0]['y']));
1477 $this->_out(sprintf("%.2f %.2f l", $path[$i]['x'], $path[$i]['y']));
1486 $this->_out($this->FillColor);
1487 $this->MakePath($path);
1488 $this->Fill();
1492 $this->_out("f");
1502 $this->_out(sprintf("%.2f %.f2 m", $x + $r, $y));
1503 $this->_out(sprintf("%.2f %.f2 %.2f %.2f %.2f %.2f c",
1507 $this->_out(sprintf("%.2f %.f2 %.2f %.2f %.2f %.2f c",
1511 $this->_out(sprintf("%.2f %.f2 %.2f %.2f %.2f %.2f c",
1515 $this->_out(sprintf("%.2f %.f2 %.2f %.2f %.2f %.2f c",
1527 $this->_forms = array();
1528 $this->_form_radios = array();
1529 $this->_pages = array();
1532 $this->_dochecks();
1535 $this->page=0;
1537 $this->n=2;
1539 $this->buffer='';
1540 $this->pages=array();
1541 $this->OrientationChanges=array();
1542 $this->state=0;
1543 $this->fonts=array();
1544 $this->FontFiles=array();
1545 $this->diffs = array();
1546 $this->images = array();
1547 $this->links = array();
1548 $this->InFooter=false;
1549 $this->lasth=0;
1550 $this->FontFamily='';
1551 $this->FontStyle='';
1552 $this->FontSizePt=12;
1554 $this->underline = false;
1555 $this->overline = false;
1556 $this->strikeout = false;
1558 $this->DrawColor='0 G';
1559 $this->FillColor='0 g';
1560 $this->TextColor='0 g';
1561 $this->ColorFlag=false;
1562 $this->ws=0;
1567 $this->k = 1; break;
1569 $this->k = 72/25.4; break;
1571 $this->k = 72/2.54; break;
1573 $this->k = 72;
1575 $this->Error('Incorrect unit: '.$unit);
1594 $this->Error('Unknown page format: '.$format);
1596 $this->fwPt=$format[0];
1597 $this->fhPt=$format[1];
1599 $this->fwPt=$format[0]*$this->k;
1600 $this->fhPt=$format[1]*$this->k;
1603 $this->fw=$this->fwPt/$this->k;
1604 $this->fh=$this->fhPt/$this->k;
1609 $this->DefOrientation='P';
1610 $this->wPt=$this->fwPt;
1611 $this->hPt=$this->fhPt;
1613 $this->DefOrientation='L';
1614 $this->wPt=$this->fhPt;
1615 $this->hPt=$this->fwPt;
1617 $this->Error('Incorrect orientation: '.$orientation);
1620 $this->CurOrientation=$this->DefOrientation;
1621 $this->w=$this->wPt/$this->k;
1622 $this->h=$this->hPt/$this->k;
1624 $margin=28.35/$this->k;
1625 $this->SetMargins($margin,$margin);
1627 $this->cMargin=$margin/10;
1629 $this->LineWidth=.567/$this->k;
1631 $this->SetAutoPageBreak(true,2*$margin);
1634 $this->SetDisplayMode('fullwidth');
1637 $this->SetCompression(true);
1640 $this->PDFVersion='1.3';
1646 $this->lMargin=$left;
1647 $this->tMargin=$top;
1650 $this->rMargin=$right;
1656 $this->lMargin=$margin;
1657 if($this->page>0 && $this->x<$margin)
1658 $this->x=$margin;
1664 $this->tMargin=$margin;
1670 $this->rMargin=$margin;
1676 $this->AutoPageBreak=$auto;
1677 $this->bMargin=$margin;
1678 $this->PageBreakTrigger=$this->h-$margin;
1685 $this->ZoomMode=$zoom;
1687 $this->Error('Incorrect zoom display mode: '.$zoom);
1689 $this->LayoutMode=$layout;
1691 $this->Error('Incorrect layout display mode: '.$layout);
1698 $this->compress=$compress;
1700 $this->compress=false;
1706 $this->title=$title;
1712 $this->subject=$subject;
1718 $this->author=$author;
1724 $this->keywords=$keywords;
1730 $this->creator=$creator;
1736 $this->AliasNbPages=$alias;
1747 $this->state=1;
1752 if ($this->state==3) {
1756 if ($this->page==0) {
1757 $this->AddPage();
1761 $this->InFooter=true;
1762 $this->Footer();
1763 $this->InFooter=false;
1765 $this->_endpage();
1767 $this->_enddoc();
1771 $this->_pages[] =& new PDFPage($this, $this->_generate_new_object_number(), 0);
1774 if ($this->state==0) {
1775 $this->Open();
1778 $family=$this->FontFamily;
1780 $style=$this->FontStyle.($this->underline ? 'U' : '');
1782 $size=$this->FontSizePt;
1783 $lw=$this->LineWidth;
1784 $dc=$this->DrawColor;
1785 $fc=$this->FillColor;
1786 $tc=$this->TextColor;
1787 $cf=$this->ColorFlag;
1788 if ($this->page>0) {
1790 $this->InFooter=true;
1791 $this->Footer();
1792 $this->InFooter=false;
1794 $this->_endpage();
1798 $this->_beginpage($orientation);
1800 $this->_out('2 J');
1802 $this->LineWidth=$lw;
1803 $this->_out(sprintf('%.2f w',$lw*$this->k));
1806 $this->DrawColor=$dc;
1808 $this->_out($dc);
1811 $this->FillColor=$fc;
1813 $this->_out($fc);
1816 $this->TextColor=$tc;
1817 $this->ColorFlag=$cf;
1819 $this->Header();
1822 if ($this->LineWidth!=$lw) {
1823 $this->LineWidth=$lw;
1824 $this->_out(sprintf('%.2f w',$lw*$this->k));
1828 if ($this->DrawColor!=$dc) {
1829 $this->DrawColor=$dc;
1830 $this->_out($dc);
1832 if ($this->FillColor!=$fc) {
1833 $this->FillColor=$fc;
1834 $this->_out($fc);
1836 $this->TextColor=$tc;
1837 $this->ColorFlag=$cf;
1839 if (!is_null($this->CurrentFont)) {
1840 $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
1857 return $this->page;
1868 if ($this->page > 0 /*&& $this->DrawColor != $new_color*/) {
1869 $this->DrawColor = $new_color;
1870 $this->_out($this->DrawColor);
1882 if ($this->page>0 /*&& $this->FillColor != $new_color*/) {
1883 $this->FillColor = $new_color;
1884 $this->ColorFlag=($this->FillColor!=$this->TextColor);
1885 $this->_out($this->FillColor);
1892 $this->TextColor=sprintf('%.3f g',$r/255);
1894 $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);
1897 $this->ColorFlag=($this->FillColor!=$this->TextColor);
1903 $cw = &$this->CurrentFont['cw'];
1911 return $w*$this->FontSize/1000;
1916 $this->LineWidth=$width;
1917 if($this->page>0)
1918 $this->_out(sprintf('%.2f w',$width*$this->k));
1923 …$this->_out(sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,…
1935 …$this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h…
1947 if(isset($this->fonts[$fontkey])) {
1948 $this->Error('Font already added: '.$family.' '.$style);
1951 $filepath = $this->_getfontpath().$file;
1960 $this->Error("Could not include font definition file: $filepath");
1963 $i=count($this->fonts)+1;
1964 $this->fonts[$fontkey]=array('i' =>$i,
1977 $nb=count($this->diffs);
1979 if($this->diffs[$i]==$diff)
1987 $this->diffs[$d]=$diff;
1989 $this->fonts[$fontkey]['diff']=$d;
1994 $this->FontFiles[$file]=array('length1'=>$originalsize);
1996 $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2);
2007 $this->underline=true;
2010 $this->underline=false;
2015 $size = $this->FontSizePt;
2018 $fontkey = $this->_MakeFontKey($family, $encoding);
2019 $this->_LoadFont($fontkey, $family, $encoding, $style);
2021 if ($this->page > 0 /* &&
2025 $this->FontFamily = $family;
2026 $this->FontStyle = $style;
2027 $this->FontSizePt = $size;
2028 $this->FontSize = $size/$this->k;
2030 $this->CurrentFont = &$this->fonts[$fontkey];
2031 $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
2050 $n=count($this->links)+1;
2051 $this->links[$n]=array(0,0);
2058 $y=$this->y;
2061 $page=$this->page;
2063 $this->links[$link]=array($page,$y);
2077 $link = new PDFAnnotationExternalLink($this,
2078 $this->_generate_new_object_number(),
2082 $this->_pages[count($this->_pages)-1]->add_annotation($link);
2096 $link = new PDFAnnotationInternalLink($this,
2097 $this->_generate_new_object_number(),
2101 $this->_pages[count($this->_pages)-1]->add_annotation($link);
2106 … $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
2108 if ($this->underline && $txt!='') {
2109 $s.=' '.$this->_dounderline($x,$y,$txt);
2112 if ($this->overline && $txt!='') {
2113 $s.=' '.$this->_dooverline($x,$y,$txt);
2116 if ($this->strikeout && $txt!='') {
2117 $s.=' '.$this->_dostrikeout($x,$y,$txt);
2120 if($this->ColorFlag)
2121 $s='q '.$this->TextColor.' '.$s.' Q';
2122 $this->_out($s);
2128 return $this->AutoPageBreak;
2134 $k=$this->k;
2135 if($this->y+$h>$this->PageBreakTrigger && !$this->InFooter && $this->AcceptPageBreak())
2138 $x=$this->x;
2139 $ws=$this->ws;
2142 $this->ws=0;
2143 $this->_out('0 Tw');
2145 $this->AddPage($this->CurOrientation);
2146 $this->x=$x;
2149 $this->ws=$ws;
2150 $this->_out(sprintf('%.3f Tw',$ws*$k));
2154 $w=$this->w-$this->rMargin-$this->x;
2162 … $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
2166 $x=$this->x;
2167 $y=$this->y;
2169 … $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
2171 … $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
2173 …$s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))…
2175 …$s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))…
2180 $dx=$w-$this->cMargin-$this->GetStringWidth($txt);
2182 $dx=($w-$this->GetStringWidth($txt))/2;
2184 $dx=$this->cMargin;
2187 if ($this->ColorFlag) {
2188 $s.='q '.$this->TextColor.' ';
2192 …$s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->Fon…
2194 if ($this->underline) {
2195 $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
2198 if($this->ColorFlag)
2201 …$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->Font…
2204 $this->_out($s);
2205 $this->lasth=$h;
2209 $this->y+=$h;
2211 $this->x=$this->lMargin;
2214 $this->x+=$w;
2220 $cw=&$this->CurrentFont['cw'];
2222 $w=$this->w-$this->rMargin-$this->x;
2223 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
2260 if($this->ws>0)
2262 $this->ws=0;
2263 $this->_out('0 Tw');
2265 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
2290 if($this->ws>0)
2292 $this->ws=0;
2293 $this->_out('0 Tw');
2295 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
2301 $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
2302 $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));
2304 $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
2319 if($this->ws>0)
2321 $this->ws=0;
2322 $this->_out('0 Tw');
2326 $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
2327 $this->x=$this->lMargin;
2332 $cw=&$this->CurrentFont['cw'];
2333 $w=$this->w-$this->rMargin-$this->x;
2334 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
2347 $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
2353 $this->x=$this->lMargin;
2354 $w=$this->w-$this->rMargin-$this->x;
2355 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
2367 if($this->x>$this->lMargin) {
2369 $this->x=$this->lMargin;
2370 $this->y+=$h;
2371 $w=$this->w-$this->rMargin-$this->x;
2372 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
2380 $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
2382 $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
2389 $this->x=$this->lMargin;
2390 $w=$this->w-$this->rMargin-$this->x;
2391 $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
2400 $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
2406 if(!isset($this->images[$file]))
2413 $this->Error('Image file has no extension and no type was specified: '.$file);
2420 $info=$this->_parsejpg($file);
2422 $info=$this->_parsepng($file);
2427 if(!method_exists($this,$mtd))
2428 $this->Error('Unsupported image type: '.$type);
2429 $info=$this->$mtd($file);
2432 $info['i']=count($this->images)+1;
2433 $this->images[$file]=$info;
2436 $info=$this->images[$file];
2442 $w=$info['w']/$this->k;
2443 $h=$info['h']/$this->k;
2454 …$this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,(…
2456 $this->Link($x,$y,$w,$h,$link);
2463 $this->x=$this->lMargin;
2465 $this->y+=$this->lasth;
2467 $this->y+=$h;
2473 return $this->x;
2480 $this->x=$x;
2482 $this->x=$this->w+$x;
2488 return $this->y;
2494 $this->x=$this->lMargin;
2496 $this->y=$y;
2498 $this->y=$this->h+$y;
2504 $this->SetY($y);
2505 $this->SetX($x);
2512 if($this->state<3)
2513 $this->Close();
2533 $this->Error('Some data has already been output, can\'t send PDF file');
2539 $this->Error('Some data has already been output to browser, can\'t send PDF file');
2540 header('Content-Length: '.strlen($this->buffer));
2543 echo $this->buffer;
2548 $this->Error('Some data has already been output, can\'t send PDF file');
2554 $this->Error('Some data has already been output to browser, can\'t send PDF file');
2555 header('Content-Length: '.strlen($this->buffer));
2557 echo $this->buffer;
2563 $this->Error('Unable to create output file: '.$name);
2564 fwrite($f,$this->buffer,strlen($this->buffer));
2569 return $this->buffer;
2571 $this->Error('Incorrect output destination: '.$dest);
2585 $this->Error('Don\'t alter the locale before including class file');
2599 $nb=$this->page;
2600 if (!empty($this->AliasNbPages)) {
2603 $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
2607 if ($this->DefOrientation=='P') {
2608 $wPt=$this->fwPt;
2609 $hPt=$this->fhPt;
2611 $wPt=$this->fhPt;
2612 $hPt=$this->fwPt;
2615 $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
2617 $pages_start_obj_number = $this->n+1;
2623 $page = $this->_pages[$n-1];
2624 $this->offsets[$page->get_object_id()] = strlen($this->buffer);
2625 $this->_out(sprintf("%u %u obj",$page->object_id, $page->generation_id));
2627 $this->_out('<</Type /Page');
2628 $this->_out('/Parent 1 0 R');
2629 $this->_out("/Annots ".$this->_pages[$n-1]->_annotations($this));
2631 if (isset($this->OrientationChanges[$n])) {
2632 $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt));
2635 $this->_out('/Resources 2 0 R');
2637 $this->_out('/Contents '.($this->n+1).' 0 R>>');
2638 $this->_out('endobj');
2640 $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
2641 $this->_newobj();
2642 $this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
2643 $this->_putstream($p);
2644 $this->_out('endobj');
2647 $annotations = $this->_pages[$n-1]->annotations;
2651 $annotations[$j]->out($this);
2656 $this->offsets[1] = strlen($this->buffer);
2657 $this->_out('1 0 obj');
2658 $this->_out('<</Type /Pages');
2660 $this->_out('/Kids '.$this->_reference_array($this->_pages));
2662 $this->_out('/Count '.$nb);
2663 $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt));
2664 $this->_out('>>');
2665 $this->_out('endobj');
2671 $nf=$this->n;
2672 foreach($this->diffs as $diff) {
2674 $this->_newobj();
2675 $this->_out($this->_dictionary(array("Type" => "/Encoding",
2677 "Differences" => $this->_array($diff))));
2678 $this->_out('endobj');
2683 foreach ($this->FontFiles as $file=>$info) {
2685 $this->_newobj();
2686 $this->FontFiles[$file]['n'] = $this->n;
2688 $f=fopen($this->_getfontpath().$file,'rb',1);
2690 $this->Error('Font file not found');
2708 $this->_out('<</Length '.strlen($font));
2711 $this->_out('/Filter /FlateDecode');
2714 $this->_out('/Length1 '.$info['length1']);
2716 $this->_out('/Length2 '.$info['length2'].' /Length3 0');
2718 $this->_out('>>');
2719 $this->_putstream($font);
2720 $this->_out('endobj');
2724 foreach ($this->fonts as $k=>$font) {
2726 $this->fonts[$k]['n'] = $this->n+1;
2731 $this->_newobj();
2732 $this->_out('<</Type /Font');
2733 $this->_out('/BaseFont /'.$name);
2734 $this->_out('/Subtype /'.$type);
2735 $this->_out('/FirstChar 32 /LastChar 255');
2736 $this->_out('/Widths '.($this->n+1).' 0 R');
2737 $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
2740 $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
2742 $this->_out('/Encoding /WinAnsiEncoding');
2745 $this->_out('>>');
2746 $this->_out('endobj');
2749 $this->_newobj();
2755 $this->_out($s.']');
2756 $this->_out('endobj');
2758 $this->_newobj();
2765 $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
2767 $this->_out($s.'>>');
2768 $this->_out('endobj');
2772 if(!method_exists($this,$mtd))
2773 $this->Error('Unsupported font type: '.$type);
2774 $this->$mtd($font);
2780 $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
2781 reset($this->images);
2782 while (list($file,$info) = each($this->images)) {
2783 $this->_newobj();
2784 $this->images[$file]['n']=$this->n;
2785 $this->_out('<</Type /XObject');
2786 $this->_out('/Subtype /Image');
2787 $this->_out('/Width '.$info['w']);
2788 $this->_out('/Height '.$info['h']);
2790 …$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]…
2792 $this->_out('/ColorSpace /'.$info['cs']);
2794 $this->_out('/Decode [1 0 1 0 1 0 1 0]');
2797 $this->_out('/BitsPerComponent '.$info['bpc']);
2799 $this->_out('/Filter /'.$info['f']);
2803 $this->_out($info['parms']);
2811 $this->_out('/Mask ['.$trns.']');
2814 $this->_out('/Length '.strlen($info['data']).'>>');
2815 $this->_putstream($info['data']);
2816 unset($this->images[$file]['data']);
2817 $this->_out('endobj');
2821 $this->_newobj();
2822 $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
2823 $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
2824 $this->_putstream($pal);
2825 $this->_out('endobj');
2831 foreach($this->images as $image)
2832 $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
2837 $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
2838 $this->_out('/Font <<');
2839 foreach($this->fonts as $font)
2840 $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
2841 $this->_out('>>');
2842 $this->_out('/XObject <<');
2843 $this->_putxobjectdict();
2844 $this->_out('>>');
2849 $this->_putfonts();
2850 $this->_putimages();
2852 $this->offsets[2]=strlen($this->buffer);
2853 $this->_out('2 0 obj');
2854 $this->_out('<<');
2855 $this->_putresourcedict();
2856 $this->_out('>>');
2857 $this->_out('endobj');
2862 $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
2863 if(!empty($this->title))
2864 $this->_out('/Title '.$this->_textstring($this->title));
2865 if(!empty($this->subject))
2866 $this->_out('/Subject '.$this->_textstring($this->subject));
2867 if(!empty($this->author))
2868 $this->_out('/Author '.$this->_textstring($this->author));
2869 if(!empty($this->keywords))
2870 $this->_out('/Keywords '.$this->_textstring($this->keywords));
2871 if(!empty($this->creator))
2872 $this->_out('/Creator '.$this->_textstring($this->creator));
2873 $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis')));
2878 $this->_out('/Type /Catalog');
2880 $this->_out('/Pages 1 0 R');
2881 if ($this->ZoomMode=='fullpage') {
2882 $this->_out("/OpenAction [$pages_start_obj_number 0 R /Fit]");
2883 } elseif ($this->ZoomMode=='fullwidth') {
2884 $this->_out("/OpenAction [$pages_start_obj_number 0 R /FitH null]");
2885 } elseif ($this->ZoomMode=='real') {
2886 $this->_out("/OpenAction [$pages_start_obj_number 0 R /XYZ null null 1]");
2887 } elseif (!is_string($this->ZoomMode)) {
2888 … $this->_out("/OpenAction [$pages_start_obj_number 0 R /XYZ null null ".($this->ZoomMode/100).']');
2891 if ($this->LayoutMode=='single') {
2892 $this->_out('/PageLayout /SinglePage');
2893 } elseif ($this->LayoutMode=='continuous') {
2894 $this->_out('/PageLayout /OneColumn');
2895 } elseif ($this->LayoutMode=='two') {
2896 $this->_out('/PageLayout /TwoColumnLeft');
2899 if (count($this->_forms) > 0) {
2900 $this->_out('/AcroForm <<');
2901 $this->_out('/Fields '.$this->_reference_array($this->_forms));
2902 $this->_out('/DR 2 0 R');
2903 $this->_out('/NeedAppearances true');
2904 $this->_out('>>');
2909 $this->_out('%PDF-'.$this->PDFVersion);
2914 $this->_out('/Size '.($this->n+1));
2915 $this->_out('/Root '.$this->n.' 0 R');
2916 $this->_out('/Info '.($this->n-1).' 0 R');
2920 $this->_putheader();
2921 $pages_start_obj_number = $this->_putpages();
2923 $this->_putresources();
2925 $this->_newobj();
2926 $this->_out('<<');
2927 $this->_putinfo();
2928 $this->_out('>>');
2929 $this->_out('endobj');
2932 for ($i=0; $i<count($this->_forms); $i++) {
2933 $form =& $this->_forms[$i];
2935 $form->out($this);
2959 $this->_newobj();
2960 $this->_out('<<');
2961 $this->_putcatalog($pages_start_obj_number);
2962 $this->_out('>>');
2963 $this->_out('endobj');
2966 $o=strlen($this->buffer);
2967 $this->_out('xref');
2968 $this->_out('0 '.($this->n+1));
2969 $this->_out('0000000000 65535 f ');
2971 for ($i=1; $i<=$this->n; $i++) {
2972 $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
2976 $this->_out('trailer');
2977 $this->_out('<<');
2978 $this->_puttrailer();
2979 $this->_out('>>');
2980 $this->_out('startxref');
2981 $this->_out($o);
2982 $this->_out('%%EOF');
2983 $this->state=3;
2987 $this->page++;
2988 $this->pages[$this->page]='';
2989 $this->state=2;
2990 $this->x=$this->lMargin;
2991 $this->y=$this->tMargin;
2992 $this->FontFamily='';
2996 $orientation=$this->DefOrientation;
2999 if($orientation!=$this->DefOrientation) {
3000 $this->OrientationChanges[$this->page]=true;
3004 if($orientation!=$this->CurOrientation) {
3007 $this->wPt=$this->fwPt;
3008 $this->hPt=$this->fhPt;
3009 $this->w=$this->fw;
3010 $this->h=$this->fh;
3014 $this->wPt=$this->fhPt;
3015 $this->hPt=$this->fwPt;
3016 $this->w=$this->fh;
3017 $this->h=$this->fw;
3019 $this->PageBreakTrigger=$this->h-$this->bMargin;
3020 $this->CurOrientation=$orientation;
3026 $this->state=1;
3031 $num = $this->_generate_new_object_number();
3032 $this->offsets[$num]=strlen($this->buffer);
3033 $this->_out($num.' 0 obj');
3042 $this->Error('Missing or incorrect image file: '.$file);
3046 $this->Error('Not a JPEG file: '.$file);
3073 $this->Error('Can\'t open image file: '.$file);
3078 $this->Error('Not a PNG file: '.$file);
3084 $this->Error('Incorrect PNG file: '.$file);
3087 $w=$this->_freadint($f);
3088 $h=$this->_freadint($f);
3092 $this->Error('16-bit depth not supported: '.$file);
3103 $this->Error('Alpha channel not supported: '.$file);
3107 $this->Error('Unknown compression method: '.$file);
3111 $this->Error('Unknown filter method: '.$file);
3115 $this->Error('Interlacing not supported: '.$file);
3127 $n=$this->_freadint($f);
3164 $this->Error('Missing palette in '.$file);
3179 return '('.$this->_escape($s).')';
3188 $this->_out('stream');
3189 $this->_out($s);
3190 $this->_out('endstream');
3195 if($this->state==2)
3196 $this->pages[$this->page].=$s."\n";
3198 $this->buffer.=$s."\n";