<?php
-require_once ('FPDF.php');
+require_once 'Fpdf/tFPDF.php';
$GLOBALS['UTF8']=array(' '=>250,'!'=>300,'"'=>410,'#'=>668,'$'=>490,'%'=>875,'&'=>700,'\''=>250,
'('=>240,')'=>240,'*'=>417,'+'=>667,','=>250,'-'=>313,'.'=>250,'/'=>520,'0'=>550,'1'=>500,
'n'=>527,'o'=>524,'p'=>524,'q'=>504,'r'=>338,'s'=>336,'t'=>277,'u'=>517,'v'=>450,'w'=>652,
'x'=>466,'y'=>452,'z'=>407,'{'=>370,'|'=>258,'}'=>370,'~'=>605);
-class PDF_Chinese extends FPDF
+class FPDF_Chinese extends tFPDF
{
function AddCIDFont($family,$style,$name,$cw,$CMap,$registry)
{
$c=$s[$i];
if(ord($c)<128)
{
+ if (!isset($cw[$c])) {
+ $cw[$c] = 240;//print_R($cw);exit;
+ }
+
$l+=$cw[$c];
$i++;
}
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
$this->_out('endobj');
}
- $mqr=get_magic_quotes_runtime();
- //set_magic_quotes_runtime(0);
+
foreach($this->FontFiles as $file=>$info)
{
//Font file embedding
fclose($f);
$this->_out('endobj');
}
-// set_magic_quotes_runtime($mqr);
- foreach($this->fonts as $k=>$font)
+ foreach($this->fonts as $k=>$font)
{
//Font objects
$this->_newobj();
-<?
+<?php
require_once 'Chinese.php';
define ('FPDF_UNICODE_ENCODING', 'UCS-2BE');
-class PDF_Unicode extends PDF_Chinese
+class FPDF_Unicode extends FPDF_Chinese
{
var $charset; // input charset. User must add proper fonts by add font functions like AddUniCNShwFont
var $isUnicode; // whether charset belongs to Unicode
}
}
-?>
\ No newline at end of file
\r
}\r
\r
-\r
-?>
\ No newline at end of file
+
\ No newline at end of file
--- /dev/null
+<?php\r
+/****************************************************************************\r
+* Software: FPDF *\r
+* Version: 1.51 *\r
+* Date: 2002/08/03 *\r
+* Author: Olivier PLATHEY *\r
+* License: Freeware *\r
+* *\r
+* You may use and modify this software as you wish. *\r
+****************************************************************************/\r
+define('FPDF_VERSION','1.51');\r
+\r
+class FpdfAlt\r
+{\r
+//Private properties\r
+var $page; //current page number\r
+var $n; //current object number\r
+var $offsets; //array of object offsets\r
+var $buffer; //buffer holding in-memory PDF\r
+var $pages; //array containing pages\r
+var $state; //current document state\r
+var $compress; //compression flag\r
+var $DefOrientation; //default orientation\r
+var $CurOrientation; //current orientation\r
+var $OrientationChanges; //array indicating orientation changes\r
+var $fwPt,$fhPt; //dimensions of page format in points\r
+var $fw,$fh; //dimensions of page format in user unit\r
+var $wPt,$hPt; //current dimensions of page in points\r
+var $k; //scale factor (number of points in user unit)\r
+var $w,$h; //current dimensions of page in user unit\r
+var $lMargin; //left margin\r
+var $tMargin; //top margin\r
+var $rMargin; //right margin\r
+var $bMargin; //page break margin\r
+var $cMargin; //cell margin\r
+var $x,$y; //current position in user unit for cell positionning\r
+var $lasth; //height of last cell printed\r
+var $LineWidth; //line width in user unit\r
+var $CoreFonts; //array of standard font names\r
+var $fonts; //array of used fonts\r
+var $FontFiles; //array of font files\r
+var $diffs; //array of encoding differences\r
+var $images; //array of used images\r
+var $PageLinks; //array of links in pages\r
+var $links; //array of internal links\r
+var $FontFamily; //current font family\r
+var $FontStyle; //current font style\r
+var $underline; //underlining flag\r
+var $CurrentFont; //current font info\r
+var $FontSizePt; //current font size in points\r
+var $FontSize; //current font size in user unit\r
+var $DrawColor; //commands for drawing color\r
+var $FillColor; //commands for filling color\r
+var $TextColor; //commands for text color\r
+var $ColorFlag; //indicates whether fill and text colors are different\r
+var $ws; //word spacing\r
+var $AutoPageBreak; //automatic page breaking\r
+var $PageBreakTrigger; //threshold used to trigger page breaks\r
+var $InFooter; //flag set when processing footer\r
+var $ZoomMode; //zoom display mode\r
+var $LayoutMode; //layout display mode\r
+var $title; //title\r
+var $subject; //subject\r
+var $author; //author\r
+var $keywords; //keywords\r
+var $creator; //creator\r
+var $AliasNbPages; //alias for total number of pages\r
+\r
+var $CurPageFormat;\r
+var $PDFVersion;\r
+\r
+/****************************************************************************\r
+* *\r
+* Public methods *\r
+* *\r
+****************************************************************************/\r
+function __construct($orientation='P',$unit='mm',$format='A4')\r
+{\r
+ //Check for PHP locale-related bug\r
+ if(1.1==1)\r
+ $this->Error('Don\'t alter the locale before including class file');\r
+ //Initialization of properties\r
+ $this->page=0;\r
+ $this->n=2;\r
+ $this->buffer='';\r
+ $this->pages=array();\r
+ $this->OrientationChanges=array();\r
+ $this->state=0;\r
+ $this->fonts=array();\r
+ $this->FontFiles=array();\r
+ $this->diffs=array();\r
+ $this->images=array();\r
+ $this->links=array();\r
+ $this->InFooter=false;\r
+ $this->FontFamily='';\r
+ $this->FontStyle='';\r
+ $this->FontSizePt=12;\r
+ $this->underline=false;\r
+ $this->DrawColor='0 G';\r
+ $this->FillColor='0 g';\r
+ $this->TextColor='0 g';\r
+ $this->ColorFlag=false;\r
+ $this->ws=0;\r
+ //Standard fonts\r
+ $this->CoreFonts['courier']='Courier';\r
+ $this->CoreFonts['courierB']='Courier-Bold';\r
+ $this->CoreFonts['courierI']='Courier-Oblique';\r
+ $this->CoreFonts['courierBI']='Courier-BoldOblique';\r
+ $this->CoreFonts['helvetica']='Helvetica';\r
+ $this->CoreFonts['helveticaB']='Helvetica-Bold';\r
+ $this->CoreFonts['helveticaI']='Helvetica-Oblique';\r
+ $this->CoreFonts['helveticaBI']='Helvetica-BoldOblique';\r
+ $this->CoreFonts['times']='Times-Roman';\r
+ $this->CoreFonts['timesB']='Times-Bold';\r
+ $this->CoreFonts['timesI']='Times-Italic';\r
+ $this->CoreFonts['timesBI']='Times-BoldItalic';\r
+ $this->CoreFonts['symbol']='Symbol';\r
+ $this->CoreFonts['zapfdingbats']='ZapfDingbats';\r
+ //Scale factor\r
+ if($unit=='pt')\r
+ $this->k=1;\r
+ elseif($unit=='mm')\r
+ $this->k=72/25.4;\r
+ elseif($unit=='cm')\r
+ $this->k=72/2.54;\r
+ elseif($unit=='in')\r
+ $this->k=72;\r
+ else\r
+ $this->Error('Incorrect unit: '.$unit);\r
+ //Page format\r
+ if(is_string($format))\r
+ {\r
+ $format=strtolower($format);\r
+ if($format=='a3')\r
+ $format=array(841.89,1190.55);\r
+ elseif($format=='a4')\r
+ $format=array(595.28,841.89);\r
+ elseif($format=='a5')\r
+ $format=array(420.94,595.28);\r
+ elseif($format=='letter')\r
+ $format=array(612,792);\r
+ elseif($format=='legal')\r
+ $format=array(612,1008);\r
+ else\r
+ $this->Error('Unknown page format: '.$format);\r
+ $this->fwPt=$format[0];\r
+ $this->fhPt=$format[1];\r
+ }\r
+ else\r
+ {\r
+ $this->fwPt=$format[0]*$this->k;\r
+ $this->fhPt=$format[1]*$this->k;\r
+ }\r
+ $this->CurPageFormat = $format; //FC with 1.6...\r
+ \r
+ \r
+ \r
+ $this->fw=$this->fwPt/$this->k;\r
+ $this->fh=$this->fhPt/$this->k;\r
+ //Page orientation\r
+ $orientation=strtolower($orientation);\r
+ if($orientation=='p' or $orientation=='portrait')\r
+ {\r
+ $this->DefOrientation='P';\r
+ $this->wPt=$this->fwPt;\r
+ $this->hPt=$this->fhPt;\r
+ }\r
+ elseif($orientation=='l' or $orientation=='landscape')\r
+ {\r
+ $this->DefOrientation='L';\r
+ $this->wPt=$this->fhPt;\r
+ $this->hPt=$this->fwPt;\r
+ }\r
+ else\r
+ $this->Error('Incorrect orientation: '.$orientation);\r
+ $this->CurOrientation=$this->DefOrientation;\r
+ $this->w=$this->wPt/$this->k;\r
+ $this->h=$this->hPt/$this->k;\r
+ //Page margins (1 cm)\r
+ $margin=28.35/$this->k;\r
+ $this->SetMargins($margin,$margin);\r
+ //Interior cell margin (1 mm)\r
+ $this->cMargin=$margin/10;\r
+ //Line width (0.2 mm)\r
+ $this->LineWidth=.567/$this->k;\r
+ //Automatic page break\r
+ $this->SetAutoPageBreak(true,2*$margin);\r
+ //Full width display mode\r
+ $this->SetDisplayMode('fullwidth');\r
+ //Compression\r
+ $this->SetCompression(true);\r
+ \r
+ $this->PDFVersion = '1.4';\r
+}\r
+\r
+function SetMargins($left,$top,$right=-1)\r
+{\r
+ //Set left, top and right margins\r
+ $this->lMargin=$left;\r
+ $this->tMargin=$top;\r
+ if($right==-1)\r
+ $right=$left;\r
+ $this->rMargin=$right;\r
+}\r
+\r
+function SetLeftMargin($margin)\r
+{\r
+ //Set left margin\r
+ $this->lMargin=$margin;\r
+ if($this->page>0 and $this->x<$margin)\r
+ $this->x=$margin;\r
+}\r
+\r
+function SetTopMargin($margin)\r
+{\r
+ //Set top margin\r
+ $this->tMargin=$margin;\r
+}\r
+\r
+function SetRightMargin($margin)\r
+{\r
+ //Set right margin\r
+ $this->rMargin=$margin;\r
+}\r
+\r
+function SetAutoPageBreak($auto,$margin=0)\r
+{\r
+ //Set auto page break mode and triggering margin\r
+ $this->AutoPageBreak=$auto;\r
+ $this->bMargin=$margin;\r
+ $this->PageBreakTrigger=$this->h-$margin;\r
+}\r
+\r
+function SetDisplayMode($zoom,$layout='continuous')\r
+{\r
+ //Set display mode in viewer\r
+ if($zoom=='fullpage' or $zoom=='fullwidth' or $zoom=='real' or $zoom=='default' or !is_string($zoom))\r
+ $this->ZoomMode=$zoom;\r
+ elseif($zoom=='zoom')\r
+ $this->ZoomMode=$layout;\r
+ else\r
+ $this->Error('Incorrect zoom display mode: '.$zoom);\r
+ if($layout=='single' or $layout=='continuous' or $layout=='two' or $layout=='default')\r
+ $this->LayoutMode=$layout;\r
+ elseif($zoom!='zoom')\r
+ $this->Error('Incorrect layout display mode: '.$layout);\r
+}\r
+\r
+function SetCompression($compress)\r
+{\r
+ //Set page compression\r
+ if(function_exists('gzcompress'))\r
+ $this->compress=$compress;\r
+ else\r
+ $this->compress=false;\r
+}\r
+\r
+function SetTitle($title)\r
+{\r
+ //Title of document\r
+ $this->title=$title;\r
+}\r
+\r
+function SetSubject($subject)\r
+{\r
+ //Subject of document\r
+ $this->subject=$subject;\r
+}\r
+\r
+function SetAuthor($author)\r
+{\r
+ //Author of document\r
+ $this->author=$author;\r
+}\r
+\r
+function SetKeywords($keywords)\r
+{\r
+ //Keywords of document\r
+ $this->keywords=$keywords;\r
+}\r
+\r
+function SetCreator($creator)\r
+{\r
+ //Creator of document\r
+ $this->creator=$creator;\r
+}\r
+\r
+function AliasNbPages($alias='{nb}')\r
+{\r
+ //Define an alias for total number of pages\r
+ $this->AliasNbPages=$alias;\r
+}\r
+\r
+function Error($msg)\r
+{\r
+ //Fatal error\r
+ die('<B>FPDF error: </B>'.$msg);\r
+}\r
+\r
+function Open()\r
+{\r
+ //Begin document\r
+ $this->_begindoc();\r
+}\r
+\r
+function Close()\r
+{\r
+ //Terminate document\r
+ if($this->page==0)\r
+ $this->AddPage();\r
+ //Page footer\r
+ $this->InFooter=true;\r
+ $this->Footer();\r
+ $this->InFooter=false;\r
+ //Close page\r
+ $this->_endpage();\r
+ //Close document\r
+ $this->_enddoc();\r
+}\r
+\r
+function AddPage($orientation='')\r
+{\r
+ //Start a new page\r
+ $family=$this->FontFamily;\r
+ $style=$this->FontStyle.($this->underline ? 'U' : '');\r
+ $size=$this->FontSizePt;\r
+ $lw=$this->LineWidth;\r
+ $dc=$this->DrawColor;\r
+ $fc=$this->FillColor;\r
+ $tc=$this->TextColor;\r
+ $cf=$this->ColorFlag;\r
+ if($this->page>0)\r
+ {\r
+ //Page footer\r
+ $this->InFooter=true;\r
+ $this->Footer();\r
+ $this->InFooter=false;\r
+ //Close page\r
+ $this->_endpage();\r
+ }\r
+ //Start new page\r
+ $this->_beginpage($orientation);\r
+ //Set line cap style to square\r
+ $this->_out('2 J');\r
+ //Set line width\r
+ $this->LineWidth=$lw;\r
+ $this->_out(sprintf('%.2f w',$lw*$this->k));\r
+ //Set font\r
+ if($family)\r
+ $this->SetFont($family,$style,$size);\r
+ //Set colors\r
+ $this->DrawColor=$dc;\r
+ if($dc!='0 G')\r
+ $this->_out($dc);\r
+ $this->FillColor=$fc;\r
+ if($fc!='0 g')\r
+ $this->_out($fc);\r
+ $this->TextColor=$tc;\r
+ $this->ColorFlag=$cf;\r
+ //Page header\r
+ $this->Header();\r
+ //Restore line width\r
+ if($this->LineWidth!=$lw)\r
+ {\r
+ $this->LineWidth=$lw;\r
+ $this->_out(sprintf('%.2f w',$lw*$this->k));\r
+ }\r
+ //Restore font\r
+ if($family)\r
+ $this->SetFont($family,$style,$size);\r
+ //Restore colors\r
+ if($this->DrawColor!=$dc)\r
+ {\r
+ $this->DrawColor=$dc;\r
+ $this->_out($dc);\r
+ }\r
+ if($this->FillColor!=$fc)\r
+ {\r
+ $this->FillColor=$fc;\r
+ $this->_out($fc);\r
+ }\r
+ $this->TextColor=$tc;\r
+ $this->ColorFlag=$cf;\r
+}\r
+\r
+function Header()\r
+{\r
+ //To be implemented in your own inherited class\r
+}\r
+\r
+function Footer()\r
+{\r
+ //To be implemented in your own inherited class\r
+}\r
+\r
+function PageNo()\r
+{\r
+ //Get current page number\r
+ return $this->page;\r
+}\r
+\r
+function SetDrawColor($r,$g=-1,$b=-1)\r
+{\r
+ //Set color for all stroking operations\r
+ if(($r==0 and $g==0 and $b==0) or $g==-1)\r
+ $this->DrawColor=sprintf('%.3f G',$r/255);\r
+ else\r
+ $this->DrawColor=sprintf('%.3f %.3f %.3f RG',$r/255,$g/255,$b/255);\r
+ if($this->page>0)\r
+ $this->_out($this->DrawColor);\r
+}\r
+\r
+function SetFillColor($r,$g=-1,$b=-1)\r
+{\r
+ //Set color for all filling operations\r
+ if(($r==0 and $g==0 and $b==0) or $g==-1)\r
+ $this->FillColor=sprintf('%.3f g',$r/255);\r
+ else\r
+ $this->FillColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);\r
+ $this->ColorFlag=($this->FillColor!=$this->TextColor);\r
+ if($this->page>0)\r
+ $this->_out($this->FillColor);\r
+}\r
+\r
+function SetTextColor($r,$g=-1,$b=-1)\r
+{\r
+ //Set color for text\r
+ if(($r==0 and $g==0 and $b==0) or $g==-1)\r
+ $this->TextColor=sprintf('%.3f g',$r/255);\r
+ else\r
+ $this->TextColor=sprintf('%.3f %.3f %.3f rg',$r/255,$g/255,$b/255);\r
+ $this->ColorFlag=($this->FillColor!=$this->TextColor);\r
+}\r
+\r
+function GetStringWidth($s)\r
+{\r
+ //Get width of a string in the current font\r
+ $s=(string)$s;\r
+ $cw=&$this->CurrentFont['cw'];\r
+ $w=0;\r
+ $l=strlen($s);\r
+ for($i=0;$i<$l;$i++)\r
+ $w+=$cw[$s[$i]];\r
+ return $w*$this->FontSize/1000;\r
+}\r
+\r
+function SetLineWidth($width)\r
+{\r
+ //Set line width\r
+ $this->LineWidth=$width;\r
+ if($this->page>0)\r
+ $this->_out(sprintf('%.2f w',$width*$this->k));\r
+}\r
+\r
+function Line($x1,$y1,$x2,$y2)\r
+{\r
+ //Draw a line\r
+ if (!is_array($x1)) {\r
+ $this->_out(\r
+ sprintf('%.2f %.2f m %.2f %.2f l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));\r
+ return;\r
+ }\r
+ $type= 'm';$out='';\r
+ for ($i=0;$i<count($x1);$i+=2) {\r
+ $out .= sprintf(' %.2f %.2f %s',$x1[$i]*$this->k,($this->h-$x1[$i+1])*$this->k,$type);\r
+ $type = 'l';\r
+ } \r
+ $this->_out(ltrim($out) . ' f');\r
+\r
+\r
+}\r
+\r
+function Rect($x,$y,$w,$h,$style='')\r
+{\r
+ //Draw a rectangle\r
+ if($style=='F')\r
+ $op='f';\r
+ elseif($style=='FD' or $style=='DF')\r
+ $op='B';\r
+ else\r
+ $op='S';\r
+ $this->_out(sprintf('%.2f %.2f %.2f %.2f re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));\r
+}\r
+\r
+function AddFont($family,$style='',$file='')\r
+{\r
+ //Add a TrueType or Type1 font\r
+ $family=strtolower($family);\r
+ if($family=='arial')\r
+ $family='helvetica';\r
+ $style=strtoupper($style);\r
+ if($style=='IB')\r
+ $style='BI';\r
+ if(isset($this->fonts[$family.$style]))\r
+ $this->Error('Font already added: '.$family.' '.$style);\r
+ if($file=='')\r
+ $file=str_replace(' ','',$family).strtolower($style).'.php';\r
+ \r
+ if (file_exists(dirname(__FILE__) .'/FpdfAlt/'.$file)) {\r
+ include 'FpdfAlt/'.$file;\r
+ }\r
+ if(!isset($name)) {\r
+ $this->Error('Could not include font definition file');\r
+ }\r
+ $i=count($this->fonts)+1;\r
+ $this->fonts[$family.$style]=array('i'=>$i,'type'=>$type,'name'=>$name,'desc'=>$desc,'up'=>$up,'ut'=>$ut,'cw'=>$cw,'enc'=>$enc,'file'=>$file);\r
+ if($diff)\r
+ {\r
+ //Search existing encodings\r
+ $d=0;\r
+ $nb=count($this->diffs);\r
+ for($i=1;$i<=$nb;$i++)\r
+ if($this->diffs[$i]==$diff)\r
+ {\r
+ $d=$i;\r
+ break;\r
+ }\r
+ if($d==0)\r
+ {\r
+ $d=$nb+1;\r
+ $this->diffs[$d]=$diff;\r
+ }\r
+ $this->fonts[$family.$style]['diff']=$d;\r
+ }\r
+ if($file)\r
+ {\r
+ if($type=='TrueType')\r
+ $this->FontFiles[$file]=array('length1'=>$originalsize);\r
+ else\r
+ $this->FontFiles[$file]=array('length1'=>$size1,'length2'=>$size2);\r
+ }\r
+}\r
+\r
+function SetFont($family,$style='',$size=0)\r
+{\r
+ //Select a font; size given in points\r
+ global $fpdf_charwidths;\r
+\r
+ $family=strtolower($family);\r
+ if($family=='')\r
+ $family=$this->FontFamily;\r
+ if($family=='arial')\r
+ $family='helvetica';\r
+ elseif($family=='symbol' or $family=='zapfdingbats')\r
+ $style='';\r
+ $style=strtoupper($style);\r
+ if(is_int(strpos($style,'U')))\r
+ {\r
+ $this->underline=true;\r
+ $style=str_replace('U','',$style);\r
+ }\r
+ else\r
+ $this->underline=false;\r
+ if($style=='IB')\r
+ $style='BI';\r
+ if($size==0)\r
+ $size=$this->FontSizePt;\r
+ //Test if font is already selected\r
+ if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size)\r
+ return;\r
+ //Test if used for the first time\r
+ $fontkey=$family.$style;\r
+ if(!isset($this->fonts[$fontkey]))\r
+ {\r
+ //Check if one of the standard fonts\r
+ if(isset($this->CoreFonts[$fontkey]))\r
+ {\r
+ if(!isset($fpdf_charwidths[$fontkey]))\r
+ {\r
+ //Load metric file\r
+ $file=$family;\r
+ if($family=='times' or $family=='helvetica')\r
+ $file.=strtolower($style);\r
+ $file.='.php';\r
+ if (file_exists(dirname(__FILE__) .'/FpdfAlt/'.$file)) {\r
+ include 'FpdfAlt/'.$file;\r
+ }\r
+ if(!isset($fpdf_charwidths[$fontkey]))\r
+ $this->Error('Could not include font metric file');\r
+ }\r
+ $i=count($this->fonts)+1;\r
+ $this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]);\r
+ }\r
+ else\r
+ $this->Error('Undefined font: '.$family.' '.$style);\r
+ }\r
+ //Select it\r
+ $this->FontFamily=$family;\r
+ $this->FontStyle=$style;\r
+ $this->FontSizePt=$size;\r
+ $this->FontSize=$size/$this->k;\r
+ $this->CurrentFont=&$this->fonts[$fontkey];\r
+ if($this->page>0)\r
+ $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));\r
+}\r
+\r
+function SetFontSize($size)\r
+{\r
+ //Set font size in points\r
+ if($this->FontSizePt==$size)\r
+ return;\r
+ $this->FontSizePt=$size;\r
+ $this->FontSize=$size/$this->k;\r
+ if($this->page>0)\r
+ $this->_out(sprintf('BT /F%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));\r
+}\r
+\r
+function AddLink()\r
+{\r
+ //Create a new internal link\r
+ $n=count($this->links)+1;\r
+ $this->links[$n]=array(0,0);\r
+ return $n;\r
+}\r
+\r
+function SetLink($link,$y=0,$page=-1)\r
+{\r
+ //Set destination of internal link\r
+ if($y==-1)\r
+ $y=$this->y;\r
+ if($page==-1)\r
+ $page=$this->page;\r
+ $this->links[$link]=array($page,$y);\r
+}\r
+\r
+function Link($x,$y,$w,$h,$link)\r
+{\r
+ //Put a link on the page\r
+ $this->PageLinks[$this->page][]=array($x*$this->k,$this->hPt-$y*$this->k,$w*$this->k,$h*$this->k,$link);\r
+}\r
+\r
+function Text($x,$y,$txt)\r
+{\r
+ //Output a string\r
+ $txt=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));\r
+ $s=sprintf('BT %.2f %.2f Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$txt);\r
+ if($this->underline and $txt!='')\r
+ $s.=' '.$this->_dounderline($x,$y,$txt);\r
+ if($this->ColorFlag)\r
+ $s='q '.$this->TextColor.' '.$s.' Q';\r
+ $this->_out($s);\r
+}\r
+\r
+function AcceptPageBreak()\r
+{\r
+ //Accept automatic page break or not\r
+ return $this->AutoPageBreak;\r
+}\r
+\r
+function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='')\r
+{\r
+ //Output a cell\r
+ $k=$this->k;\r
+ if($this->y+$h>$this->PageBreakTrigger and !$this->InFooter and $this->AcceptPageBreak())\r
+ {\r
+ $x=$this->x;\r
+ $ws=$this->ws;\r
+ if($ws>0)\r
+ {\r
+ $this->ws=0;\r
+ $this->_out('0 Tw');\r
+ }\r
+ $this->AddPage($this->CurOrientation);\r
+ $this->x=$x;\r
+ if($ws>0)\r
+ {\r
+ $this->ws=$ws;\r
+ $this->_out(sprintf('%.3f Tw',$ws*$k));\r
+ }\r
+ }\r
+ if($w==0)\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $s='';\r
+ if($fill==1 or $border==1)\r
+ {\r
+ if($fill==1)\r
+ $op=($border==1) ? 'B' : 'f';\r
+ else\r
+ $op='S';\r
+ $s=sprintf('%.2f %.2f %.2f %.2f re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);\r
+ }\r
+ if(is_string($border))\r
+ {\r
+ $x=$this->x;\r
+ $y=$this->y;\r
+ if(is_int(strpos($border,'L')))\r
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);\r
+ if(is_int(strpos($border,'T')))\r
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);\r
+ if(is_int(strpos($border,'R')))\r
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);\r
+ if(is_int(strpos($border,'B')))\r
+ $s.=sprintf('%.2f %.2f m %.2f %.2f l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);\r
+ }\r
+ if($txt!='')\r
+ {\r
+ if($align=='R')\r
+ $dx=$w-$this->cMargin-$this->GetStringWidth($txt);\r
+ elseif($align=='C')\r
+ $dx=($w-$this->GetStringWidth($txt))/2;\r
+ else\r
+ $dx=$this->cMargin;\r
+ $txt=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));\r
+ if($this->ColorFlag)\r
+ $s.='q '.$this->TextColor.' ';\r
+ $s.=sprintf('BT %.2f %.2f Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt);\r
+ if($this->underline)\r
+ $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);\r
+ if($this->ColorFlag)\r
+ $s.=' Q';\r
+ if($link)\r
+ $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);\r
+ }\r
+ if($s)\r
+ $this->_out($s);\r
+ $this->lasth=$h;\r
+ if($ln>0)\r
+ {\r
+ //Go to next line\r
+ $this->y+=$h;\r
+ if($ln==1)\r
+ $this->x=$this->lMargin;\r
+ }\r
+ else\r
+ $this->x+=$w;\r
+}\r
+\r
+function MultiCell($w,$h,$txt,$border=0,$align='J',$fill=0)\r
+{\r
+ //Output text with automatic or explicit line breaks\r
+ $cw=&$this->CurrentFont['cw'];\r
+ if($w==0)\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r
+ $s=str_replace("\r",'',$txt);\r
+ $nb=strlen($s);\r
+ if($nb>0 and $s[$nb-1]=="\n")\r
+ $nb--;\r
+ $b=0;\r
+ if($border)\r
+ {\r
+ if($border==1)\r
+ {\r
+ $border='LTRB';\r
+ $b='LRT';\r
+ $b2='LR';\r
+ }\r
+ else\r
+ {\r
+ $b2='';\r
+ if(is_int(strpos($border,'L')))\r
+ $b2.='L';\r
+ if(is_int(strpos($border,'R')))\r
+ $b2.='R';\r
+ $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;\r
+ }\r
+ }\r
+ $sep=-1;\r
+ $i=0;\r
+ $j=0;\r
+ $l=0;\r
+ $ns=0;\r
+ $nl=1;\r
+ while($i<$nb)\r
+ {\r
+ //Get next character\r
+ $c=$s[$i];\r
+ if($c=="\n")\r
+ {\r
+ //Explicit line break\r
+ if($this->ws>0)\r
+ {\r
+ $this->ws=0;\r
+ $this->_out('0 Tw');\r
+ }\r
+ $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);\r
+ $i++;\r
+ $sep=-1;\r
+ $j=$i;\r
+ $l=0;\r
+ $ns=0;\r
+ $nl++;\r
+ if($border and $nl==2)\r
+ $b=$b2;\r
+ continue;\r
+ }\r
+ if($c==' ')\r
+ {\r
+ $sep=$i;\r
+ $ls=$l;\r
+ $ns++;\r
+ }\r
+ $l+=$cw[$c];\r
+ if($l>$wmax)\r
+ {\r
+ //Automatic line break\r
+ if($sep==-1)\r
+ {\r
+ if($i==$j)\r
+ $i++;\r
+ if($this->ws>0)\r
+ {\r
+ $this->ws=0;\r
+ $this->_out('0 Tw');\r
+ }\r
+ $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);\r
+ }\r
+ else\r
+ {\r
+ if($align=='J')\r
+ {\r
+ $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;\r
+ $this->_out(sprintf('%.3f Tw',$this->ws*$this->k));\r
+ }\r
+ $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);\r
+ $i=$sep+1;\r
+ }\r
+ $sep=-1;\r
+ $j=$i;\r
+ $l=0;\r
+ $ns=0;\r
+ $nl++;\r
+ if($border and $nl==2)\r
+ $b=$b2;\r
+ }\r
+ else\r
+ $i++;\r
+ }\r
+ //Last chunk\r
+ if($this->ws>0)\r
+ {\r
+ $this->ws=0;\r
+ $this->_out('0 Tw');\r
+ }\r
+ if($border and is_int(strpos($border,'B')))\r
+ $b.='B';\r
+ $this->Cell($w,$h,substr($s,$j,$i),$b,2,$align,$fill);\r
+ $this->x=$this->lMargin;\r
+}\r
+\r
+function Write($h,$txt,$link='')\r
+{\r
+ //Output text in flowing mode\r
+ $cw=&$this->CurrentFont['cw'];\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r
+ $s=str_replace("\r",'',$txt);\r
+ $nb=strlen($s);\r
+ $sep=-1;\r
+ $i=0;\r
+ $j=0;\r
+ $l=0;\r
+ $nl=1;\r
+ while($i<$nb)\r
+ {\r
+ //Get next character\r
+ $c=$s[$i];\r
+ if($c=="\n")\r
+ {\r
+ //Explicit line break\r
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);\r
+ $i++;\r
+ $sep=-1;\r
+ $j=$i;\r
+ $l=0;\r
+ if($nl==1)\r
+ {\r
+ $this->x=$this->lMargin;\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r
+ }\r
+ $nl++;\r
+ continue;\r
+ }\r
+ if($c==' ')\r
+ {\r
+ $sep=$i;\r
+ $ls=$l;\r
+ }\r
+ $l+=$cw[$c];\r
+ if($l>$wmax)\r
+ {\r
+ //Automatic line break\r
+ if($sep==-1)\r
+ {\r
+ if($this->x>$this->lMargin)\r
+ {\r
+ //Move to next line\r
+ $this->x=$this->lMargin;\r
+ $this->y+=$h;\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r
+ $i++;\r
+ $nl++;\r
+ continue;\r
+ }\r
+ if($i==$j)\r
+ $i++;\r
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);\r
+ }\r
+ else\r
+ {\r
+ $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);\r
+ $i=$sep+1;\r
+ }\r
+ $sep=-1;\r
+ $j=$i;\r
+ $l=0;\r
+ if($nl==1)\r
+ {\r
+ $this->x=$this->lMargin;\r
+ $w=$this->w-$this->rMargin-$this->x;\r
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;\r
+ }\r
+ $nl++;\r
+ }\r
+ else\r
+ $i++;\r
+ }\r
+ //Last chunk\r
+ if($i!=$j)\r
+ $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i),0,0,'',0,$link);\r
+}\r
+\r
+function Image($file,$x,$y,$w,$h=0,$type='',$link='')\r
+{\r
+ //Put an image on the page\r
+ if(!isset($this->images[$file]))\r
+ {\r
+ //First use of image, get info\r
+ if($type=='')\r
+ {\r
+ $pos=strrpos($file,'.');\r
+ if(!$pos)\r
+ $this->Error('Image file has no extension and no type was specified: '.$file);\r
+ $type=substr($file,$pos+1);\r
+ }\r
+ $type=strtolower($type);\r
+ //$mqr=get_magic_quotes_runtime();\r
+// set_magic_quotes_runtime(0);\r
+ if($type=='jpg' or $type=='jpeg')\r
+ $info=$this->_parsejpg($file);\r
+ elseif($type=='png')\r
+ $info=$this->_parsepng($file);\r
+ else\r
+ $this->Error('Unsupported image file type: '.$type);\r
+ //set_magic_quotes_runtime($mqr);\r
+ $info['i']=count($this->images)+1;\r
+ $this->images[$file]=$info;\r
+ }\r
+ else\r
+ $info=$this->images[$file];\r
+ //Automatic width or height calculation\r
+ if($w==0)\r
+ $w=$h*$info['w']/$info['h'];\r
+ if($h==0)\r
+ $h=$w*$info['h']/$info['w'];\r
+ $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));\r
+ if($link)\r
+ $this->Link($x,$y,$w,$h,$link);\r
+}\r
+\r
+function Ln($h='')\r
+{\r
+ //Line feed; default value is last cell height\r
+ $this->x=$this->lMargin;\r
+ if(is_string($h))\r
+ $this->y+=$this->lasth;\r
+ else\r
+ $this->y+=$h;\r
+}\r
+\r
+function GetX()\r
+{\r
+ //Get x position\r
+ return $this->x;\r
+}\r
+\r
+function SetX($x)\r
+{\r
+ //Set x position\r
+ if($x>=0)\r
+ $this->x=$x;\r
+ else\r
+ $this->x=$this->w+$x;\r
+}\r
+\r
+function GetY()\r
+{\r
+ //Get y position\r
+ return $this->y;\r
+}\r
+\r
+function SetY($y)\r
+{\r
+ //Set y position and reset x\r
+ $this->x=$this->lMargin;\r
+ if($y>=0)\r
+ $this->y=$y;\r
+ else\r
+ $this->y=$this->h+$y;\r
+}\r
+\r
+function SetXY($x,$y)\r
+{\r
+ //Set x and y positions\r
+ $this->SetY($y);\r
+ $this->SetX($x);\r
+}\r
+\r
+function Output($file='',$download=false)\r
+{\r
+ //Output PDF to file or browser\r
+ global $HTTP_ENV_VARS;\r
+\r
+ if($this->state<3)\r
+ $this->Close();\r
+ if($file=='')\r
+ {\r
+ //Send to browser\r
+ Header('Content-Type: application/pdf');\r
+ if(headers_sent())\r
+ $this->Error('Some data has already been output to browser, can\'t send PDF file');\r
+ Header('Content-Length: '.strlen($this->buffer));\r
+ Header('Content-disposition: inline; filename=doc.pdf');\r
+ echo $this->buffer;\r
+ }\r
+ else\r
+ {\r
+ if($download)\r
+ {\r
+ //Download file\r
+ if(isset($HTTP_ENV_VARS['HTTP_USER_AGENT']) and strpos($HTTP_ENV_VARS['HTTP_USER_AGENT'],'MSIE 5.5'))\r
+ Header('Content-Type: application/dummy');\r
+ else\r
+ Header('Content-Type: application/octet-stream');\r
+ if(headers_sent())\r
+ $this->Error('Some data has already been output to browser, can\'t send PDF file');\r
+ Header('Content-Length: '.strlen($this->buffer));\r
+ Header('Content-disposition: attachment; filename='.$file);\r
+ echo $this->buffer;\r
+ }\r
+ else\r
+ {\r
+ //Save file locally\r
+ $f=fopen($file,'wb');\r
+ if(!$f)\r
+ $this->Error('Unable to create output file: '.$file);\r
+ fwrite($f,$this->buffer,strlen($this->buffer));\r
+ fclose($f);\r
+ }\r
+ }\r
+}\r
+\r
+/****************************************************************************\r
+* *\r
+* Private methods *\r
+* *\r
+****************************************************************************/\r
+function _begindoc()\r
+{\r
+ //Start document\r
+ $this->state=1;\r
+ $this->_out('%PDF-1.3');\r
+}\r
+\r
+function _putpages()\r
+{\r
+ $nb=$this->page;\r
+ if(!empty($this->AliasNbPages))\r
+ {\r
+ //Replace number of pages\r
+ for($n=1;$n<=$nb;$n++)\r
+ $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]);\r
+ }\r
+ if($this->DefOrientation=='P')\r
+ {\r
+ $wPt=$this->fwPt;\r
+ $hPt=$this->fhPt;\r
+ }\r
+ else\r
+ {\r
+ $wPt=$this->fhPt;\r
+ $hPt=$this->fwPt;\r
+ }\r
+ $filter=($this->compress) ? '/Filter /FlateDecode ' : '';\r
+ for($n=1;$n<=$nb;$n++)\r
+ {\r
+ //Page\r
+ $this->_newobj();\r
+ $this->_out('<</Type /Page');\r
+ $this->_out('/Parent 1 0 R');\r
+ if(isset($this->OrientationChanges[$n]))\r
+ $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$hPt,$wPt));\r
+ $this->_out('/Resources 2 0 R');\r
+ if(isset($this->PageLinks[$n]))\r
+ {\r
+ //Links\r
+ $annots='/Annots [';\r
+ foreach($this->PageLinks[$n] as $pl)\r
+ {\r
+ $rect=sprintf('%.2f %.2f %.2f %.2f',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);\r
+ $annots.='<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';\r
+ if(is_string($pl[4]))\r
+ $annots.='/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';\r
+ else\r
+ {\r
+ $l=$this->links[$pl[4]];\r
+ $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt;\r
+ $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2f null]>>',1+2*$l[0],$h-$l[1]*$this->k);\r
+ }\r
+ }\r
+ $this->_out($annots.']');\r
+ }\r
+ $this->_out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');\r
+ $this->_out('/Contents '.($this->n+1).' 0 R>>');\r
+ $this->_out('endobj');\r
+ //Page content\r
+ $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];\r
+ $this->_newobj();\r
+ $this->_out('<<'.$filter.'/Length '.strlen($p).'>>');\r
+ $this->_putstream($p);\r
+ $this->_out('endobj');\r
+ }\r
+ //Pages root\r
+ $this->offsets[1]=strlen($this->buffer);\r
+ $this->_out('1 0 obj');\r
+ $this->_out('<</Type /Pages');\r
+ $kids='/Kids [';\r
+ for($i=0;$i<$nb;$i++)\r
+ $kids.=(3+2*$i).' 0 R ';\r
+ $this->_out($kids.']');\r
+ $this->_out('/Count '.$nb);\r
+ $this->_out(sprintf('/MediaBox [0 0 %.2f %.2f]',$wPt,$hPt));\r
+ $this->_out('>>');\r
+ $this->_out('endobj');\r
+}\r
+\r
+function _putfonts()\r
+{\r
+ $nf=$this->n;\r
+ foreach($this->diffs as $diff)\r
+ {\r
+ //Encodings\r
+ $this->_newobj();\r
+ $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');\r
+ $this->_out('endobj');\r
+ }\r
+ $mqr=get_magic_quotes_runtime();\r
+ //set_magic_quotes_runtime(0);\r
+ foreach($this->FontFiles as $file=>$info)\r
+ {\r
+ //Font file embedding\r
+ $this->_newobj();\r
+ $this->FontFiles[$file]['n']=$this->n;\r
+ if(defined('FPDF_FONTPATH'))\r
+ $file=FPDF_FONTPATH.$file;\r
+ $size=filesize($file);\r
+ if(!$size)\r
+ $this->Error('Font file not found');\r
+ $this->_out('<</Length '.$size);\r
+ if(substr($file,-2)=='.z')\r
+ $this->_out('/Filter /FlateDecode');\r
+ $this->_out('/Length1 '.$info['length1']);\r
+ if(isset($info['length2']))\r
+ $this->_out('/Length2 '.$info['length2'].' /Length3 0');\r
+ $this->_out('>>');\r
+ $f=fopen($file,'rb');\r
+ $this->_putstream(fread($f,$size));\r
+ fclose($f);\r
+ $this->_out('endobj');\r
+ }\r
+ //set_magic_quotes_runtime($mqr);\r
+ foreach($this->fonts as $k=>$font)\r
+ {\r
+ //Font objects\r
+ $this->_newobj();\r
+ $this->fonts[$k]['n']=$this->n;\r
+ $name=$font['name'];\r
+ $this->_out('<</Type /Font');\r
+ $this->_out('/BaseFont /'.$name);\r
+ if($font['type']=='core')\r
+ {\r
+ //Standard font\r
+ $this->_out('/Subtype /Type1');\r
+ if($name!='Symbol' and $name!='ZapfDingbats')\r
+ $this->_out('/Encoding /WinAnsiEncoding');\r
+ }\r
+ else\r
+ {\r
+ //Additional font\r
+ $this->_out('/Subtype /'.$font['type']);\r
+ $this->_out('/FirstChar 32');\r
+ $this->_out('/LastChar 255');\r
+ $this->_out('/Widths '.($this->n+1).' 0 R');\r
+ $this->_out('/FontDescriptor '.($this->n+2).' 0 R');\r
+ if($font['enc'])\r
+ {\r
+ if(isset($font['diff']))\r
+ $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');\r
+ else\r
+ $this->_out('/Encoding /WinAnsiEncoding');\r
+ }\r
+ }\r
+ $this->_out('>>');\r
+ $this->_out('endobj');\r
+ if($font['type']!='core')\r
+ {\r
+ //Widths\r
+ $this->_newobj();\r
+ $cw=&$font['cw'];\r
+ $s='[';\r
+ for($i=32;$i<=255;$i++)\r
+ $s.=$cw[chr($i)].' ';\r
+ $this->_out($s.']');\r
+ $this->_out('endobj');\r
+ //Descriptor\r
+ $this->_newobj();\r
+ $s='<</Type /FontDescriptor /FontName /'.$name;\r
+ foreach($font['desc'] as $k=>$v)\r
+ $s.=' /'.$k.' '.$v;\r
+ $file=$font['file'];\r
+ if($file)\r
+ $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';\r
+ $this->_out($s.'>>');\r
+ $this->_out('endobj');\r
+ }\r
+ }\r
+}\r
+\r
+function _putimages()\r
+{\r
+ $filter=($this->compress) ? '/Filter /FlateDecode ' : '';\r
+ foreach($this->images as $file=>$info)\r
+ {\r
+ $this->_newobj();\r
+ $this->images[$file]['n']=$this->n;\r
+ $this->_out('<</Type /XObject');\r
+ $this->_out('/Subtype /Image');\r
+ $this->_out('/Width '.$info['w']);\r
+ $this->_out('/Height '.$info['h']);\r
+ if($info['cs']=='Indexed')\r
+ $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');\r
+ else\r
+ {\r
+ $this->_out('/ColorSpace /'.$info['cs']);\r
+ if($info['cs']=='DeviceCMYK')\r
+ $this->_out('/Decode [1 0 1 0 1 0 1 0]');\r
+ }\r
+ $this->_out('/BitsPerComponent '.$info['bpc']);\r
+ $this->_out('/Filter /'.$info['f']);\r
+ if(isset($info['parms']))\r
+ $this->_out($info['parms']);\r
+ if(isset($info['trns']) and is_array($info['trns']))\r
+ {\r
+ $trns='';\r
+ for($i=0;$i<count($info['trns']);$i++)\r
+ $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';\r
+ $this->_out('/Mask ['.$trns.']');\r
+ }\r
+ $this->_out('/Length '.strlen($info['data']).'>>');\r
+ $this->_putstream($info['data']);\r
+ $this->_out('endobj');\r
+ //Palette\r
+ if($info['cs']=='Indexed')\r
+ {\r
+ $this->_newobj();\r
+ $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];\r
+ $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');\r
+ $this->_putstream($pal);\r
+ $this->_out('endobj');\r
+ }\r
+ }\r
+}\r
+\r
+function _putresources()\r
+{\r
+ $this->_putfonts();\r
+ $this->_putimages();\r
+ //Resource dictionary\r
+ $this->offsets[2]=strlen($this->buffer);\r
+ $this->_out('2 0 obj');\r
+ $this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');\r
+ $this->_out('/Font <<');\r
+ foreach($this->fonts as $font)\r
+ $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');\r
+ $this->_out('>>');\r
+ if(count($this->images))\r
+ {\r
+ $this->_out('/XObject <<');\r
+ foreach($this->images as $image)\r
+ $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');\r
+ $this->_out('>>');\r
+ }\r
+ $this->_out('>>');\r
+ $this->_out('endobj');\r
+}\r
+\r
+function _putinfo()\r
+{\r
+ $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));\r
+ if(!empty($this->title))\r
+ $this->_out('/Title '.$this->_textstring($this->title));\r
+ if(!empty($this->subject))\r
+ $this->_out('/Subject '.$this->_textstring($this->subject));\r
+ if(!empty($this->author))\r
+ $this->_out('/Author '.$this->_textstring($this->author));\r
+ if(!empty($this->keywords))\r
+ $this->_out('/Keywords '.$this->_textstring($this->keywords));\r
+ if(!empty($this->creator))\r
+ $this->_out('/Creator '.$this->_textstring($this->creator));\r
+ $this->_out('/CreationDate '.$this->_textstring('D:'.date('YmdHis')));\r
+}\r
+\r
+function _putcatalog()\r
+{\r
+ $this->_out('/Type /Catalog');\r
+ $this->_out('/Pages 1 0 R');\r
+ if($this->ZoomMode=='fullpage')\r
+ $this->_out('/OpenAction [3 0 R /Fit]');\r
+ elseif($this->ZoomMode=='fullwidth')\r
+ $this->_out('/OpenAction [3 0 R /FitH null]');\r
+ elseif($this->ZoomMode=='real')\r
+ $this->_out('/OpenAction [3 0 R /XYZ null null 1]');\r
+ elseif(!is_string($this->ZoomMode))\r
+ $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']');\r
+ if($this->LayoutMode=='single')\r
+ $this->_out('/PageLayout /SinglePage');\r
+ elseif($this->LayoutMode=='continuous')\r
+ $this->_out('/PageLayout /OneColumn');\r
+ elseif($this->LayoutMode=='two')\r
+ $this->_out('/PageLayout /TwoColumnLeft');\r
+}\r
+\r
+function _putheader()\r
+{\r
+ $this->_out('%PDF-'.$this->PDFVersion);\r
+}\r
+\r
+\r
+function _puttrailer()\r
+{\r
+ $this->_out('/Size '.($this->n+1));\r
+ $this->_out('/Root '.$this->n.' 0 R');\r
+ $this->_out('/Info '.($this->n-1).' 0 R');\r
+}\r
+\r
+function _enddoc()\r
+{\r
+ $this->_putheader(); \r
+ $this->_putpages();\r
+ $this->_putresources();\r
+ //Info\r
+ $this->_newobj();\r
+ $this->_out('<<');\r
+ $this->_putinfo();\r
+ $this->_out('>>');\r
+ $this->_out('endobj');\r
+ //Catalog\r
+ $this->_newobj();\r
+ $this->_out('<<');\r
+ $this->_putcatalog();\r
+ $this->_out('>>');\r
+ $this->_out('endobj');\r
+ //Cross-ref\r
+ $o=strlen($this->buffer);\r
+ $this->_out('xref');\r
+ $this->_out('0 '.($this->n+1));\r
+ $this->_out('0000000000 65535 f ');\r
+ for($i=1;$i<=$this->n;$i++)\r
+ $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));\r
+ //Trailer\r
+ $this->_out('trailer');\r
+ $this->_out('<<');\r
+ $this->_puttrailer();\r
+ $this->_out('>>');\r
+ $this->_out('startxref');\r
+ $this->_out($o);\r
+ $this->_out('%%EOF');\r
+ $this->state=3;\r
+}\r
+\r
+function _beginpage($orientation)\r
+{\r
+ $this->page++;\r
+ $this->pages[$this->page]='';\r
+ $this->state=2;\r
+ $this->x=$this->lMargin;\r
+ $this->y=$this->tMargin;\r
+ $this->lasth=0;\r
+ $this->FontFamily='';\r
+ //Page orientation\r
+ if(!$orientation)\r
+ $orientation=$this->DefOrientation;\r
+ else\r
+ {\r
+ $orientation=strtoupper($orientation[0]);\r
+ if($orientation!=$this->DefOrientation)\r
+ $this->OrientationChanges[$this->page]=true;\r
+ }\r
+ if($orientation!=$this->CurOrientation)\r
+ {\r
+ //Change orientation\r
+ if($orientation=='P')\r
+ {\r
+ $this->wPt=$this->fwPt;\r
+ $this->hPt=$this->fhPt;\r
+ $this->w=$this->fw;\r
+ $this->h=$this->fh;\r
+ }\r
+ else\r
+ {\r
+ $this->wPt=$this->fhPt;\r
+ $this->hPt=$this->fwPt;\r
+ $this->w=$this->fh;\r
+ $this->h=$this->fw;\r
+ }\r
+ $this->PageBreakTrigger=$this->h-$this->bMargin;\r
+ $this->CurOrientation=$orientation;\r
+ }\r
+}\r
+\r
+function _endpage()\r
+{\r
+ //End of page contents\r
+ $this->state=1;\r
+}\r
+\r
+function _newobj()\r
+{\r
+ //Begin a new object\r
+ $this->n++;\r
+ $this->offsets[$this->n]=strlen($this->buffer);\r
+ $this->_out($this->n.' 0 obj');\r
+}\r
+\r
+function _dounderline($x,$y,$txt)\r
+{\r
+ //Underline text\r
+ $up=$this->CurrentFont['up'];\r
+ $ut=$this->CurrentFont['ut'];\r
+ $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');\r
+ return sprintf('%.2f %.2f %.2f %.2f re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);\r
+}\r
+\r
+function _parsejpg($file)\r
+{\r
+ //Extract info from a JPEG file\r
+ $a=GetImageSize($file);\r
+ if(!$a)\r
+ $this->Error('Missing or incorrect image file: '.$file);\r
+ if($a[2]!=2)\r
+ $this->Error('Not a JPEG file: '.$file);\r
+ if(!isset($a['channels']) or $a['channels']==3)\r
+ $colspace='DeviceRGB';\r
+ elseif($a['channels']==4)\r
+ $colspace='DeviceCMYK';\r
+ else\r
+ $colspace='DeviceGray';\r
+ $bpc=isset($a['bits']) ? $a['bits'] : 8;\r
+ //Read whole file\r
+ $f=fopen($file,'rb');\r
+ $data=fread($f,filesize($file));\r
+ fclose($f);\r
+ return array('w'=>$a[0],'h'=>$a[1],'cs'=>$colspace,'bpc'=>$bpc,'f'=>'DCTDecode','data'=>$data);\r
+}\r
+\r
+function _parsepng($file)\r
+{\r
+ //Extract info from a PNG file\r
+ $f=fopen($file,'rb');\r
+ if(!$f)\r
+ $this->Error('Can\'t open image file: '.$file);\r
+ //Check signature\r
+ if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))\r
+ $this->Error('Not a PNG file: '.$file);\r
+ //Read header chunk\r
+ fread($f,4);\r
+ if(fread($f,4)!='IHDR')\r
+ $this->Error('Incorrect PNG file: '.$file);\r
+ $w=$this->_freadint($f);\r
+ $h=$this->_freadint($f);\r
+ $bpc=ord(fread($f,1));\r
+ if($bpc>8)\r
+ $this->Error('16-bit depth not supported: '.$file);\r
+ $ct=ord(fread($f,1));\r
+ if($ct==0)\r
+ $colspace='DeviceGray';\r
+ elseif($ct==2)\r
+ $colspace='DeviceRGB';\r
+ elseif($ct==3)\r
+ $colspace='Indexed';\r
+ else\r
+ $this->Error("Alpha channel not supported: $ct ".$file);\r
+ if(ord(fread($f,1))!=0)\r
+ $this->Error('Unknown compression method: '.$file);\r
+ if(ord(fread($f,1))!=0)\r
+ $this->Error('Unknown filter method: '.$file);\r
+ if(ord(fread($f,1))!=0)\r
+ $this->Error('Interlacing not supported: '.$file);\r
+ fread($f,4);\r
+ $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';\r
+ //Scan chunks looking for palette, transparency and image data\r
+ $pal='';\r
+ $trns='';\r
+ $data='';\r
+ do\r
+ {\r
+ $n=$this->_freadint($f);\r
+ $type=fread($f,4);\r
+ if($type=='PLTE')\r
+ {\r
+ //Read palette\r
+ $pal=fread($f,$n);\r
+ fread($f,4);\r
+ }\r
+ elseif($type=='tRNS')\r
+ {\r
+ //Read transparency info\r
+ $t=fread($f,$n);\r
+ if($ct==0)\r
+ $trns=array(ord(substr($t,1,1)));\r
+ elseif($ct==2)\r
+ $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1)));\r
+ else\r
+ {\r
+ $pos=strpos($t,chr(0));\r
+ if(is_int($pos))\r
+ $trns=array($pos);\r
+ }\r
+ fread($f,4);\r
+ }\r
+ elseif($type=='IDAT')\r
+ {\r
+ //Read image data block\r
+ $data.=fread($f,$n);\r
+ fread($f,4);\r
+ }\r
+ elseif($type=='IEND')\r
+ break;\r
+ else\r
+ fread($f,$n+4);\r
+ }\r
+ while($n);\r
+ if($colspace=='Indexed' and empty($pal))\r
+ $this->Error('Missing palette in '.$file);\r
+ fclose($f);\r
+ return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data);\r
+}\r
+\r
+function _freadint($f)\r
+{\r
+ //Read a 4-byte integer from file\r
+ $i=ord(fread($f,1))<<24;\r
+ $i+=ord(fread($f,1))<<16;\r
+ $i+=ord(fread($f,1))<<8;\r
+ $i+=ord(fread($f,1));\r
+ return $i;\r
+}\r
+\r
+function _textstring($s)\r
+{\r
+ //Format a text string\r
+ return '('.$this->_escape($s).')';\r
+}\r
+\r
+function _escape($s)\r
+{\r
+ //Add \ before \, ( and )\r
+ return str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$s)));\r
+}\r
+\r
+function _putstream($s)\r
+{\r
+ $this->_out('stream');\r
+ $this->_out($s);\r
+ $this->_out('endstream');\r
+}\r
+\r
+function _out($s)\r
+{\r
+ //Add a line to the document\r
+ if($this->state==2)\r
+ $this->pages[$this->page].=$s."\n";\r
+ else\r
+ $this->buffer.=$s."\n";\r
+}\r
+//End of class\r
+}\r
+\r
+//Handle silly IE contype request\r
+ \r
--- /dev/null
+<?php
+require_once 'FpdfAlt.php';
+
+$GLOBALS['Big5_widths']=array(' '=>250,'!'=>250,'"'=>408,'#'=>668,'$'=>490,'%'=>875,'&'=>698,'\''=>250,
+ '('=>240,')'=>240,'*'=>417,'+'=>667,','=>250,'-'=>313,'.'=>250,'/'=>520,'0'=>500,'1'=>500,
+ '2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>250,';'=>250,
+ '<'=>667,'='=>667,'>'=>667,'?'=>396,'@'=>921,'A'=>677,'B'=>615,'C'=>719,'D'=>760,'E'=>625,
+ 'F'=>552,'G'=>771,'H'=>802,'I'=>354,'J'=>354,'K'=>781,'L'=>604,'M'=>927,'N'=>750,'O'=>823,
+ 'P'=>563,'Q'=>823,'R'=>729,'S'=>542,'T'=>698,'U'=>771,'V'=>729,'W'=>948,'X'=>771,'Y'=>677,
+ 'Z'=>635,'['=>344,'\\'=>520,']'=>344,'^'=>469,'_'=>500,'`'=>250,'a'=>469,'b'=>521,'c'=>427,
+ 'd'=>521,'e'=>438,'f'=>271,'g'=>469,'h'=>531,'i'=>250,'j'=>250,'k'=>458,'l'=>240,'m'=>802,
+ 'n'=>531,'o'=>500,'p'=>521,'q'=>521,'r'=>365,'s'=>333,'t'=>292,'u'=>521,'v'=>458,'w'=>677,
+ 'x'=>479,'y'=>458,'z'=>427,'{'=>480,'|'=>496,'}'=>480,'~'=>667);
+
+$GLOBALS['GB_widths']=array(' '=>207,'!'=>270,'"'=>342,'#'=>467,'$'=>462,'%'=>797,'&'=>710,'\''=>239,
+ '('=>374,')'=>374,'*'=>423,'+'=>605,','=>238,'-'=>375,'.'=>238,'/'=>334,'0'=>462,'1'=>462,
+ '2'=>462,'3'=>462,'4'=>462,'5'=>462,'6'=>462,'7'=>462,'8'=>462,'9'=>462,':'=>238,';'=>238,
+ '<'=>605,'='=>605,'>'=>605,'?'=>344,'@'=>748,'A'=>684,'B'=>560,'C'=>695,'D'=>739,'E'=>563,
+ 'F'=>511,'G'=>729,'H'=>793,'I'=>318,'J'=>312,'K'=>666,'L'=>526,'M'=>896,'N'=>758,'O'=>772,
+ 'P'=>544,'Q'=>772,'R'=>628,'S'=>465,'T'=>607,'U'=>753,'V'=>711,'W'=>972,'X'=>647,'Y'=>620,
+ 'Z'=>607,'['=>374,'\\'=>333,']'=>374,'^'=>606,'_'=>500,'`'=>239,'a'=>417,'b'=>503,'c'=>427,
+ 'd'=>529,'e'=>415,'f'=>264,'g'=>444,'h'=>518,'i'=>241,'j'=>230,'k'=>495,'l'=>228,'m'=>793,
+ 'n'=>527,'o'=>524,'p'=>524,'q'=>504,'r'=>338,'s'=>336,'t'=>277,'u'=>517,'v'=>450,'w'=>652,
+ 'x'=>466,'y'=>452,'z'=>407,'{'=>370,'|'=>258,'}'=>370,'~'=>605);
+
+class FpdfAlt_Chinese extends FpdfAlt
+{
+ function AddCIDFont($family,$style,$name,$cw,$CMap,$registry)
+ {
+ $fontkey=strtolower($family).strtoupper($style);
+ if(isset($this->fonts[$fontkey]))
+ $this->Error("Font already added: $family $style");
+ $i=count($this->fonts)+1;
+ $name=str_replace(' ','',$name);
+ $this->fonts[$fontkey]=array('i'=>$i,'type'=>'Type0','name'=>$name,'up'=>-130,'ut'=>40,'cw'=>$cw,'CMap'=>$CMap,'registry'=>$registry);
+ }
+
+ function AddCIDFonts($family,$name,$cw,$CMap,$registry)
+ {
+ $this->AddCIDFont($family,'',$name,$cw,$CMap,$registry);
+ $this->AddCIDFont($family,'B',$name.',Bold',$cw,$CMap,$registry);
+ $this->AddCIDFont($family,'I',$name.',Italic',$cw,$CMap,$registry);
+ $this->AddCIDFont($family,'BI',$name.',BoldItalic',$cw,$CMap,$registry);
+ }
+
+ function AddBig5Font($family='Big5',$name='MSungStd-Light-Acro')
+ {
+ //Add Big5 font with proportional Latin
+ $cw=$GLOBALS['Big5_widths'];
+ $CMap='ETenms-B5-H';
+ $registry=array('ordering'=>'CNS1','supplement'=>0);
+ $this->AddCIDFonts($family,$name,$cw,$CMap,$registry);
+ }
+
+ function AddBig5hwFont($family='Big5-hw',$name='MMingStd-Light-Acro')
+ {
+ //Add Big5 font with half-witdh Latin
+ for($i=32;$i<=126;$i++)
+ $cw[chr($i)]=500;
+ $CMap='ETen-B5-H';
+ $registry=array('ordering'=>'CNS1','supplement'=>0);
+ $this->AddCIDFonts($family,$name,$cw,$CMap,$registry);
+ }
+ function AddUniCNShwFont($family='Uni-hw',$name='PMingLiU')
+ {
+ //Add Unicode font with half-witdh Latin
+ for($i=32;$i<=126;$i++)
+ $cw[chr($i)]=500;
+ $CMap='UniCNS-UTF16-H';
+ $registry=array('ordering'=>'CNS1','supplement'=>4);
+ $this->AddCIDFonts($family,$name,$cw,$CMap,$registry);
+ }
+
+
+ function AddGBFont($family='GB',$name='STSongStd-Light-Acro')
+ {
+ //Add GB font with proportional Latin
+ $cw=$GLOBALS['GB_widths'];
+ $CMap='GBKp-EUC-H';
+ $registry=array('ordering'=>'GB1','supplement'=>2);
+ $this->AddCIDFonts($family,$name,$cw,$CMap,$registry);
+ }
+
+ function AddGBhwFont($family='GB-hw',$name='STSongStd-Light-Acro')
+ {
+ //Add GB font with half-width Latin
+ for($i=32;$i<=126;$i++)
+ $cw[chr($i)]=500;
+ $CMap='GBK-EUC-H';
+ $registry=array('ordering'=>'GB1','supplement'=>2);
+ $this->AddCIDFonts($family,$name,$cw,$CMap,$registry);
+ }
+
+ function GetStringWidth($s)
+ {
+ if($this->CurrentFont['type']=='Type0')
+ return $this->GetMBStringWidth($s);
+ else
+ return parent::GetStringWidth($s);
+ }
+
+ function GetMBStringWidth($s)
+ {
+ //Multi-byte version of GetStringWidth()
+ $l=0;
+ $cw=&$this->CurrentFont['cw'];
+ $nb=strlen($s);
+ $i=0;
+ while($i<$nb)
+ {
+ $c=$s[$i];
+ if(ord($c)<128)
+ {
+ $l+=$cw[$c];
+ $i++;
+ }
+ else
+ {
+ $l+=1000;
+ $i+=2;
+ }
+ }
+ return $l*$this->FontSize/1000;
+ }
+
+ function MultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
+ {
+ if($this->CurrentFont['type']=='Type0')
+ $this->MBMultiCell($w,$h,$txt,$border,$align,$fill);
+ else
+ parent::MultiCell($w,$h,$txt,$border,$align,$fill);
+ }
+
+ function MBMultiCell($w,$h,$txt,$border=0,$align='L',$fill=0)
+ {
+ //Multi-byte version of MultiCell()
+ $cw=&$this->CurrentFont['cw'];
+ if($w==0)
+ $w=$this->w-$this->rMargin-$this->x;
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ $s=str_replace("\r",'',$txt);
+ $nb=strlen($s);
+ if($nb>0 and $s[$nb-1]=="\n")
+ $nb--;
+ $b=0;
+ if($border)
+ {
+ if($border==1)
+ {
+ $border='LTRB';
+ $b='LRT';
+ $b2='LR';
+ }
+ else
+ {
+ $b2='';
+ if(is_int(strpos($border,'L')))
+ $b2.='L';
+ if(is_int(strpos($border,'R')))
+ $b2.='R';
+ $b=is_int(strpos($border,'T')) ? $b2.'T' : $b2;
+ }
+ }
+ $sep=-1;
+ $i=0;
+ $j=0;
+ $l=0;
+ $nl=1;
+ while($i<$nb)
+ {
+ //Get next character
+ $c=$s[$i];
+ //Check if ASCII or MB
+ $ascii=(ord($c)<128);
+ if($c=="\n")
+ {
+ //Explicit line break
+ $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+ $i++;
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ $nl++;
+ if($border and $nl==2)
+ $b=$b2;
+ continue;
+ }
+ if(!$ascii)
+ {
+ $sep=$i;
+ $ls=$l;
+ }
+ elseif($c==' ')
+ {
+ $sep=$i;
+ $ls=$l;
+ }
+ $l+=$ascii ? $cw[$c] : 1000;
+ if($l>$wmax)
+ {
+ //Automatic line break
+ if($sep==-1 or $i==$j)
+ {
+ if($i==$j)
+ $i+=$ascii ? 1 : 2;
+ $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+ }
+ else
+ {
+ $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
+ $i=($s[$sep]==' ') ? $sep+1 : $sep;
+ }
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ $nl++;
+ if($border and $nl==2)
+ $b=$b2;
+ }
+ else
+ $i+=$ascii ? 1 : 2;
+ }
+ //Last chunk
+ if($border and is_int(strpos($border,'B')))
+ $b.='B';
+ $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
+ $this->x=$this->lMargin;
+ }
+
+ function Write($h,$txt,$link='')
+ {
+ if($this->CurrentFont['type']=='Type0')
+ $this->MBWrite($h,$txt,$link);
+ else
+ parent::Write($h,$txt,$link);
+ }
+
+ function MBWrite($h,$txt,$link)
+ {
+ //Multi-byte version of Write()
+ $cw=&$this->CurrentFont['cw'];
+ $w=$this->w-$this->rMargin-$this->x;
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ $s=str_replace("\r",'',$txt);
+ $nb=strlen($s);
+ $sep=-1;
+ $i=0;
+ $j=0;
+ $l=0;
+ $nl=1;
+ while($i<$nb)
+ {
+ //Get next character
+ $c=$s[$i];
+ //Check if ASCII or MB
+ $ascii=(ord($c)<128);
+ if($c=="\n")
+ {
+ //Explicit line break
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+ $i++;
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ if($nl==1)
+ {
+ $this->x=$this->lMargin;
+ $w=$this->w-$this->rMargin-$this->x;
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ }
+ $nl++;
+ continue;
+ }
+ if(!$ascii or $c==' ')
+ $sep=$i;
+ $l+=$ascii ? $cw[$c] : 1000;
+ if($l>$wmax)
+ {
+ //Automatic line break
+ if($sep==-1 or $i==$j)
+ {
+ if($this->x>$this->lMargin)
+ {
+ //Move to next line
+ $this->x=$this->lMargin;
+ $this->y+=$h;
+ $w=$this->w-$this->rMargin-$this->x;
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ $i++;
+ $nl++;
+ continue;
+ }
+ if($i==$j)
+ $i+=$ascii ? 1 : 2;
+ $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
+ }
+ else
+ {
+ $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
+ $i=($s[$sep]==' ') ? $sep+1 : $sep;
+ }
+ $sep=-1;
+ $j=$i;
+ $l=0;
+ if($nl==1)
+ {
+ $this->x=$this->lMargin;
+ $w=$this->w-$this->rMargin-$this->x;
+ $wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
+ }
+ $nl++;
+ }
+ else
+ $i+=$ascii ? 1 : 2;
+ }
+ //Last chunk
+ if($i!=$j)
+ $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j,$i-$j),0,0,'',0,$link);
+ }
+
+ function _putfonts()
+ {
+ $nf=$this->n;
+ foreach($this->diffs as $diff)
+ {
+ //Encodings
+ $this->_newobj();
+ $this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
+ $this->_out('endobj');
+ }
+ foreach($this->FontFiles as $file=>$info)
+ {
+ //Font file embedding
+ $this->_newobj();
+ $this->FontFiles[$file]['n']=$this->n;
+ if(defined('FPDF_FONTPATH'))
+ $file=FPDF_FONTPATH.$file;
+ $size=filesize($file);
+ if(!$size)
+ $this->Error('Font file not found');
+ $this->_out('<</Length '.$size);
+ if(substr($file,-2)=='.z')
+ $this->_out('/Filter /FlateDecode');
+ $this->_out('/Length1 '.$info['length1']);
+ if(isset($info['length2']))
+ $this->_out('/Length2 '.$info['length2'].' /Length3 0');
+ $this->_out('>>');
+ $f=fopen($file,'rb');
+ $this->_putstream(fread($f,$size));
+ fclose($f);
+ $this->_out('endobj');
+ }
+ foreach($this->fonts as $k=>$font)
+ {
+ //Font objects
+ $this->_newobj();
+ $this->fonts[$k]['n']=$this->n;
+ $this->_out('<</Type /Font');
+ if($font['type']=='Type0')
+ $this->_putType0($font);
+ else
+ {
+ $name=$font['name'];
+ $this->_out('/BaseFont /'.$name);
+ if($font['type']=='core')
+ {
+ //Standard font
+ $this->_out('/Subtype /Type1');
+ if($name!='Symbol' and $name!='ZapfDingbats')
+ $this->_out('/Encoding /WinAnsiEncoding');
+ }
+ else
+ {
+ //Additional font
+ $this->_out('/Subtype /'.$font['type']);
+ $this->_out('/FirstChar 32');
+ $this->_out('/LastChar 255');
+ $this->_out('/Widths '.($this->n+1).' 0 R');
+ $this->_out('/FontDescriptor '.($this->n+2).' 0 R');
+ if($font['enc'])
+ {
+ if(isset($font['diff']))
+ $this->_out('/Encoding '.($nf+$font['diff']).' 0 R');
+ else
+ $this->_out('/Encoding /WinAnsiEncoding');
+ }
+ }
+ $this->_out('>>');
+ $this->_out('endobj');
+ if($font['type']!='core')
+ {
+ //Widths
+ $this->_newobj();
+ $cw=&$font['cw'];
+ $s='[';
+ for($i=32;$i<=255;$i++)
+ $s.=$cw[chr($i)].' ';
+ $this->_out($s.']');
+ $this->_out('endobj');
+ //Descriptor
+ $this->_newobj();
+ $s='<</Type /FontDescriptor /FontName /'.$name;
+ foreach($font['desc'] as $k=>$v)
+ $s.=' /'.$k.' '.$v;
+ $file=$font['file'];
+ if($file)
+ $s.=' /FontFile'.($font['type']=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R';
+ $this->_out($s.'>>');
+ $this->_out('endobj');
+ }
+ }
+ }
+ }
+
+ function _putType0($font)
+{
+ //Type0
+ $this->_out('/Subtype /Type0');
+ $this->_out('/BaseFont /'.$font['name'].'-'.$font['CMap']);
+ $this->_out('/Encoding /'.$font['CMap']);
+ $this->_out('/DescendantFonts ['.($this->n+1).' 0 R]');
+ $this->_out('>>');
+ $this->_out('endobj');
+ //CIDFont
+ $this->_newobj();
+ $this->_out('<</Type /Font');
+ $this->_out('/Subtype /CIDFontType0');
+ $this->_out('/BaseFont /'.$font['name']);
+ $this->_out('/CIDSystemInfo <</Registry (Adobe) /Ordering ('.$font['registry']['ordering'].') /Supplement '.$font['registry']['supplement'].'>>');
+ $this->_out('/FontDescriptor '.($this->n+1).' 0 R');
+ if($font['CMap']=='ETen-B5-H')
+ $W='13648 13742 500';
+ elseif($font['CMap']=='GBK-EUC-H')
+ $W='814 907 500 7716 [500]';
+ else
+ //print_r( $font['cw']);exit;
+ $W='1 ['.implode(' ',$font['cw']).']';
+ $this->_out('/W ['.$W.']>>');
+ $this->_out('endobj');
+ //Font descriptor
+ $this->_newobj();
+ $this->_out('<</Type /FontDescriptor');
+ $this->_out('/FontName /'.$font['name']);
+ $this->_out('/Flags 6');
+ $this->_out('/FontBBox [0 -200 1000 900]');
+ $this->_out('/ItalicAngle 0');
+ $this->_out('/Ascent 800');
+ $this->_out('/Descent -200');
+ $this->_out('/CapHeight 800');
+ $this->_out('/StemV 50');
+ $this->_out('>>');
+ $this->_out('endobj');
+}
+}
+?>
--- /dev/null
+ <?php
+/*******************************************************************************
+* Software: PDF_ImageAlpha
+* Version: 1.4
+* Date: 2009-12-28
+* Author: Valentin Schmidt
+*
+* Requirements: FPDF 1.6
+*
+* This script allows to use images (PNGs or JPGs) with alpha-channels.
+* The alpha-channel can be either supplied as separate 8-bit PNG ("mask"),
+* or, for PNGs, also an internal alpha-channel can be used.
+* For the latter the GD 2.x extension is required.
+*******************************************************************************/
+
+require_once 'Fpdf.php';
+
+class Fpdf_ImageAlpha extends Fpdf{
+
+//Private properties
+var $tmpFiles = array();
+
+/*******************************************************************************
+* *
+* Public methods *
+* *
+*******************************************************************************/
+function Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0)
+{
+ //Put an image on the page
+ if(!isset($this->images[$file]))
+ {
+ //First use of image, get info
+ if($type=='')
+ {
+ $pos=strrpos($file,'.');
+ if(!$pos)
+ $this->Error('Image file has no extension and no type was specified: '.$file);
+ $type=substr($file,$pos+1);
+ }
+ $type=strtolower($type);
+ //$mqr=get_magic_quotes_runtime();
+ //@set_magic_quotes_runtime(0);
+ if($type=='jpg' || $type=='jpeg')
+ $info=$this->_parsejpg($file);
+ elseif($type=='png'){
+ $info=$this->_parsepng($file);
+ if ($info=='alpha') return $this->ImagePngWithAlpha($file,$x,$y,$w,$h,$link);
+ }
+ else
+ {
+ //Allow for additional formats
+ $mtd='_parse'.$type;
+ if(!method_exists($this,$mtd))
+ $this->Error('Unsupported image type: '.$type);
+ $info=$this->$mtd($file);
+ }
+ //set_magic_quotes_runtime($mqr);
+
+ if ($isMask){
+ $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed)
+ }
+ $info['i']=count($this->images)+1;
+ if ($maskImg>0) $info['masked'] = $maskImg;###
+ $this->images[$file]=$info;
+ }
+ else
+ $info=$this->images[$file];
+ //Automatic width and height calculation if needed
+ if($w==0 && $h==0)
+ {
+ //Put image at 72 dpi
+ $w=$info['w']/$this->k;
+ $h=$info['h']/$this->k;
+ }
+ if($w==0)
+ $w=$h*$info['w']/$info['h'];
+ if($h==0)
+ $h=$w*$info['h']/$info['w'];
+
+ // embed hidden, ouside the canvas
+ if ((float)FPDF_VERSION>=1.7){
+ if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageSize[0]:$this->CurPageSize[1]) + 10;
+ }else{
+ if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageFormat[0]:$this->CurPageFormat[1]) + 10;
+ }
+
+ $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
+ if($link)
+ $this->Link($x,$y,$w,$h,$link);
+
+ return $info['i'];
+}
+
+// needs GD 2.x extension
+// pixel-wise operation, not very fast
+function ImagePngWithAlpha($file,$x,$y,$w=0,$h=0,$link='')
+{
+ $tmp_alpha = tempnam('.', 'mska');
+ $this->tmpFiles[] = $tmp_alpha;
+ $tmp_plain = tempnam('.', 'mskp');
+ $this->tmpFiles[] = $tmp_plain;
+
+ list($wpx, $hpx) = getimagesize($file);
+ $img = imagecreatefrompng($file);
+ $alpha_img = imagecreate( $wpx, $hpx );
+
+ // generate gray scale pallete
+ for($c=0;$c<256;$c++) ImageColorAllocate($alpha_img, $c, $c, $c);
+
+ // extract alpha channel
+ $xpx=0;
+ while ($xpx<$wpx){
+ $ypx = 0;
+ while ($ypx<$hpx){
+ $color_index = imagecolorat($img, $xpx, $ypx);
+ $alpha = 255-($color_index>>24)*255/127; // GD alpha component: 7 bit only, 0..127!
+ imagesetpixel($alpha_img, $xpx, $ypx, $alpha);
+ ++$ypx;
+ }
+ ++$xpx;
+ }
+
+ imagepng($alpha_img, $tmp_alpha);
+ imagedestroy($alpha_img);
+
+ // extract image without alpha channel
+ $plain_img = imagecreatetruecolor ( $wpx, $hpx );
+ imagecopy ($plain_img, $img, 0, 0, 0, 0, $wpx, $hpx );
+ imagepng($plain_img, $tmp_plain);
+ imagedestroy($plain_img);
+
+ //first embed mask image (w, h, x, will be ignored)
+ $maskImg = $this->Image($tmp_alpha, 0,0,0,0, 'PNG', '', true);
+
+ //embed image, masked with previously embedded mask
+ $this->Image($tmp_plain,$x,$y,$w,$h,'PNG',$link, false, $maskImg);
+}
+
+function Close()
+{
+ parent::Close();
+ // clean up tmp files
+ foreach($this->tmpFiles as $tmp) @unlink($tmp);
+}
+
+/*******************************************************************************
+* *
+* Private methods *
+* *
+*******************************************************************************/
+function _putimages()
+{
+ $filter=($this->compress) ? '/Filter /FlateDecode ' : '';
+ reset($this->images);
+ while(list($file,$info)=each($this->images))
+ {
+ $this->_newobj();
+ $this->images[$file]['n']=$this->n;
+ $this->_out('<</Type /XObject');
+ $this->_out('/Subtype /Image');
+ $this->_out('/Width '.$info['w']);
+ $this->_out('/Height '.$info['h']);
+
+ if (isset($info["masked"])) $this->_out('/SMask '.($this->n-1).' 0 R'); ###
+
+ if($info['cs']=='Indexed')
+ $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
+ else
+ {
+ $this->_out('/ColorSpace /'.$info['cs']);
+ if($info['cs']=='DeviceCMYK')
+ $this->_out('/Decode [1 0 1 0 1 0 1 0]');
+ }
+ $this->_out('/BitsPerComponent '.$info['bpc']);
+ if(isset($info['f']))
+ $this->_out('/Filter /'.$info['f']);
+ if(isset($info['parms']))
+ $this->_out($info['parms']);
+ if(isset($info['trns']) && is_array($info['trns']))
+ {
+ $trns='';
+ for($i=0;$i<count($info['trns']);$i++)
+ $trns.=$info['trns'][$i].' '.$info['trns'][$i].' ';
+ $this->_out('/Mask ['.$trns.']');
+ }
+ $this->_out('/Length '.strlen($info['data']).'>>');
+ $this->_putstream($info['data']);
+ unset($this->images[$file]['data']);
+ $this->_out('endobj');
+ //Palette
+ if($info['cs']=='Indexed')
+ {
+ $this->_newobj();
+ $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal'];
+ $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
+ $this->_putstream($pal);
+ $this->_out('endobj');
+ }
+ }
+}
+
+// this method overwriing the original version is only needed to make the Image method support PNGs with alpha channels.
+// if you only use the ImagePngWithAlpha method for such PNGs, you can remove it from this script.
+function _parsepng($file)
+{
+ //Extract info from a PNG file
+ $f=fopen($file,'rb');
+ if(!$f)
+ $this->Error('Can\'t open image file: '.$file);
+ //Check signature
+ if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
+ $this->Error('Not a PNG file: '.$file);
+ //Read header chunk
+ fread($f,4);
+ if(fread($f,4)!='IHDR')
+ $this->Error('Incorrect PNG file: '.$file);
+ $w=$this->_readint($f);
+ $h=$this->_readint($f);
+ $bpc=ord(fread($f,1));
+ if($bpc>8)
+ $this->Error('16-bit depth not supported: '.$file);
+ $ct=ord(fread($f,1));
+ if($ct==0)
+ $colspace='DeviceGray';
+ elseif($ct==2)
+ $colspace='DeviceRGB';
+ elseif($ct==3)
+ $colspace='Indexed';
+ else {
+ fclose($f); // the only changes are
+ return 'alpha'; // made in those 2 lines
+ }
+ if(ord(fread($f,1))!=0)
+ $this->Error('Unknown compression method: '.$file);
+ if(ord(fread($f,1))!=0)
+ $this->Error('Unknown filter method: '.$file);
+ if(ord(fread($f,1))!=0)
+ $this->Error('Interlacing not supported: '.$file);
+ fread($f,4);
+ $parms='/DecodeParms <</Predictor 15 /Colors '.($ct==2 ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w.'>>';
+ //Scan chunks looking for palette, transparency and image data
+ $pal='';
+ $trns='';
+ $data='';
+ do
+ {
+ $n=$this->_readint($f);
+ $type=fread($f,4);
+ if($type=='PLTE')
+ {
+ //Read palette
+ $pal=fread($f,$n);
+ fread($f,4);
+ }
+ elseif($type=='tRNS')
+ {
+ //Read transparency info
+ $t=fread($f,$n);
+ if($ct==0)
+ $trns=array(ord(substr($t,1,1)));
+ elseif($ct==2)
+ $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1)));
+ else
+ {
+ $pos=strpos($t,chr(0));
+ if($pos!==false)
+ $trns=array($pos);
+ }
+ fread($f,4);
+ }
+ elseif($type=='IDAT')
+ {
+ //Read image data block
+ $data.=fread($f,$n);
+ fread($f,4);
+ }
+ elseif($type=='IEND')
+ break;
+ else
+ fread($f,$n+4);
+ }
+ while($n);
+ if($colspace=='Indexed' && empty($pal))
+ $this->Error('Missing palette in '.$file);
+ fclose($f);
+ return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data);
+}
+
+function _readstream($f, $n)
+{
+ // Read n bytes from stream
+ $res = '';
+ while($n>0 && !feof($f))
+ {
+ $s = fread($f,$n);
+ if($s===false)
+ $this->Error('Error while reading stream');
+ $n -= strlen($s);
+ $res .= $s;
+ }
+ if($n>0)
+ $this->Error('Unexpected end of stream');
+ return $res;
+}
+
+function _readint($f)
+{
+ // Read a 4-byte integer from stream
+ $a = unpack('Ni',$this->_readstream($f,4));
+ return $a['i'];
+}
+}
+
\ No newline at end of file
--- /dev/null
+<?php\r
+for($i=0;$i<=255;$i++)\r
+ $fpdf_charwidths['courier'][chr($i)]=600;\r
+$fpdf_charwidths['courierB']=$fpdf_charwidths['courier'];\r
+$fpdf_charwidths['courierI']=$fpdf_charwidths['courier'];\r
+$fpdf_charwidths['courierBI']=$fpdf_charwidths['courier'];\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['helvetica']=array(\r
+ chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,\r
+ chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,\r
+ ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,\r
+ 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,\r
+ 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,\r
+ 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,\r
+ chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,\r
+ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,\r
+ chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['helveticaB']=array(\r
+ chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,\r
+ chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,\r
+ ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,\r
+ 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,\r
+ 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,\r
+ 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,\r
+ chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,\r
+ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,\r
+ chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['helveticaBI']=array(\r
+ chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,\r
+ chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,\r
+ ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,\r
+ 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,\r
+ 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,\r
+ 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,\r
+ chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,\r
+ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,\r
+ chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['helveticaI']=array(\r
+ chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,\r
+ chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,\r
+ ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,\r
+ 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,\r
+ 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,\r
+ 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,\r
+ chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,\r
+ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,\r
+ chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['symbol']=array(\r
+ chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,\r
+ chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,\r
+ ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,\r
+ 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,\r
+ 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,\r
+ 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,\r
+ chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,\r
+ chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,\r
+ chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,\r
+ chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,\r
+ chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,\r
+ chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['times']=array(\r
+ chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,\r
+ chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,\r
+ ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,\r
+ 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,\r
+ 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,\r
+ 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,\r
+ chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,\r
+ chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,\r
+ chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,\r
+ chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['timesB']=array(\r
+ chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,\r
+ chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,\r
+ ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,\r
+ 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,\r
+ 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,\r
+ 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,\r
+ chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,\r
+ chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,\r
+ chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['timesBI']=array(\r
+ chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,\r
+ chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,\r
+ ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,\r
+ 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,\r
+ 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,\r
+ 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,\r
+ chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,\r
+ chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,\r
+ chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,\r
+ chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['timesI']=array(\r
+ chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,\r
+ chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,\r
+ ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,\r
+ 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,\r
+ 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,\r
+ 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,\r
+ chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,\r
+ chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,\r
+ chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,\r
+ chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,\r
+ chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,\r
+ chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);\r
+?>\r
--- /dev/null
+<?php\r
+$fpdf_charwidths['zapfdingbats']=array(\r
+ chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,\r
+ chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,\r
+ ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,\r
+ 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,\r
+ 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,\r
+ 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,\r
+ chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,\r
+ chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,\r
+ chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,\r
+ chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,\r
+ chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,\r
+ chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);\r
+?>\r
--- /dev/null
+<?php
+/*
+
+BASED ON:
+http://code.google.com/p/webtool123/downloads/detail?name=str_chinese.php&can=2&q=
+
+ *mbstring are required*
+ Convert to Traditional Chinese
+ Convert to Simplified Chinese
+
+ author: Francis Sem
+
+ Copyright 2007 francissem@gmail.com
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at http://www.apache.org/licenses/
+ LICENSE-2.0 Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ ---------------------------------------------------------------------------
+
+*/
+// simple version.
+if (!function_exists('array_combine')) {
+
+
+ function array_combine($arr1,$arr2) {
+ $out = array();
+ foreach($arr1 as $key1 => $value1) {
+ $out[$value1] = $arr2[$key1];
+ }
+ return $out;
+ }
+ }
+$GLOBALS['Text_zhDetect']['t2smap'] = array(
+ 23586 => 23588,
+ 20839 => 20869,
+ 21243 => 21248,
+ 24340 => 21514,
+ 25142 => 25143,
+ 20874 => 20876,
+ 26414 => 26415,
+ 27710 => 27867,
+ 19999 => 20002,
+ 20121 => 20120,
+ 20235 => 27762,
+ 20807 => 20982,
+ 27737 => 27745,
+ 27726 => 27867,
+ 20295 => 20267,
+ 20308 => 21344,
+ 20296 => 24067,
+ 20812 => 20817,
+ 21029 => 21035,
+ 21034 => 21024,
+ 21555 => 21556,
+ 21570 => 21525,
+ 21558 => 21584,
+ 22250 => 22257,
+ 22767 => 22766,
+ 22846 => 22841,
+ 22941 => 22918,
+ 24439 => 20223,
+ 27784 => 27785,
+ 27770 => 20915,
+ 27798 => 20914,
+ 27794 => 27809,
+ 27789 => 20913,
+ 28797 => 28798,
+ 29280 => 23427,
+ 31167 => 31171,
+ 35211 => 35265,
+ 35997 => 36125,
+ 36554 => 36710,
+ 36806 => 36836,
+ 20006 => 24182,
+ 20126 => 20122,
+ 20358 => 26469,
+ 20341 => 24182,
+ 20374 => 20177,
+ 20818 => 20799,
+ 20841 => 20004,
+ 21332 => 21327,
+ 21369 => 24676,
+ 22989 => 22999,
+ 23622 => 23626,
+ 23713 => 20872,
+ 24447 => 20315,
+ 25291 => 25243,
+ 25306 => 25340,
+ 26044 => 20110,
+ 26119 => 21319,
+ 26481 => 19996,
+ 27519 => 27521,
+ 27841 => 20917,
+ 29229 => 20105,
+ 29376 => 29366,
+ 31176 => 31868,
+ 31998 => 32416,
+ 32651 => 33416,
+ 33253 => 21351,
+ 36555 => 36711,
+ 38263 => 38271,
+ 38272 => 38376,
+ 20448 => 20384,
+ 20406 => 20387,
+ 20418 => 31995,
+ 20407 => 23616,
+ 20823 => 20822,
+ 20881 => 32964,
+ 21070 => 21049,
+ 21067 => 20811,
+ 21063 => 21017,
+ 21185 => 21170,
+ 21371 => 21364,
+ 22864 => 22850,
+ 23014 => 22904,
+ 23629 => 23608,
+ 24101 => 24069,
+ 24421 => 24422,
+ 24460 => 21518,
+ 24646 => 24658,
+ 26613 => 26629,
+ 26548 => 25296,
+ 27958 => 27769,
+ 27945 => 27844,
+ 28858 => 20026,
+ 30403 => 26479,
+ 31047 => 21482,
+ 32002 => 32419,
+ 32005 => 32418,
+ 32000 => 32426,
+ 32009 => 32427,
+ 32007 => 32421,
+ 32004 => 32422,
+ 32006 => 32417,
+ 33511 => 33486,
+ 35284 => 31563,
+ 35336 => 35745,
+ 35330 => 35746,
+ 35331 => 35747,
+ 35998 => 36126,
+ 36000 => 36127,
+ 36557 => 20891,
+ 36556 => 36712,
+ 38274 => 38377,
+ 38859 => 38886,
+ 38913 => 39029,
+ 39080 => 39118,
+ 39131 => 39134,
+ 20515 => 20223,
+ 20502 => 24184,
+ 20486 => 20457,
+ 20497 => 20204,
+ 20480 => 20261,
+ 20491 => 20010,
+ 20523 => 20262,
+ 20489 => 20179,
+ 20941 => 20923,
+ 21083 => 21018,
+ 21085 => 21093,
+ 21729 => 21592,
+ 23067 => 23089,
+ 23403 => 23385,
+ 23470 => 23467,
+ 23805 => 23777,
+ 23798 => 23707,
+ 23796 => 23704,
+ 24107 => 24072,
+ 24235 => 24211,
+ 24465 => 24452,
+ 24677 => 32827,
+ 24709 => 24742,
+ 25406 => 25375,
+ 26178 => 26102,
+ 26185 => 26187,
+ 26360 => 20070,
+ 27683 => 27668,
+ 28039 => 27902,
+ 28025 => 27971,
+ 28879 => 20044,
+ 29433 => 29421,
+ 29437 => 29384,
+ 29574 => 20857,
+ 30045 => 20137,
+ 30384 => 30129,
+ 30770 => 28846,
+ 31061 => 31192,
+ 31056 => 20305,
+ 32033 => 32442,
+ 32023 => 32433,
+ 32011 => 32441,
+ 32020 => 32431,
+ 32016 => 32445,
+ 32021 => 32432,
+ 32026 => 32423,
+ 32028 => 32429,
+ 32013 => 32435,
+ 32025 => 32440,
+ 32027 => 32439,
+ 33029 => 32961,
+ 33032 => 33033,
+ 33467 => 21005,
+ 33610 => 33606,
+ 33586 => 20857,
+ 34937 => 21482,
+ 35352 => 35760,
+ 35344 => 35750,
+ 35342 => 35752,
+ 35340 => 35751,
+ 35349 => 35754,
+ 35338 => 35759,
+ 35351 => 25176,
+ 35347 => 35757,
+ 35350 => 35755,
+ 35912 => 23682,
+ 36001 => 36130,
+ 36002 => 36129,
+ 36562 => 36713,
+ 36564 => 36715,
+ 36852 => 22238,
+ 37336 => 38025,
+ 37341 => 38024,
+ 37335 => 38026,
+ 37337 => 38027,
+ 38275 => 38378,
+ 38499 => 38453,
+ 38493 => 38485,
+ 38488 => 38473,
+ 38494 => 21319,
+ 38587 => 21482,
+ 39138 => 39269,
+ 39340 => 39532,
+ 39717 => 26007,
+ 20094 => 24178,
+ 20602 => 21681,
+ 20605 => 20266,
+ 20553 => 20255,
+ 20597 => 20390,
+ 20596 => 20391,
+ 21209 => 21153,
+ 21205 => 21160,
+ 21312 => 21306,
+ 21443 => 21442,
+ 21854 => 21713,
+ 21839 => 38382,
+ 21816 => 24565,
+ 21859 => 34900,
+ 21847 => 21846,
+ 22283 => 22269,
+ 22533 => 22362,
+ 22538 => 22441,
+ 22519 => 25191,
+ 22816 => 22815,
+ 23105 => 23044,
+ 23142 => 22919,
+ 23560 => 19987,
+ 23559 => 23558,
+ 23644 => 23625,
+ 23842 => 23781,
+ 23825 => 26118,
+ 23833 => 20177,
+ 23847 => 23913,
+ 23831 => 23703,
+ 24118 => 24102,
+ 24115 => 24080,
+ 24373 => 24352,
+ 24375 => 24378,
+ 24427 => 38613,
+ 24478 => 20174,
+ 24480 => 24469,
+ 24765 => 20932,
+ 24757 => 24581,
+ 25458 => 21367,
+ 25457 => 25384,
+ 25475 => 25195,
+ 25499 => 25346,
+ 25451 => 25194,
+ 25476 => 25249,
+ 25497 => 25379,
+ 25505 => 37319,
+ 25448 => 33293,
+ 25943 => 36133,
+ 21855 => 21551,
+ 25944 => 21465,
+ 26028 => 26025,
+ 26205 => 26172,
+ 21207 => 21206,
+ 26751 => 26438,
+ 26820 => 24323,
+ 26772 => 26624,
+ 26781 => 26465,
+ 26783 => 26541,
+ 27578 => 26432,
+ 27691 => 27682,
+ 28092 => 20937,
+ 28154 => 27973,
+ 28149 => 28170,
+ 28114 => 20932,
+ 28122 => 27882,
+ 28138 => 27814,
+ 28136 => 20928,
+ 29309 => 29301,
+ 29465 => 29424,
+ 29694 => 29616,
+ 29986 => 20135,
+ 30050 => 27605,
+ 30064 => 24322,
+ 30526 => 20247,
+ 30787 => 26417,
+ 32070 => 32458,
+ 32067 => 24358,
+ 32113 => 32479,
+ 32046 => 25166,
+ 32057 => 32461,
+ 32060 => 32459,
+ 32064 => 32460,
+ 32048 => 32454,
+ 32051 => 32453,
+ 32068 => 32452,
+ 32066 => 32456,
+ 32050 => 32449,
+ 32049 => 32450,
+ 32573 => 38069,
+ 32722 => 20064,
+ 33059 => 21767,
+ 33067 => 33073,
+ 33065 => 20462,
+ 33698 => 33626,
+ 33686 => 33550,
+ 33674 => 24196,
+ 33703 => 33483,
+ 34389 => 22788,
+ 34899 => 26415,
+ 34974 => 34926,
+ 35219 => 35269,
+ 35215 => 35268,
+ 35370 => 35775,
+ 35357 => 35766,
+ 35363 => 35776,
+ 35365 => 35767,
+ 35377 => 35768,
+ 35373 => 35774,
+ 35359 => 35772,
+ 35355 => 35769,
+ 35362 => 27427,
+ 36009 => 36137,
+ 36012 => 36131,
+ 36011 => 36143,
+ 36008 => 36135,
+ 36010 => 36138,
+ 36007 => 36139,
+ 36571 => 36717,
+ 36575 => 36719,
+ 36889 => 36825,
+ 36899 => 36830,
+ 36885 => 24452,
+ 37365 => 38039,
+ 37350 => 25187,
+ 37347 => 38035,
+ 37351 => 38031,
+ 37353 => 38034,
+ 38281 => 38381,
+ 38515 => 38472,
+ 38520 => 38470,
+ 38512 => 38452,
+ 38914 => 39030,
+ 38915 => 39031,
+ 39770 => 40060,
+ 40165 => 40479,
+ 40565 => 21348,
+ 40613 => 40614,
+ 20642 => 23478,
+ 20633 => 22791,
+ 20625 => 26480,
+ 20630 => 20263,
+ 20632 => 20254,
+ 20634 => 25928,
+ 20977 => 20975,
+ 21108 => 21056,
+ 21109 => 21019,
+ 21214 => 21171,
+ 21213 => 32988,
+ 21211 => 21195,
+ 21930 => 20007,
+ 21934 => 21333,
+ 21938 => 21727,
+ 21914 => 21796,
+ 21932 => 20052,
+ 21931 => 21507,
+ 22285 => 22260,
+ 22575 => 23591,
+ 22580 => 22330,
+ 22577 => 25253,
+ 22557 => 22490,
+ 22778 => 22774,
+ 23207 => 23090,
+ 23563 => 23547,
+ 23888 => 23706,
+ 24128 => 24103,
+ 24131 => 24079,
+ 24190 => 20960,
+ 24257 => 21397,
+ 24258 => 21410,
+ 24489 => 22797,
+ 24801 => 24694,
+ 24758 => 38391,
+ 24860 => 24812,
+ 24827 => 24699,
+ 24817 => 24700,
+ 25536 => 25315,
+ 25582 => 25381,
+ 25563 => 25442,
+ 25562 => 25196,
+ 25593 => 32972,
+ 26839 => 26531,
+ 26847 => 26635,
+ 26855 => 26632,
+ 26866 => 26646,
+ 27453 => 38054,
+ 27544 => 27531,
+ 27580 => 22771,
+ 27692 => 27689,
+ 28263 => 28044,
+ 28234 => 20945,
+ 28187 => 20943,
+ 28198 => 28065,
+ 28271 => 27748,
+ 28204 => 27979,
+ 28222 => 27985,
+ 28185 => 28067,
+ 28961 => 26080,
+ 29494 => 29369,
+ 29754 => 29648,
+ 29990 => 33487,
+ 30059 => 30011,
+ 30169 => 30153,
+ 30176 => 37240,
+ 30332 => 21457,
+ 30428 => 30423,
+ 30543 => 22256,
+ 30831 => 30746,
+ 31240 => 31174,
+ 31237 => 31246,
+ 31558 => 31508,
+ 31565 => 31499,
+ 32094 => 32478,
+ 32080 => 32467,
+ 32104 => 32466,
+ 32085 => 32477,
+ 32114 => 19997,
+ 32097 => 32476,
+ 32102 => 32473,
+ 32098 => 32474,
+ 32112 => 32470,
+ 32115 => 32475,
+ 32901 => 32899,
+ 33102 => 32958,
+ 33081 => 32960,
+ 33784 => 28895,
+ 33775 => 21326,
+ 33780 => 24245,
+ 33879 => 30528,
+ 33802 => 33713,
+ 33799 => 33484,
+ 34395 => 34394,
+ 35222 => 35270,
+ 35387 => 27880,
+ 35424 => 21647,
+ 35413 => 35780,
+ 35422 => 35789,
+ 35388 => 35777,
+ 35393 => 35778,
+ 35412 => 35791,
+ 35419 => 35781,
+ 35408 => 35784,
+ 35398 => 35787,
+ 35380 => 35785,
+ 35386 => 35786,
+ 35382 => 35779,
+ 36015 => 36142,
+ 36028 => 36148,
+ 36019 => 36144,
+ 36029 => 36155,
+ 36033 => 36146,
+ 36027 => 36153,
+ 36032 => 36154,
+ 36020 => 36149,
+ 36023 => 20080,
+ 36022 => 36140,
+ 36031 => 36152,
+ 36024 => 36151,
+ 36603 => 36722,
+ 36600 => 36724,
+ 36604 => 36726,
+ 36913 => 21608,
+ 36914 => 36827,
+ 37109 => 37038,
+ 37129 => 20065,
+ 37396 => 38046,
+ 37397 => 38062,
+ 37411 => 38041,
+ 37385 => 38048,
+ 37406 => 38055,
+ 37389 => 38045,
+ 37392 => 38052,
+ 37393 => 38051,
+ 38292 => 38389,
+ 38287 => 38384,
+ 38283 => 24320,
+ 38289 => 38386,
+ 38291 => 38388,
+ 38290 => 38386,
+ 38286 => 38387,
+ 38538 => 38431,
+ 38542 => 38454,
+ 38525 => 38451,
+ 38532 => 22564,
+ 38642 => 20113,
+ 38860 => 38887,
+ 38917 => 39033,
+ 38918 => 39034,
+ 38920 => 39035,
+ 39146 => 39274,
+ 39151 => 39277,
+ 39145 => 39272,
+ 39154 => 39278,
+ 39149 => 39276,
+ 39342 => 20911,
+ 39341 => 39533,
+ 40643 => 40644,
+ 20098 => 20081,
+ 20653 => 20323,
+ 20661 => 20538,
+ 20659 => 20256,
+ 20677 => 20165,
+ 20670 => 20542,
+ 20663 => 20260,
+ 20655 => 20588,
+ 20679 => 25134,
+ 21111 => 38130,
+ 21222 => 21119,
+ 21218 => 21183,
+ 21219 => 31215,
+ 21295 => 27719,
+ 21966 => 21527,
+ 21959 => 21868,
+ 21978 => 21596,
+ 21958 => 21595,
+ 22290 => 22253,
+ 22291 => 22278,
+ 22615 => 28034,
+ 22618 => 20898,
+ 22602 => 22359,
+ 22626 => 22366,
+ 22610 => 22488,
+ 22603 => 33556,
+ 22887 => 22885,
+ 23229 => 22920,
+ 23228 => 23210,
+ 24185 => 24178,
+ 24264 => 21414,
+ 24338 => 24337,
+ 24409 => 27719,
+ 24492 => 24439,
+ 24859 => 29233,
+ 24900 => 26647,
+ 24909 => 24864,
+ 24894 => 24574,
+ 24884 => 24582,
+ 24887 => 24698,
+ 25662 => 27048,
+ 25613 => 25439,
+ 25654 => 25250,
+ 25622 => 25671,
+ 25623 => 25443,
+ 25606 => 26500,
+ 26249 => 26198,
+ 26248 => 26197,
+ 26264 => 26104,
+ 26371 => 20250,
+ 26989 => 19994,
+ 26997 => 26497,
+ 26954 => 26472,
+ 26984 => 26722,
+ 26963 => 26539,
+ 27506 => 23681,
+ 27584 => 27585,
+ 28317 => 27807,
+ 28357 => 28781,
+ 28348 => 28287,
+ 28331 => 28201,
+ 28310 => 20934,
+ 28356 => 27815,
+ 29017 => 28895,
+ 29033 => 28902,
+ 29001 => 28860,
+ 29036 => 28800,
+ 29029 => 28949,
+ 29014 => 26262,
+ 29242 => 29239,
+ 29509 => 29422,
+ 29807 => 29701,
+ 29759 => 29682,
+ 30070 => 24403,
+ 30194 => 40635,
+ 30202 => 30201,
+ 30430 => 30415,
+ 30558 => 30544,
+ 30556 => 30529,
+ 31103 => 31108,
+ 33836 => 19975,
+ 31260 => 26865,
+ 31263 => 31104,
+ 31680 => 33410,
+ 31591 => 31509,
+ 31925 => 31908,
+ 32147 => 32463,
+ 32121 => 32482,
+ 32145 => 25414,
+ 32129 => 32465,
+ 32143 => 32485,
+ 32091 => 32486,
+ 32681 => 20041,
+ 32680 => 32673,
+ 32854 => 22307,
+ 33144 => 32928,
+ 33139 => 33050,
+ 33131 => 32959,
+ 33126 => 33041,
+ 33911 => 33636,
+ 33894 => 33479,
+ 33865 => 21494,
+ 33845 => 33716,
+ 34396 => 34383,
+ 34399 => 21495,
+ 34555 => 34581,
+ 34566 => 34476,
+ 35036 => 34917,
+ 35037 => 35013,
+ 35041 => 37324,
+ 35018 => 34949,
+ 35228 => 30522,
+ 35435 => 35815,
+ 35442 => 35813,
+ 35443 => 35814,
+ 35430 => 35797,
+ 35433 => 35799,
+ 35440 => 35800,
+ 35463 => 22840,
+ 35452 => 35801,
+ 35427 => 35811,
+ 35488 => 35802,
+ 35441 => 35805,
+ 35461 => 35803,
+ 35437 => 35809,
+ 35426 => 35810,
+ 35438 => 35808,
+ 35436 => 35807,
+ 36042 => 36156,
+ 36039 => 36164,
+ 36040 => 36158,
+ 36036 => 36159,
+ 36018 => 36160,
+ 36035 => 36161,
+ 36034 => 36162,
+ 36037 => 36165,
+ 36321 => 36857,
+ 36611 => 36739,
+ 36617 => 36733,
+ 36606 => 36732,
+ 36618 => 36734,
+ 36786 => 20892,
+ 36939 => 36816,
+ 36938 => 28216,
+ 36948 => 36798,
+ 36949 => 36829,
+ 36942 => 36807,
+ 37138 => 37049,
+ 37431 => 38068,
+ 37463 => 38067,
+ 37432 => 38073,
+ 37437 => 38072,
+ 37440 => 38078,
+ 37438 => 38080,
+ 37467 => 38085,
+ 37451 => 21032,
+ 37476 => 38057,
+ 37457 => 38082,
+ 37428 => 38083,
+ 37449 => 38089,
+ 37453 => 38091,
+ 37445 => 24040,
+ 37433 => 38093,
+ 37439 => 38079,
+ 37466 => 38086,
+ 38296 => 38392,
+ 38549 => 38504,
+ 38603 => 38589,
+ 38651 => 30005,
+ 38928 => 39044,
+ 38929 => 39037,
+ 38931 => 39039,
+ 38922 => 39036,
+ 38930 => 39041,
+ 38924 => 39042,
+ 39164 => 39282,
+ 39156 => 39284,
+ 39165 => 39281,
+ 39166 => 39280,
+ 39347 => 39536,
+ 39345 => 39534,
+ 39348 => 39535,
+ 40169 => 40480,
+ 20718 => 31461,
+ 20709 => 20389,
+ 20693 => 20166,
+ 20689 => 20392,
+ 20721 => 38599,
+ 21123 => 21010,
+ 21297 => 21294,
+ 21421 => 21388,
+ 22039 => 23581,
+ 22036 => 21589,
+ 22022 => 21497,
+ 22029 => 21949,
+ 22038 => 21863,
+ 22006 => 21716,
+ 22296 => 22242,
+ 22294 => 22270,
+ 22645 => 23576,
+ 22666 => 22443,
+ 22649 => 22545,
+ 22781 => 23551,
+ 22821 => 20249,
+ 22818 => 26790,
+ 22890 => 22842,
+ 22889 => 22849,
+ 23255 => 22954,
+ 23527 => 23425,
+ 23526 => 23454,
+ 23522 => 23517,
+ 23565 => 23545,
+ 23650 => 23649,
+ 23940 => 23853,
+ 23943 => 23702,
+ 24163 => 24065,
+
+ 24151 => 24124,
+ 24390 => 21035,
+ 24505 => 24443,
+ 24903 => 27575,
+ 24907 => 24577,
+ 24931 => 24815,
+ 24927 => 24696,
+ 24922 => 24813,
+ 24920 => 24808,
+ 25695 => 25602,
+ 25722 => 25240,
+ 25681 => 25524,
+ 25723 => 25530,
+ 26274 => 30021,
+ 27054 => 33635,
+ 27091 => 26464,
+ 27083 => 26500,
+ 27085 => 26538,
+ 27046 => 24178,
+ 27699 => 27698,
+ 28414 => 28378,
+ 28460 => 28173,
+ 28450 => 27721,
+ 28415 => 28385,
+ 28399 => 28382,
+ 28472 => 28176,
+ 28466 => 28072,
+ 28451 => 28063,
+ 28396 => 27818,
+ 28417 => 28180,
+ 28402 => 28183,
+ 28364 => 28068,
+ 28407 => 21348,
+ 29074 => 33639,
+ 29246 => 23572,
+ 29334 => 33638,
+ 29508 => 29425,
+ 29796 => 29814,
+ 29795 => 29712,
+ 29802 => 29595,
+ 30247 => 30111,
+ 30221 => 30113,
+ 30219 => 30127,
+ 30217 => 24840,
+ 30227 => 30186,
+ 30433 => 23613,
+ 30435 => 30417,
+ 30889 => 30805,
+ 31118 => 31087,
+ 31117 => 31096,
+ 31278 => 31181,
+ 31281 => 31216,
+ 31402 => 27964,
+ 31401 => 31389,
+ 31627 => 31546,
+ 31645 => 38067,
+ 31631 => 31581,
+ 32187 => 32509,
+ 32176 => 32510,
+ 32156 => 32508,
+ 32189 => 32496,
+ 32190 => 32491,
+ 32160 => 32511,
+ 32202 => 32039,
+ 32180 => 32512,
+ 32178 => 32593,
+ 32177 => 32434,
+ 32186 => 32494,
+ 32162 => 32504,
+ 32191 => 32501,
+ 32181 => 24425,
+ 32184 => 32438,
+ 32173 => 32500,
+ 32210 => 32490,
+ 32199 => 32513,
+ 32172 => 32502,
+ 32624 => 32602,
+ 32862 => 38395,
+ 33274 => 21488,
+ 33287 => 19982,
+ 33990 => 24109,
+ 33950 => 33669,
+ 33995 => 30422,
+ 33984 => 33642,
+ 33936 => 25628,
+ 33980 => 33485,
+ 34645 => 34432,
+ 35069 => 21046,
+ 35494 => 35829,
+ 35468 => 24535,
+ 35486 => 35821,
+ 35491 => 35820,
+ 35469 => 35748,
+ 35489 => 35819,
+ 35492 => 35823,
+ 35498 => 35828,
+ 35493 => 35824,
+ 35496 => 35826,
+ 35480 => 35825,
+ 35473 => 35827,
+ 35482 => 35822,
+ 35981 => 29432,
+ 36051 => 23486,
+ 36049 => 36168,
+ 36050 => 36170,
+ 36249 => 36213,
+ 36245 => 36214,
+ 36628 => 36741,
+ 36626 => 36740,
+ 36629 => 36731,
+ 36627 => 25405,
+ 36960 => 36828,
+ 36956 => 36874,
+ 36953 => 36965,
+ 36958 => 36882,
+ 37496 => 38128,
+ 37504 => 38134,
+ 37509 => 38108,
+ 37528 => 38125,
+ 37526 => 38114,
+ 37499 => 38124,
+ 37523 => 38120,
+ 37532 => 34900,
+ 37544 => 38133,
+ 37521 => 38115,
+ 38305 => 38402,
+ 38312 => 38394,
+ 38313 => 38397,
+ 38307 => 38401,
+ 38309 => 38400,
+ 38308 => 21512,
+ 38555 => 38469,
+ 38935 => 39047,
+ 38936 => 39046,
+ 39087 => 39122,
+ 39089 => 21488,
+ 39171 => 39290,
+ 39173 => 39292,
+ 39180 => 39285,
+ 39177 => 39287,
+ 39361 => 39539,
+ 39599 => 32942,
+ 40180 => 40483,
+ 40182 => 40482,
+ 40179 => 20964,
+ 40636 => 20040,
+ 40778 => 40784,
+ 20740 => 20159,
+ 20736 => 20202,
+ 20729 => 20215,
+ 20738 => 20396,
+ 20744 => 20393,
+ 20745 => 20461,
+ 20741 => 24403,
+ 20956 => 20955,
+ 21127 => 21095,
+ 21129 => 21016,
+ 21133 => 21073,
+ 21130 => 21053,
+ 21426 => 21385,
+ 22062 => 21792,
+ 22057 => 21719,
+ 22099 => 22040,
+ 22132 => 21943,
+ 22063 => 21880,
+ 22064 => 21501,
+ 22707 => 22367,
+ 22684 => 22368,
+ 22702 => 22549,
+ 23291 => 23092,
+ 23307 => 23157,
+ 23285 => 22953,
+ 23308 => 23047,
+ 23304 => 23046,
+ 23532 => 23485,
+ 23529 => 23457,
+ 23531 => 20889,
+ 23652 => 23618,
+ 23956 => 23898,
+ 24159 => 24092,
+ 24290 => 24223,
+ 24282 => 21416,
+ 24287 => 24217,
+ 24285 => 21422,
+ 24291 => 24191,
+ 24288 => 21378,
+ 24392 => 24377,
+ 24501 => 24449,
+ 24950 => 24198,
+ 24942 => 34385,
+ 24962 => 24551,
+ 24956 => 25114,
+ 24939 => 24578,
+ 24958 => 27442,
+ 24976 => 24604,
+ 25003 => 24751,
+ 24986 => 24814,
+ 24996 => 24868,
+ 25006 => 24579,
+ 25711 => 25370,
+ 25778 => 25169,
+ 25736 => 25438,
+ 25744 => 25745,
+ 25765 => 25320,
+ 25747 => 25376,
+ 25771 => 25242,
+ 25754 => 25467,
+ 25779 => 25599,
+ 25973 => 25932,
+ 25976 => 25968,
+ 26283 => 26242,
+ 26289 => 26165,
+ 27171 => 26679,
+ 27112 => 26881,
+ 27137 => 26729,
+ 27166 => 26530,
+ 27161 => 26631,
+ 27155 => 27004,
+ 27123 => 26728,
+ 27138 => 20048,
+ 27141 => 26526,
+ 27153 => 26753,
+ 27472 => 27431,
+ 27470 => 21497,
+ 27556 => 27527,
+ 27590 => 27572,
+ 28479 => 27974,
+ 28497 => 27900,
+ 28500 => 27905,
+ 28550 => 27975,
+ 28507 => 28508,
+ 28528 => 28291,
+ 28516 => 28070,
+ 28567 => 28071,
+ 28527 => 27988,
+ 28511 => 27899,
+ 29105 => 28909,
+ 29339 => 29286,
+ 29518 => 22870,
+ 29801 => 33721,
+ 30241 => 30126,
+ 30362 => 30353,
+ 30394 => 30385,
+ 30436 => 30424,
+ 30599 => 30511,
+ 30906 => 30830,
+ 30908 => 30721,
+ 31296 => 35895,
+ 31407 => 31377,
+ 31406 => 31351,
+ 31684 => 33539,
+ 32224 => 32532,
+ 32244 => 32451,
+ 32239 => 32428,
+ 32251 => 33268,
+ 32216 => 32516,
+ 32236 => 32517,
+ 32221 => 32521,
+ 32232 => 32534,
+ 32227 => 32536,
+ 32218 => 32447,
+ 32222 => 32526,
+ 32233 => 32531,
+ 32158 => 32525,
+ 32217 => 32514,
+ 32242 => 32520,
+ 32249 => 32519,
+ 32629 => 39554,
+ 32631 => 32610,
+ 33184 => 33014,
+ 33178 => 32932,
+ 34030 => 33714,
+ 34093 => 33643,
+ 34083 => 33931,
+ 34068 => 21340,
+ 34085 => 33905,
+ 34054 => 33777,
+ 34662 => 34430,
+ 34680 => 34583,
+ 34664 => 34417,
+ 34907 => 21355,
+ 34909 => 20914,
+ 35079 => 22797,
+ 35516 => 35850,
+ 35538 => 35845,
+ 35527 => 35848,
+ 35524 => 35846,
+ 35477 => 35806,
+ 35531 => 35831,
+ 35576 => 35832,
+ 35506 => 35838,
+ 35529 => 35839,
+ 35522 => 35844,
+ 35519 => 35843,
+ 35504 => 35841,
+ 35542 => 35770,
+ 35533 => 35812,
+ 35510 => 35847,
+ 35513 => 35837,
+ 35547 => 35840,
+ 35918 => 31446,
+ 35948 => 29482,
+ 36064 => 36180,
+ 36062 => 36175,
+ 36070 => 36171,
+ 36068 => 36145,
+ 36076 => 36134,
+ 36077 => 36172,
+ 36066 => 36132,
+ 36067 => 21334,
+ 36060 => 36176,
+ 36074 => 36136,
+ 36065 => 36179,
+ 36368 => 36341,
+ 36385 => 34615,
+ 36637 => 36745,
+ 36635 => 36742,
+ 36639 => 36749,
+ 36649 => 36744,
+ 36646 => 36743,
+ 36650 => 36718,
+ 36636 => 36750,
+ 36638 => 36747,
+ 36645 => 36746,
+ 36969 => 36866,
+ 36983 => 36801,
+ 37168 => 37051,
+ 37165 => 37073,
+ 37159 => 37011,
+ 37251 => 33100,
+ 37573 => 38156,
+ 37563 => 38161,
+ 37559 => 38144,
+ 37610 => 38138,
+ 37548 => 38096,
+ 37604 => 38148,
+ 37569 => 38109,
+ 37555 => 38160,
+ 37564 => 38153,
+ 37586 => 38155,
+ 37575 => 38049,
+ 37616 => 38146,
+ 37554 => 28938,
+ 38317 => 38398,
+ 38321 => 38405,
+ 38799 => 24041,
+ 38945 => 39049,
+ 38955 => 20463,
+ 38940 => 39052,
+ 39091 => 21038,
+ 39178 => 20859,
+ 39187 => 39295,
+ 39186 => 39297,
+ 39192 => 20313,
+ 39389 => 39548,
+ 39376 => 39547,
+ 39391 => 39543,
+ 39387 => 39542,
+ 39377 => 39549,
+ 39381 => 39550,
+ 39378 => 39545,
+ 39385 => 39544,
+ 39662 => 21457,
+ 39719 => 38393,
+ 39799 => 40063,
+ 39791 => 40065,
+ 40198 => 40489,
+ 40201 => 40486,
+ 40617 => 40632,
+ 40786 => 40831,
+ 20760 => 23613,
+ 20756 => 20454,
+ 20752 => 20647,
+ 20757 => 20394,
+ 20906 => 24130,
+ 21137 => 21058,
+ 21235 => 21195,
+ 22137 => 24403,
+ 22136 => 21544,
+ 22117 => 21725,
+ 22127 => 22003,
+ 22718 => 22438,
+ 22727 => 22363,
+ 22894 => 22859,
+ 23325 => 34949,
+ 23416 => 23398,
+ 23566 => 23548,
+ 24394 => 24378,
+ 25010 => 23466,
+ 24977 => 20973,
+ 24970 => 24811,
+ 25037 => 25044,
+ 25014 => 24518,
+ 25136 => 25112,
+ 25793 => 25317,
+ 25803 => 25377,
+ 25787 => 25374,
+ 25818 => 25454,
+ 25796 => 25523,
+ 25799 => 25321,
+ 25791 => 25441,
+ 25812 => 25285,
+ 25790 => 25373,
+ 26310 => 21382,
+ 26313 => 26195,
+ 26308 => 26196,
+ 26311 => 26137,
+ 26296 => 20102,
+ 27192 => 26420,
+ 27194 => 26726,
+ 27243 => 27178,
+ 27193 => 26641,
+ 27234 => 26925,
+ 27211 => 26725,
+ 27231 => 26426,
+ 27208 => 26721,
+ 27511 => 21382,
+ 28593 => 28096,
+ 28611 => 27987,
+ 28580 => 27901,
+ 28609 => 27978,
+ 28582 => 28394,
+ 28576 => 28177,
+ 29118 => 28861,
+ 29129 => 28822,
+ 29138 => 28903,
+ 29128 => 28783,
+ 29145 => 28907,
+ 29148 => 28950,
+ 29124 => 28976,
+ 29544 => 29420,
+ 29859 => 29585,
+ 29964 => 29935,
+ 30266 => 30232,
+ 30439 => 21346,
+ 30622 => 30610,
+ 30938 => 30742,
+ 30951 => 30875,
+ 31142 => 24481,
+ 31309 => 31215,
+ 31310 => 39062,
+ 31308 => 31267,
+ 31418 => 31397,
+ 31761 => 34001,
+ 31689 => 31569,
+ 31716 => 31491,
+ 31721 => 31579,
+ 32266 => 32546,
+ 32273 => 32547,
+ 32264 => 33830,
+ 32283 => 32538,
+ 32291 => 21439,
+ 32286 => 32543,
+ 32285 => 32540,
+ 32265 => 32537,
+ 32272 => 32457,
+ 33193 => 33147,
+ 33288 => 20852,
+ 33369 => 33329,
+ 34153 => 33633,
+ 34157 => 33831,
+ 34154 => 33436,
+ 34718 => 34434,
+ 34722 => 33828,
+ 35122 => 35044,
+ 35242 => 20146,
+ 35238 => 35278,
+ 35558 => 35867,
+ 35578 => 35866,
+ 35563 => 35855,
+ 35569 => 35763,
+ 35584 => 35851,
+ 35548 => 35853,
+ 35559 => 35856,
+ 35566 => 21672,
+ 35582 => 35834,
+ 35585 => 35858,
+ 35586 => 35859,
+ 35575 => 35773,
+ 35565 => 35861,
+ 35571 => 35865,
+ 35574 => 35852,
+ 35580 => 35862,
+ 35987 => 29483,
+ 36084 => 36182,
+ 36404 => 36362,
+ 36667 => 36752,
+ 36655 => 36753,
+ 36664 => 36755,
+ 36659 => 36751,
+ 36774 => 21150,
+ 36984 => 36873,
+ 36978 => 36831,
+ 36988 => 36797,
+ 36986 => 36951,
+ 37172 => 37050,
+ 37664 => 38189,
+ 37686 => 34920,
+ 37624 => 38191,
+ 37683 => 38192,
+ 37679 => 38169,
+ 37666 => 38065,
+ 37628 => 38050,
+ 37675 => 38177,
+ 37636 => 24405,
+ 37658 => 38126,
+ 37648 => 38181,
+ 37670 => 38182,
+ 37665 => 38172,
+ 37653 => 38175,
+ 37678 => 38178,
+ 37657 => 38193,
+ 38331 => 38414,
+ 38568 => 38543,
+ 38570 => 38505,
+ 38673 => 27838,
+ 38748 => 38745,
+ 38758 => 33148,
+ 38960 => 39050,
+ 38968 => 39048,
+ 38971 => 39057,
+ 38967 => 39060,
+ 38957 => 22836,
+ 38969 => 39059,
+ 38948 => 39056,
+ 39208 => 39302,
+ 39198 => 39279,
+ 39195 => 39300,
+ 39201 => 39301,
+ 39194 => 32948,
+ 39405 => 39559,
+ 39394 => 39560,
+ 39409 => 39558,
+ 39720 => 21700,
+ 39825 => 40077,
+ 40213 => 40501,
+ 40227 => 40490,
+ 40230 => 40495,
+ 40232 => 40493,
+ 40210 => 40496,
+ 40219 => 40499,
+ 40845 => 40857,
+ 40860 => 40863,
+ 20778 => 20248,
+ 20767 => 20607,
+ 20786 => 20648,
+ 21237 => 21169,
+ 22144 => 21659,
+ 22160 => 23581,
+ 22151 => 21523,
+ 22739 => 21387,
+ 23344 => 23156,
+ 23338 => 23252,
+ 23332 => 23351,
+ 23607 => 23604,
+ 23656 => 23654,
+ 23996 => 23679,
+ 23994 => 23725,
+ 23997 => 23731,
+ 23992 => 23896,
+ 24171 => 24110,
+ 24396 => 24357,
+ 25033 => 24212,
+ 25031 => 24691,
+ 25138 => 25103,
+ 25802 => 20987,
+ 25824 => 25380,
+ 25840 => 25319,
+ 25836 => 25311,
+ 25841 => 25601,
+ 25986 => 25947,
+ 25987 => 27609,
+ 26326 => 26279,
+ 27284 => 26723,
+ 27298 => 26816,
+ 27292 => 26727,
+ 27355 => 26633,
+ 27299 => 27183,
+ 27566 => 27539,
+ 27656 => 27617,
+ 28632 => 27870,
+ 28657 => 28392,
+ 28639 => 27982,
+ 28635 => 33945,
+ 28644 => 28059,
+ 28651 => 28389,
+ 28544 => 28073,
+ 28652 => 27994,
+ 28629 => 28287,
+ 28656 => 28493,
+ 29151 => 33829,
+ 29158 => 28799,
+ 29165 => 28891,
+ 29164 => 27585,
+ 29172 => 28905,
+ 29254 => 22681,
+ 29552 => 29406,
+ 29554 => 33719,
+ 29872 => 29615,
+ 29862 => 29815,
+ 30278 => 30184,
+ 30274 => 30103,
+ 30442 => 33633,
+ 30637 => 20102,
+ 30703 => 30699,
+ 30959 => 30710,
+ 31146 => 31109,
+ 31757 => 31699,
+ 31712 => 31601,
+ 31966 => 31914,
+ 31970 => 27169,
+ 31965 => 31937,
+ 32302 => 32553,
+ 32318 => 32489,
+ 32326 => 32554,
+ 32311 => 32533,
+ 32306 => 32551,
+ 32323 => 32503,
+ 32299 => 32541,
+ 32317 => 24635,
+ 32305 => 32437,
+ 32325 => 32555,
+ 32308 => 32420,
+ 32313 => 32549,
+ 32328 => 35137,
+ 32309 => 32550,
+ 32303 => 28436,
+ 32882 => 22768,
+ 32880 => 32874,
+ 32879 => 32852,
+ 32883 => 32824,
+ 33215 => 33043,
+ 33213 => 32966,
+ 33225 => 33080,
+ 33214 => 33037,
+ 33256 => 20020,
+ 33289 => 20030,
+ 33393 => 33392,
+ 34193 => 23004,
+ 34196 => 34103,
+ 34186 => 34015,
+ 34407 => 20111,
+ 34747 => 34684,
+ 34760 => 34632,
+ 35131 => 20149,
+ 35128 => 35099,
+ 35244 => 35274,
+ 35598 => 35868,
+ 35607 => 35876,
+ 35609 => 35878,
+ 35611 => 35762,
+ 35594 => 35854,
+ 35616 => 35875,
+ 35613 => 35874,
+ 35588 => 35466,
+ 35600 => 35879,
+ 35903 => 28330,
+ 36090 => 36186,
+ 36093 => 36187,
+ 36092 => 36141,
+ 36088 => 21097,
+ 36091 => 36185,
+ 36264 => 36235,
+ 36676 => 36758,
+ 36670 => 36759,
+ 36674 => 27586,
+ 36677 => 36757,
+ 36671 => 33286,
+ 36996 => 36824,
+ 36993 => 36808,
+ 37283 => 31958,
+ 37278 => 37213,
+ 37276 => 19985,
+ 37709 => 38208,
+ 37762 => 38209,
+ 37672 => 38170,
+ 37749 => 38190,
+ 37706 => 38142,
+ 37733 => 38194,
+ 37707 => 38149,
+ 37656 => 38180,
+ 37758 => 38047,
+ 37740 => 38201,
+ 37723 => 38203,
+ 37744 => 38206,
+ 37722 => 38038,
+ 37716 => 38199,
+ 38346 => 38420,
+ 38347 => 38421,
+ 38348 => 38417,
+ 38344 => 38385,
+ 38342 => 26495,
+ 38577 => 38544,
+ 38584 => 38582,
+ 38614 => 34429,
+ 38867 => 38889,
+ 38982 => 39063,
+ 39094 => 39123,
+ 39221 => 21890,
+ 39425 => 39563,
+ 39423 => 39567,
+ 39854 => 40092,
+ 39851 => 40091,
+ 39850 => 40084,
+ 39853 => 40081,
+ 40251 => 40511,
+ 40255 => 40509,
+ 40670 => 28857,
+ 40779 => 25995,
+ 21474 => 19995,
+ 22165 => 22108,
+ 22190 => 21521,
+ 22745 => 22329,
+ 22744 => 22418,
+ 23352 => 23158,
+ 25059 => 25041,
+ 25844 => 25193,
+ 25842 => 25527,
+ 25854 => 25200,
+ 25862 => 25781,
+ 25850 => 25670,
+ 25851 => 25822,
+ 25847 => 25783,
+ 26039 => 26029,
+ 27315 => 27103,
+ 27331 => 26588,
+ 27323 => 27099,
+ 27320 => 26592,
+ 27330 => 26873,
+ 27310 => 26812,
+ 27311 => 21488,
+ 27487 => 27428,
+ 27512 => 24402,
+ 27567 => 27553,
+ 28681 => 27899,
+ 28683 => 27784,
+ 28670 => 28388,
+ 28678 => 28174,
+ 28666 => 28293,
+ 28687 => 27983,
+ 29179 => 29071,
+ 29180 => 28908,
+ 29182 => 28952,
+ 29559 => 29367,
+ 29557 => 29454,
+ 29973 => 29934,
+ 30296 => 30112,
+ 30290 => 24840,
+ 30652 => 30545,
+ 30990 => 30784,
+ 31150 => 31036,
+ 31329 => 31313,
+ 31330 => 31229,
+ 31328 => 31230,
+ 31428 => 31388,
+ 31429 => 31373,
+ 31787 => 31659,
+ 31774 => 31658,
+ 31779 => 31697,
+ 31777 => 31616,
+ 31975 => 31918,
+ 32340 => 32455,
+ 32341 => 32558,
+ 32350 => 32469,
+ 32346 => 32557,
+ 32353 => 32483,
+ 32338 => 32559,
+ 32345 => 32763,
+ 32584 => 22363,
+ 32761 => 32728,
+ 32887 => 32844,
+ 32886 => 32834,
+ 33229 => 33040,
+ 33231 => 33169,
+ 33290 => 26087,
+ 34217 => 33832,
+ 34253 => 34013,
+ 34249 => 20511,
+ 34234 => 33632,
+ 34214 => 33616,
+ 34799 => 34546,
+ 34796 => 34633,
+ 34802 => 34411,
+ 35250 => 35280,
+ 35316 => 35294,
+ 35624 => 35871,
+ 35641 => 35880,
+ 35628 => 35884,
+ 35627 => 35882,
+ 35920 => 20016,
+ 36101 => 36184,
+ 36451 => 36434,
+ 36452 => 36394,
+ 36447 => 36857,
+ 36437 => 36344,
+ 36544 => 36527,
+ 36681 => 36716,
+ 36685 => 36761,
+ 36999 => 36841,
+ 37291 => 21307,
+ 37292 => 37233,
+ 37328 => 21400,
+ 37780 => 38229,
+ 37770 => 38225,
+ 37782 => 38145,
+ 37794 => 38056,
+ 37811 => 38221,
+ 37806 => 38215,
+ 37804 => 38224,
+ 37808 => 38226,
+ 37784 => 38217,
+ 37786 => 38180,
+ 37783 => 26538,
+ 38356 => 38422,
+ 38358 => 38383,
+ 38352 => 38423,
+ 38357 => 38425,
+ 38626 => 31163,
+ 38620 => 26434,
+ 38617 => 21452,
+ 38619 => 38607,
+ 38622 => 40481,
+ 38692 => 28316,
+ 38822 => 31179,
+ 38989 => 39069,
+ 38991 => 39068,
+ 38988 => 39064,
+ 38990 => 39066,
+ 38995 => 39067,
+ 39098 => 25196,
+ 39230 => 39311,
+ 39231 => 39306,
+ 39229 => 39304,
+ 39438 => 39569,
+ 39686 => 26494,
+ 39758 => 39753,
+ 39882 => 40104,
+ 39881 => 40100,
+ 39933 => 40107,
+ 39880 => 40102,
+ 39872 => 40103,
+ 40273 => 40515,
+ 40285 => 40517,
+ 40288 => 40516,
+ 40725 => 20908,
+ 22181 => 21693,
+ 22750 => 22351,
+ 22751 => 22404,
+ 22754 => 22364,
+ 23541 => 23456,
+ 40848 => 24222,
+ 24300 => 24208,
+ 25074 => 24809,
+ 25079 => 24576,
+ 25078 => 25042,
+ 25871 => 25314,
+ 26336 => 26103,
+ 27365 => 27249,
+ 27357 => 26911,
+ 27354 => 27016,
+ 27347 => 27257,
+ 28703 => 28487,
+ 28712 => 28625,
+ 28701 => 27813,
+ 28693 => 28626,
+ 28696 => 27896,
+ 29197 => 28865,
+ 29272 => 29261,
+ 29346 => 29322,
+ 29560 => 20861,
+ 29562 => 29549,
+ 29885 => 29626,
+ 29898 => 29756,
+ 30087 => 30068,
+ 30303 => 30250,
+ 30305 => 30196,
+ 30663 => 33945,
+ 31001 => 30861,
+ 31153 => 31095,
+ 31339 => 33719,
+ 31337 => 31283,
+ 31806 => 24088,
+ 31805 => 31614,
+ 31799 => 27280,
+ 32363 => 31995,
+ 32365 => 33575,
+ 32377 => 32462,
+ 32361 => 32499,
+ 32362 => 32472,
+ 32645 => 32599,
+ 32371 => 32564,
+ 32694 => 33211,
+ 33240 => 33098,
+ 34269 => 33402,
+ 34282 => 34222,
+ 34277 => 33647,
+ 34295 => 34223,
+ 34811 => 34433,
+ 34821 => 34631,
+ 34829 => 34638,
+ 35168 => 35014,
+ 35158 => 34948,
+ 35649 => 21719,
+ 35676 => 35889,
+ 35672 => 35782,
+ 35657 => 35777,
+ 35674 => 35885,
+ 35662 => 35890,
+ 35663 => 35749,
+ 35654 => 22075,
+ 35673 => 35887,
+ 36104 => 36192,
+ 36106 => 36190,
+ 36474 => 36343,
+ 36692 => 36762,
+ 36686 => 36735,
+ 36781 => 36766,
+ 37002 => 36793,
+ 37297 => 37222,
+ 37857 => 38236,
+ 37841 => 38237,
+ 37855 => 38130,
+ 37827 => 38238,
+ 37832 => 38142,
+ 37852 => 38231,
+ 37853 => 38232,
+ 37858 => 38230,
+ 37837 => 38233,
+ 37848 => 38197,
+ 37860 => 38210,
+ 37847 => 38143,
+ 37864 => 37694,
+ 38364 => 20851,
+ 38580 => 38471,
+ 38627 => 38590,
+ 38695 => 38654,
+ 38876 => 38892,
+ 38907 => 38901,
+ 39006 => 31867,
+ 39000 => 24895,
+ 39003 => 39072,
+ 39100 => 39125,
+ 39237 => 39314,
+ 39241 => 39313,
+ 39446 => 39579,
+ 39449 => 39575,
+ 39693 => 32993,
+ 39912 => 40120,
+ 39911 => 40115,
+ 39894 => 40109,
+ 39899 => 40119,
+ 40329 => 40529,
+ 40289 => 40521,
+ 40306 => 40522,
+ 40298 => 40524,
+ 40300 => 40527,
+ 40599 => 20029,
+ 21240 => 21149,
+ 22184 => 21657,
+ 22198 => 22052,
+ 22196 => 20005,
+ 23363 => 23064,
+ 23542 => 23453,
+ 25080 => 24748,
+ 25082 => 24527,
+ 25876 => 25318,
+ 25881 => 25600,
+ 26407 => 32999,
+ 27372 => 27015,
+ 28734 => 28572,
+ 28720 => 24357,
+ 28722 => 28491,
+ 29200 => 28809,
+ 29563 => 29486,
+ 29903 => 29649,
+ 30306 => 30162,
+ 30309 => 30151,
+ 31014 => 30719,
+ 31018 => 30778,
+ 31020 => 30718,
+ 31019 => 30782,
+ 31431 => 31398,
+ 31478 => 31454,
+ 31820 => 31609,
+ 31811 => 31726,
+ 31984 => 22242,
+ 36782 => 36779,
+ 32381 => 32548,
+ 32380 => 32487,
+ 32588 => 32578,
+ 33242 => 33002,
+ 33382 => 33328,
+ 34297 => 34108,
+ 34298 => 34106,
+ 34310 => 33446,
+ 34315 => 33529,
+ 34311 => 33487,
+ 34314 => 34164,
+ 34836 => 34461,
+ 35172 => 35124,
+ 35258 => 35273,
+ 35320 => 35302,
+ 35696 => 35758,
+ 35695 => 35793,
+ 35679 => 22122,
+ 35691 => 35893,
+ 36111 => 36194,
+ 36109 => 36193,
+ 36489 => 36280,
+ 36482 => 36342,
+ 37323 => 37322,
+ 37912 => 38047,
+ 37891 => 38105,
+ 37885 => 38152,
+ 38369 => 38416,
+ 39108 => 39128,
+ 39250 => 39286,
+ 39249 => 39269,
+ 39467 => 39582,
+ 39472 => 33150,
+ 39479 => 39578,
+ 39955 => 40131,
+ 39949 => 40133,
+ 40569 => 21688,
+ 40629 => 38754,
+ 40680 => 20826,
+ 40799 => 40835,
+ 40803 => 20986,
+ 40801 => 40836,
+ 20791 => 20458,
+ 20792 => 13417,
+ 22209 => 21995,
+ 22208 => 21869,
+ 22210 => 22179,
+ 23660 => 23646,
+ 25084 => 24807,
+ 25086 => 24913,
+ 25885 => 25668,
+ 25884 => 25658,
+ 26005 => 26003,
+ 27387 => 27185,
+ 27396 => 26639,
+ 27386 => 26818,
+ 27570 => 27516,
+ 29211 => 28866,
+ 29351 => 29306,
+ 29908 => 29838,
+ 30313 => 30302,
+ 30675 => 32999,
+ 31824 => 34276,
+ 32399 => 32544,
+ 32396 => 32493,
+ 34327 => 34326,
+ 34349 => 20848,
+ 34330 => 34259,
+ 34851 => 34510,
+ 34847 => 34593,
+ 35178 => 34972,
+ 35180 => 25670,
+ 35261 => 35272,
+ 35700 => 35892,
+ 35703 => 25252,
+ 35709 => 35465,
+ 36115 => 36163,
+ 36490 => 36364,
+ 36493 => 36291,
+ 36491 => 36347,
+ 36703 => 36720,
+ 36783 => 36777,
+ 37934 => 38256,
+ 37939 => 38253,
+ 37941 => 38081,
+ 37946 => 38107,
+ 37944 => 38094,
+ 37938 => 38255,
+ 37931 => 38220,
+ 38370 => 36767,
+ 38911 => 21709,
+ 39015 => 39038,
+ 39013 => 39074,
+ 39255 => 39144,
+ 39493 => 39537,
+ 39491 => 39584,
+ 39488 => 34022,
+ 39486 => 39585,
+ 39631 => 39621,
+ 39981 => 40141,
+ 39973 => 40143,
+ 40367 => 33722,
+ 40372 => 40548,
+ 40386 => 40542,
+ 40796 => 40839,
+ 40806 => 40840,
+ 40807 => 21870,
+ 20796 => 20456,
+ 20795 => 20645,
+ 22216 => 21587,
+ 22217 => 21872,
+ 23423 => 23402,
+ 24020 => 24005,
+ 24018 => 23782,
+ 24398 => 24367,
+ 25892 => 25674,
+ 27402 => 26435,
+ 27489 => 27426,
+ 28753 => 27922,
+ 28760 => 28393,
+ 29568 => 29473,
+ 30090 => 21472,
+ 30318 => 30270,
+ 30316 => 30307,
+ 31840 => 31548,
+ 31839 => 31809,
+ 32894 => 32843,
+ 32893 => 21548,
+ 33247 => 33039,
+ 35186 => 34989,
+ 35183 => 34924,
+ 35712 => 35835,
+ 36118 => 36174,
+ 36119 => 36189,
+ 36497 => 36399,
+ 36499 => 36396,
+ 36705 => 36756,
+ 37192 => 37094,
+ 37956 => 38136,
+ 37969 => 37492,
+ 37970 => 37492,
+ 38717 => 38657,
+ 38851 => 38801,
+ 38849 => 32560,
+ 39019 => 39076,
+ 39509 => 39556,
+ 39501 => 39553,
+ 39634 => 33039,
+ 39706 => 39035,
+ 40009 => 40150,
+ 39985 => 40098,
+ 39998 => 40148,
+ 39995 => 40151,
+ 40403 => 40551,
+ 40407 => 40485,
+ 40756 => 40761,
+ 40812 => 40841,
+ 40810 => 40842,
+ 40852 => 40858,
+ 22220 => 33487,
+ 24022 => 23721,
+ 25088 => 24651,
+ 25891 => 25371,
+ 25898 => 25605,
+ 26348 => 26194,
+ 29914 => 29906,
+ 31434 => 31363,
+ 31844 => 31614,
+ 32403 => 32552,
+ 32406 => 32420,
+ 32404 => 25165,
+ 33250 => 33244,
+ 34367 => 33821,
+ 34865 => 34506,
+ 35722 => 21464,
+ 37008 => 36902,
+ 37007 => 36923,
+ 37987 => 38259,
+ 37984 => 38084,
+ 38760 => 38757,
+ 39023 => 26174,
+ 39260 => 39181,
+ 39514 => 24778,
+ 39515 => 39551,
+ 39511 => 39564,
+ 39636 => 20307,
+ 40020 => 40157,
+ 40023 => 40158,
+ 40022 => 40156,
+ 40421 => 40502,
+ 40692 => 38665,
+ 22225 => 22065,
+ 22761 => 22365,
+ 25900 => 25597,
+ 30321 => 30251,
+ 30322 => 30315,
+ 32648 => 32641,
+ 34870 => 34453,
+ 35731 => 35753,
+ 35730 => 35863,
+ 35734 => 35894,
+ 33399 => 33395,
+ 36123 => 36195,
+ 37312 => 37247,
+ 37994 => 28809,
+ 38722 => 38643,
+ 38728 => 28789,
+ 38724 => 38701,
+ 38854 => 21315,
+ 39024 => 39078,
+ 39519 => 39588,
+ 39714 => 39699,
+ 39768 => 39751,
+ 40031 => 40078,
+ 40441 => 40560,
+ 40442 => 40557,
+ 40572 => 30897,
+ 40573 => 30416,
+ 40711 => 40140,
+ 40823 => 40844,
+ 40818 => 40843,
+ 24307 => 21381,
+ 27414 => 27012,
+ 28771 => 28286,
+ 31852 => 31729,
+ 31854 => 31657,
+ 34875 => 34542,
+ 35264 => 35266,
+ 36513 => 36433,
+ 37313 => 34885,
+ 38002 => 38262,
+ 38000 => 38053,
+ 39025 => 39045,
+ 39262 => 39307,
+ 39638 => 39627,
+ 40652 => 40649,
+ 28772 => 28390,
+ 30682 => 30633,
+ 35738 => 36190,
+ 38007 => 38218,
+ 38857 => 38831,
+ 39522 => 39540,
+ 39525 => 39589,
+ 32412 => 32518,
+ 35740 => 35872,
+ 36522 => 36495,
+ 37317 => 37245,
+ 38013 => 38075,
+ 38014 => 37550,
+ 38012 => 38179,
+ 40055 => 40132,
+ 40056 => 40072,
+ 40695 => 40681,
+ 35924 => 33395,
+ 38015 => 20991,
+ 40474 => 40550,
+ 39530 => 39562,
+ 39729 => 37057,
+ 40475 => 40563,
+ 40478 => 40510,
+ 31858 => 21505,
+ 20189 => 21516,
+ 27596 => 27595,
+ 24194 => 20164,
+ 22908 => 23033,
+ 25182 => 25421,
+ 25184 => 21449,
+ 20322 => 28192,
+ 24567 => 24671,
+ 25911 => 32771,
+ 30337 => 30338,
+ 32912 => 33011,
+ 33424 => 33476,
+ 38440 => 21380,
+ 38447 => 22336,
+ 22389 => 19992,
+ 24354 => 38892,
+ 24627 => 24653,
+ 25108 => 25099,
+ 25297 => 38067,
+ 26514 => 26720,
+ 27520 => 22829,
+ 27869 => 28335,
+ 30015 => 27667,
+ 34415 => 34412,
+ 20417 => 20451,
+ 21060 => 21037,
+ 21398 => 24222,
+ 21401 => 21389,
+ 33549 => 33503,
+ 25295 => 25343,
+ 25923 => 26251,
+ 26591 => 26976,
+ 26618 => 25296,
+ 27608 => 27607,
+ 31045 => 31046,
+ 31190 => 31047,
+ 32008 => 32424,
+ 33530 => 33683,
+ 37332 => 38023,
+ 20936 => 20928,
+ 21764 => 21591,
+ 24371 => 24362,
+ 25360 => 25343,
+ 25404 => 25386,
+ 26050 => 26071,
+ 27436 => 21683,
+ 30143 => 30193,
+ 32029 => 32436,
+ 32024 => 32430,
+ 32019 => 32446,
+ 34456 => 34516,
+ 36859 => 31227,
+ 37087 => 37071,
+ 37092 => 21364,
+ 37333 => 38028,
+ 38492 => 38485,
+ 39139 => 39268,
+ 20586 => 36924,
+ 21102 => 21072,
+ 21293 => 21286,
+ 22279 => 22261,
+ 22492 => 37326,
+ 22515 => 22350,
+ 22497 => 22445,
+ 22512 => 37319,
+ 23149 => 23045,
+ 23148 => 28139,
+ 23488 => 37319,
+ 23821 => 23811,
+ 25533 => 30896,
+ 26734 => 26479,
+ 28137 => 20940,
+ 28150 => 28062,
+ 28133 => 28172,
+ 28123 => 27993,
+ 28106 => 28153,
+ 28916 => 28867,
+ 30160 => 34516,
+ 30501 => 30502,
+ 30758 => 23528,
+ 32053 => 32443,
+ 32058 => 32448,
+ 32063 => 32464,
+ 33051 => 33003,
+ 33651 => 35910,
+ 33685 => 33607,
+ 34898 => 28843,
+ 35285 => 31895,
+ 37206 => 40489,
+ 37356 => 38030,
+ 37348 => 38032,
+ 37369 => 38037,
+ 37367 => 38029,
+ 38278 => 38414,
+ 38280 => 38380,
+ 39141 => 39270,
+ 21412 => 21382,
+ 21926 => 23721,
+ 23215 => 22955,
+ 23505 => 23522,
+ 23890 => 23721,
+ 24818 => 24701,
+ 24824 => 33557,
+ 25564 => 25513,
+ 26235 => 26263,
+ 26895 => 26720,
+ 26838 => 26536,
+ 26903 => 30855,
+ 27581 => 28102,
+ 28296 => 27817,
+ 28254 => 27976,
+ 28194 => 27816,
+ 28960 => 28140,
+ 29259 => 31546,
+ 29999 => 23425,
+ 30060 => 30066,
+ 30820 => 30806,
+ 30812 => 30785,
+ 30824 => 30743,
+ 31547 => 31559,
+ 32079 => 32449,
+ 32078 => 32471,
+ 32574 => 29942,
+ 32674 => 32466,
+ 34901 => 21516,
+ 35008 => 33589,
+ 35224 => 35271,
+ 35406 => 35765,
+ 35416 => 35790,
+ 35410 => 35794,
+ 36026 => 36150,
+ 36016 => 36147,
+ 36309 => 36398,
+ 36602 => 36730,
+ 36601 => 36725,
+ 36587 => 36728,
+ 37126 => 37075,
+ 37377 => 38059,
+ 37379 => 38040,
+ 37414 => 38043,
+ 37376 => 38063,
+ 37380 => 38061,
+ 37415 => 38058,
+ 38284 => 38390,
+ 38537 => 38503,
+ 38640 => 27675,
+ 38919 => 39032,
+ 39147 => 39275,
+ 20682 => 20185,
+ 20660 => 20251,
+ 20674 => 20603,
+ 20681 => 20325,
+ 21962 => 21789,
+ 21993 => 21794,
+ 22628 => 22489,
+ 22607 => 22450,
+ 22780 => 22776,
+ 23243 => 34949,
+ 23231 => 24871,
+ 23510 => 28024,
+ 23512 => 32622,
+ 23583 => 40092,
+ 24048 => 24047,
+ 24823 => 34850,
+ 25609 => 27063,
+ 25636 => 25212,
+ 25667 => 25179,
+ 25640 => 25299,
+ 25647 => 25487,
+ 25664 => 25410,
+ 25637 => 25462,
+ 25639 => 25159,
+ 28339 => 28066,
+ 28999 => 36745,
+ 29010 => 28828,
+ 29026 => 33557,
+ 29499 => 29426,
+ 29771 => 29614,
+ 30560 => 30519,
+ 31590 => 31649,
+ 31604 => 16882,
+ 31600 => 31534,
+ 32136 => 32488,
+ 32134 => 32480,
+ 32131 => 32481,
+ 32677 => 32671,
+ 32801 => 38148,
+ 33121 => 33078,
+ 33309 => 36758,
+ 34033 => 33805,
+ 33842 => 33841,
+ 33861 => 33785,
+ 33874 => 33645,
+ 33903 => 33647,
+ 33888 => 21442,
+ 34571 => 34690,
+ 34554 => 34545,
+ 35462 => 35795,
+ 35455 => 35798,
+ 35425 => 35817,
+ 35460 => 35796,
+ 35445 => 35804,
+ 36322 => 36346,
+ 36613 => 36738,
+ 36615 => 36737,
+ 36616 => 36736,
+ 37142 => 37095,
+ 37140 => 37036,
+ 37448 => 38090,
+ 37424 => 38088,
+ 37434 => 38064,
+ 37478 => 38066,
+ 37427 => 38070,
+ 37470 => 38074,
+ 37507 => 38131,
+ 37422 => 38092,
+ 37446 => 38075,
+ 37485 => 38077,
+ 37484 => 38076,
+ 38927 => 39043,
+ 38926 => 39040,
+ 40167 => 20971,
+ 40701 => 40702,
+ 20712 => 20606,
+ 22044 => 21787,
+ 22652 => 30742,
+ 23937 => 23901,
+ 24152 => 24123,
+ 24153 => 24149,
+ 24277 => 33643,
+ 24872 => 24747,
+ 24947 => 24749,
+ 24948 => 24913,
+ 24938 => 24580,
+ 25129 => 25132,
+ 25127 => 25111,
+ 25718 => 25247,
+ 25715 => 25248,
+ 25692 => 25532,
+ 26272 => 30355,
+ 26402 => 26395,
+ 27071 => 26724,
+ 27050 => 26473,
+ 27550 => 27538,
+ 28366 => 33637,
+ 28408 => 27986,
+ 28411 => 27984,
+ 28442 => 27812,
+ 28426 => 28295,
+ 29079 => 28829,
+ 29507 => 21574,
+ 29810 => 29617,
+ 30392 => 30386,
+ 30893 => 30720,
+ 31125 => 31054,
+ 31630 => 31722,
+ 21124 => 26413,
+ 32163 => 32507,
+ 32196 => 32498,
+ 32203 => 32495,
+ 32185 => 32506,
+ 33155 => 33149,
+ 33940 => 33715,
+ 33960 => 33564,
+ 34600 => 34678,
+ 34618 => 38675,
+ 35233 => 35275,
+ 35474 => 35830,
+ 35478 => 24726,
+ 36053 => 36167,
+ 37541 => 38129,
+ 37494 => 38095,
+ 37531 => 38118,
+ 37498 => 38098,
+ 37536 => 38097,
+ 37546 => 38101,
+ 37517 => 38106,
+ 37542 => 38111,
+ 37530 => 38123,
+ 37547 => 38127,
+ 37503 => 38122,
+ 37539 => 38135,
+ 37614 => 38102,
+ 38784 => 40727
+ );
+$GLOBALS['Text_zhDetect']['exc'] = array(
+ 23588,
+ 21514,
+ 27867,
+ 27762,
+ 27745,
+ 27867,
+ 24067,
+ 20223,
+ 27785,
+ 23427,
+ 36836,
+ 20315,
+ 25340,
+ 21319,
+ 31995,
+ 23616,
+ 20811,
+ 25296,
+ 27844,
+ 26479,
+ 21482,
+ 31563,
+ 20223,
+ 24184,
+ 28846,
+ 31192,
+ 20305,
+ 21482,
+ 25176,
+ 22238,
+ 21319,
+ 21482,
+ 21681,
+ 24565,
+ 21846,
+ 26118,
+ 23913,
+ 38613,
+ 21367,
+ 25384,
+ 33293,
+ 26417,
+ 24358,
+ 25166,
+ 21767,
+ 20462,
+ 27427,
+ 25187,
+ 23478,
+ 25928,
+ 21507,
+ 22797,
+ 32972,
+ 37240,
+ 22256,
+ 32470,
+ 24245,
+ 27880,
+ 22564,
+ 25134,
+ 21119,
+ 24439,
+ 26647,
+ 27048,
+ 26104,
+ 26262,
+ 40635,
+ 26865,
+ 31104,
+ 25414,
+ 30522,
+ 21032,
+ 24040,
+ 31461,
+ 27575,
+ 25240,
+ 24840,
+ 24425,
+ 21488,
+ 24109,
+ 25628,
+ 21046,
+ 24535,
+ 29432,
+ 25405,
+ 21512,
+ 21488,
+ 23898,
+ 25114,
+ 27442,
+ 25467,
+ 26753,
+ 35895,
+ 33268,
+ 21340,
+ 33777,
+ 22797,
+ 34615,
+ 28938,
+ 20463,
+ 21038,
+ 20102,
+ 28096,
+ 28394,
+ 28976,
+ 34001,
+ 34920,
+ 38172,
+ 27838,
+ 21700,
+ 40496,
+ 23731,
+ 33945,
+ 27994,
+ 20102,
+ 31601,
+ 27169,
+ 35137,
+ 28436,
+ 23004,
+ 28330,
+ 21097,
+ 31958,
+ 38038,
+ 26495,
+ 21521,
+ 26873,
+ 26812,
+ 21488,
+ 27784,
+ 29071,
+ 24840,
+ 31230,
+ 32763,
+ 20511,
+ 36394,
+ 21400,
+ 38229,
+ 28316,
+ 31179,
+ 26494,
+ 20908,
+ 21693,
+ 30196,
+ 33945,
+ 31995,
+ 34223,
+ 22075,
+ 37222,
+ 32993,
+ 23064,
+ 30151,
+ 22122,
+ 36342,
+ 21688,
+ 38754,
+ 20986,
+ 13417,
+ 34276,
+ 21872,
+ 23721,
+ 25165,
+ 33244,
+ 21315,
+ 21516,
+ 27595,
+ 20164,
+ 25421,
+ 21449,
+ 28192,
+ 24671,
+ 32771,
+ 30338,
+ 33011,
+ 21380,
+ 22336,
+ 19992,
+ 24653,
+ 22829,
+ 28335,
+ 27667,
+ 33503,
+ 25343,
+ 26251,
+ 26976,
+ 25296,
+ 27607,
+ 31046,
+ 31047,
+ 33683,
+ 25343,
+ 25386,
+ 26071,
+ 21683,
+ 30193,
+ 32436,
+ 32430,
+ 34516,
+ 31227,
+ 39268,
+ 36924,
+ 37326,
+ 22350,
+ 28139,
+ 30896,
+ 26479,
+ 20940,
+ 27993,
+ 28153,
+ 34516,
+ 23528,
+ 32443,
+ 35910,
+ 33607,
+ 28843,
+ 31895,
+ 38380,
+ 39270,
+ 23721,
+ 23522,
+ 23721,
+ 25513,
+ 26263,
+ 30855,
+ 28102,
+ 27816,
+ 28140,
+ 30785,
+ 31559,
+ 29942,
+ 21516,
+ 33589,
+ 36398,
+ 38040,
+ 27675,
+ 20185,
+ 21789,
+ 22776,
+ 24871,
+ 28024,
+ 32622,
+ 34850,
+ 27063,
+ 25212,
+ 25179,
+ 25299,
+ 25487,
+ 25410,
+ 25462,
+ 25159,
+ 28066,
+ 30519,
+ 31649,
+ 16882,
+ 31534,
+ 33805,
+ 33841,
+ 33785,
+ 34690,
+ 36346,
+ 36736,
+ 24149,
+ 30355,
+ 26395,
+ 27984,
+ 28295,
+ 21574,
+ 29617,
+ 31054,
+ 31722,
+ 26413,
+ 33564,
+ 34678,
+ 38675,
+ 24726,
+ 38095,
+ 38118,
+ 38106
+ );
+class Text_zhDetect
+{
+
+ function guess($str, $def = 'T')
+ {
+ $_t2smap = $GLOBALS['Text_zhDetect']['t2smap'];
+ if (empty($GLOBALS['Text_zhDetect']['s2tmap'])) {
+ $this->buildS2Tmap();
+ }
+ $_s2tmap = $GLOBALS['Text_zhDetect']['s2tmap'];
+
+
+ for($i=0;$i<mb_strlen($str);$i++){
+ $tc=mb_substr($str,$i,1);
+ $tc_n = $this->uniord($tc);
+ if (!isset($_s2tmap[$tc_n]) && !isset($_t2smap[$tc_n])) {
+ // not in either..
+ continue;
+ }
+ if (isset($_s2tmap[$tc_n]) && isset($_t2smap[$tc_n])) {
+ // in both..
+ continue;
+ }
+ if (!isset($_s2tmap[$tc_n]) && isset($_t2smap[$tc_n])) {
+ return 'T';
+ }
+ if (isset($_s2tmap[$tc_n]) && !isset($_t2smap[$tc_n])) {
+ return 'S';
+ }
+ // should not get here..
+ }
+ return $def;
+ }
+ function buildS2Tmap()
+ {
+ $GLOBALS['Text_zhDetect']['s2tmap']=array_combine(
+ array_values($GLOBALS['Text_zhDetect']['t2smap']),array_keys($GLOBALS['Text_zhDetect']['t2smap'])
+ );
+ foreach($GLOBALS['Text_zhDetect']['exc'] as $code) {
+ unset( $GLOBALS['Text_zhDetect']['s2tmap'][$code]);
+ }
+ }
+
+
+ function uniord($c) {
+ $h = ord($c[0]);
+ if ($h <= 0x7F) {
+ return $h;
+ } else if ($h < 0xC2) {
+ return false;
+ } else if ($h <= 0xDF) {
+ return ($h & 0x1F) << 6 | (ord($c[1]) & 0x3F);
+ } else if ($h <= 0xEF && strlen($c) > 2) {
+ return ($h & 0x0F) << 12 | (ord($c[1]) & 0x3F) << 6
+ | (ord($c[2]) & 0x3F);
+ } else if ($h <= 0xF4 && strlen($c) > 3) {
+ return ($h & 0x0F) << 18 | (ord($c[1]) & 0x3F) << 12
+ | (ord($c[2]) & 0x3F) << 6
+ | (ord($c[3]) & 0x3F);
+ } else {
+ return false;
+ }
+ }
+
+
+ function unichr($c) {
+ if ($c <= 0x7F) {
+ return chr($c);
+ } else if ($c <= 0x7FF) {
+ return chr(0xC0 | $c >> 6) . chr(0x80 | $c & 0x3F);
+ } else if ($c <= 0xFFFF) {
+ return chr(0xE0 | $c >> 12) . chr(0x80 | $c >> 6 & 0x3F)
+ . chr(0x80 | $c & 0x3F);
+ } else if ($c <= 0x10FFFF) {
+ return chr(0xF0 | $c >> 18) . chr(0x80 | $c >> 12 & 0x3F)
+ . chr(0x80 | $c >> 6 & 0x3F)
+ . chr(0x80 | $c & 0x3F);
+ } else {
+ return false;
+ }
+ }
+}
// }}}
// {{{ php4 constructor
- /**
- * Creates an XML parser.
- *
- * This is needed for PHP4 compatibility, it will
- * call the constructor, when a new instance is created.
- *
- * @param string $srcenc source charset encoding, use NULL (default) to use
- * whatever the document specifies
- * @param string $mode how this parser object should work, "event" for
- * startelement/endelement-type events, "func"
- * to have it call functions named after elements
- * @param string $tgtenc a valid target encoding
- */
- function XML_Parser($srcenc = null, $mode = 'event', $tgtenc = null)
- {
- XML_Parser::__construct($srcenc, $mode, $tgtenc);
- }
+
// }}}
// {{{ php5 constructor
*/
function _initHandlers()
{
- if (!is_resource($this->parser)) {
+ if (!is_object($this->parser)) {
return false;
}
return $result;
}
// if $this->fp was fopened previously
+
if (is_resource($this->fp)) {
while ($data = fread($this->fp, 4096)) {
if (!$this->_parseString($data, feof($this->fp))) {
- $error = &$this->raiseError();
+ $error = $this->raiseError();
$this->free();
return $error;
}
**/
function free()
{
- if (isset($this->parser) && is_resource($this->parser)) {
- xml_parser_free($this->parser);
+ if (isset($this->parser) && is_object($this->parser)) {
+ //xml_parser_free($this->parser);
unset( $this->parser );
}
if (isset($this->fp) && is_resource($this->fp)) {
* @return null
* @abstract
*/
- function startHandler($xp, $elem, &$attribs)
+ function startHandler($xp, $elem, $attribs)
{
return null;
}
* @return null
* @abstract
*/
- function endHandler($xp, $elem)
+ function endHandler( $elem)
{
return null;
}
*/
-require_once 'XML/Tree/Morph.php';
-require_once 'Fpdf/tFPDF.php';
-require_once 'XML/SvgToPdf/Base.php';
// current options for generated file..
$t = new XML_SvgToPDF;
$t->language = $data['language'];
- /*
+ require_once 'XML/Tree/Morph.php';
+
$x = new XML_Tree_Morph(
$svg,
array(
'debug' => 0,
'filter' => array(
- 'svg' => array(&$t, 'buildObject'),
- 'image' => array(&$t, 'buildObject'),
- 'text' => array(&$t, 'buildObject'),
- 'tspan' => array(&$t, 'buildObject'),
- 'rect' => array(&$t, 'buildObject'),
- 'g' => array(&$t, 'buildObject'),
- 'path' => array(&$t, 'buildObject'),
- 'sodipodi:namedview' => array(&$t, 'buildNull'),
- 'defs' => array(&$t, 'buildNull'),
+ 'svg' => array($t, 'buildObject'),
+ 'image' => array($t, 'buildObject'),
+ 'text' => array($t, 'buildObject'),
+ 'tspan' => array($t, 'buildObject'),
+ 'rect' => array($t, 'buildObject'),
+ 'g' => array($t, 'buildObject'),
+ 'path' => array($t, 'buildObject'),
+ 'sodipodi:namedview' => array($t, 'buildNull'),
+ 'defs' => array($t, 'buildNull'),
)
)
);
$tree = $x->getTreeFromFile();
-
+ //echo '<PRE>'; print_R($tree); exit;
$tree = $t->buildobject($tree);
- */
+ // echo '<PRE>'; print_R($tree); exit;
//echo "<PRE>";
- $tree = $t->parseSvg($svg);
- //echo "<PRE>";print_r($tree);exit;
+ // $tree = $t->parseSvg($svg);
+ // echo "<PRE>";print_r($tree);exit;
if ($data['language'] == 'big5') {
//die("trying chinese");
- require_once 'Fpdf/tFPDF.php' ;
-
- $pdf = new tFPDF($orientation ,'mm','A4');
-
- // we originally used ARIALUNI.ttf'
-
- $font = '/usr/share/fonts/truetype/msttcorefonts/Arial.ttf';
-
- if (!file_exists('/usr/share/fonts/truetype/msttcorefonts/Arial.ttf')) {
- die("install msttcorefonts package");
- }
- //$pdf->AddFont('ARIALUNI','',$font,true);
-
- $pdf->AddFont('ARIALUNI','','/usr/share/fonts/truetype/msttcorefonts/Arial.ttf',true);
- $pdf->AddFont('ARIALUNI','B','/usr/share/fonts/truetype/msttcorefonts/Arial_Bold.ttf',true);
-
-// $pdf->SetFont('ARIALUNI','',14);
-// require_once 'Fpdf/Chinese-unicode.php';
-//
-// $pdf=new PDF_Unicode($orientation ,'mm','A4');
-//// $pdf->AddGBFont();
-//// $pdf->AddBig5Font();
-// $pdf->AddUniCNSFont('Uni');
- //$pdf->AddUniCNSFont('Uni');
- //AddUniCNShwFont
+
+ require_once 'Fpdf/Unicode.php';
+
+ $pdf=new FPDF_Unicode($orientation ,'mm','A4');
+ $pdf->AddGBFont();
+ $pdf->AddBig5Font();
+ $pdf->AddUniCNShwFont();
$pdf->open();
+
+
} else {
+ require_once 'Fpdf/tFPDF.php' ;
+
$pdf=new tFPDF($orientation ,'mm','A4');
$pdf->open();
}
$page++;
$t->debug("<B>PAGE $page<B>");
-
$pdf->addPage();
+
$tree->writePDF($pdf,$page_data);
-
+
+
//$tree->writePDF($pdf,$data);
}
return $pdf;
}
- function fetchRows(&$original_data, $key, $rows) {
+ static function fetchRows(&$original_data, $key, $rows) {
$ret = array();
while ($rows > -1 && !empty($original_data[$key])) {
$addrow = array_shift($original_data[$key]);
return $this->parseNode($d->documentElement);
}
- function parseNode($n)
+ function parseXMLNode($n)
{
// do children first..
//print_r(array("PARSENODE:",$n));
return $children;
}
+ // fixme.. this is the Dom Version..
$ret = $this->buildObject($n,$children);
return $ret;
function buildNull($node) {
return;
}
- function buildObject($node, $children) {
- $class = 'XML_SvgToPDF_'.$node->tagName;
- /*
- if (strlen(trim($node->content)) && (@$this->language)) {
- $node->language = $this->language;
- }
- */
-
-
- //echo "look for $class?";
- if (!class_exists($class)) {
- // try loading it..
- $file = dirname(__FILE__) . '/SvgToPdf/'.ucfirst(strtolower($node->tagName)). '.php';
- $this->debug("loading $file");
- if (file_exists($file)) {
- require_once 'XML/SvgToPdf/'.ucfirst(strtolower($node->tagName)) . '.php';
- }
- }
- // now if it doesnt exist..
- if (!class_exists($class)) {
- $this->debug("can not find $class");
- $class = 'XML_SvgToPDF_Base';
- }
- $r = new $class;
- $r->children = $children;
- $r->fromXmlNode($node);
- return $r;
+ function buildObject($node )
+ {
+ require_once 'XML/SvgToPdf/Base.php';
+
+ return XML_SvgToPDF_Base::factory($node);
+
}
var $version;
var $docname;
var $docbase;
+ var $sodipodirole;
+ var $sodipodilinespacing;
+ var $sodipodinonprintable;
+ var $sodipodinodetypes;
+ var $sodipodiversion;
+ var $sodipodidocname;
+ var $sodipodidocbase;
+ var $sodipodi;
+ var $xmlnssodipodi;
+ var $xmlns;
+ var $xmlnsxlink;
+ var $xmlnsinkscape;
+ var $inkscape;
+ var $inkscapeversion;
+ var $xmlnsrdf;
+ var $xmlnscc;
+ var $xmlnsdc;
+ var $xlink;
+ var $rdf;
+ var $cc;
+ var $dc;
+ var $d;
+ var $content = '';
+ var $role;
+ var $linespacing;
+ var $attributes;
+ var $nonprintable;
+ var $about;
+ var $resource;
+
+
+ var $name;
+
+ static function factory($node)
+ {
+ if (is_a($node, 'XML_SvgToPDF_Base')) {
+ return $node;
+ }
+
+ $class = 'XML_SvgToPDF_'.$node->name;
+ /*
+ if (strlen(trim($node->content)) && (@$this->language)) {
+ $node->language = $this->language;
+ }
+ */
+
- function fromXmlNode($node)
+ //echo "look for $class?";
+ if (!class_exists($class)) {
+ // try loading it..
+ $file = dirname(__FILE__) .'/'.ucfirst(strtolower($node->name)). '.php';
+
+ if (file_exists($file)) {
+ require_once 'XML/SvgToPdf/'.ucfirst(strtolower($node->name)) . '.php';
+ }
+ }
+ // now if it doesnt exist..
+ if (!class_exists($class)) {
+
+ $class = 'XML_SvgToPDF_Base';
+ }
+ $r = new $class;
+ $r->fromNode($node);
+ return $r;
+ }
+
+ function factoryChildren($ar) {
+ foreach($ar as $c) {
+ if (!empty($c)) {
+ $this->children[] = $this->factory($c);
+ }
+ }
+ }
+
+
+ function fromXmlNode(DomElement $node)
{
// extract attributes
foreach($node->attributes as $k=>$v) {
if (in_array($k, array('style'))) {
continue;
}
+ $k = preg_replace('/[^a-z]+/', '', $k);
- $this->$k = $v->value;
- if (preg_match('/[0-9]+mm$/',$v->value)) {
- $vv = str_replace('mm','',$v->value);
+ $v = is_object($v) ? $v->value : $v;
+ if (preg_match('/[0-9]+mm$/',$v)) {
+ $vv = str_replace('mm','',$v);
$vv = $vv * 3.543307;
$this->$k = $vv;
continue;
}
+
+ $this->$k = $v;
}
// deal with style..
if ($node->hasAttribute('style') && strlen($node->getAttribute('style'))) {
if (!strlen(trim($ss))) {
continue;
}
- if (strpos($ss,':') === false) {
- $style[$ss] = true;
- continue;
- }
+
$sss = explode(':',$ss);
if (preg_match('/[0-9]+pt$/',$sss[1])) {
$sss[1] = str_replace('pt','',$sss[1]);
}
$this->style = $style;
}
-
+ $this->name = $node->tagName;
+
+ //?? needed?
+ if ($node->children) {
+ $this->factoryChildren($node->children);
+ }
+
$this->transform();
+
+
// if node is a tspan
if ($node->attributes) {
foreach($node->attributes as $k=>$v) {
- echo $node->name . ":" . $k . "=>". $v. "<BR>";
+ //echo $node->name . ":" . $k . "=>". $v. "<BR>";
if (strpos($k,':')) {
$kk = explode(':',$k);
}
}
- if (isset($this->style)) {
+ if (isset($this->style) && is_string($this->style)) {
+
$s = explode(';',$this->style);
foreach($s as $ss) {
if (!strlen(trim($ss))) {
$this->style = $style;
}
+ $this->name = $node->name;
if ($node->content) {
$this->content = trim($node->content);
- echo $node->name . ":CONTENT=>". $node->content. "<BR>";
+ //echo $node->name . ":CONTENT=>". $node->content. "<BR>";
}
+
if ($node->children) {
- $this->children = $node->children;
+ $this->factoryChildren($node->children);
}
- echo "<PRE>BEFORE:";print_r($this->toArray());
+ // echo "<PRE>BEFORE:";print_r($this->toArray());
$this->transform();
- echo "<PRE>AFTER:";print_r($this->toArray());
+ //echo "<PRE>AFTER:";print_r($this->toArray());
}
$this->childrenWritePDF($pdf,$data);
}
- function childrenWritePDF(&$pdf,&$data) {
+ function childrenWritePDF($pdf,&$data) {
if (!@$this->children) {
return;
}
continue;
}
if (!method_exists($this->children[$k],'writePDF')) {
- echo "OOPS unknown object? <PRE>" ; print_r($this->children[$k]); exit;
+ echo '<PRE>'; print_r(array($this, $k));
+ trigger_error( "OOPS unknown object?" );
}
$this->children[$k]->writePDF($pdf,$data);
}
}
+
+
}
{
var $boundingbox = false; // for repeats...
var $settings = array(); // cols/rows..
-
+ var $dynamic;
+ var $rows;
+ var $cols;
function fromXmlNode($node)
{
// print_r("G:fromXmlNode");
function fromNode($node) {
parent::fromNode($node);
-
+ // print_R($this);
//----------- applyDynamic...
// look for
function fromXmlNode($node) {
parent::fromXmlNode($node);
+ $this->parse();
+ }
+ function fromNode($node) {
+ parent::fromNode($node);
+ // var_dump($node);
+ // var_dump($this);
+ $this->parse();
+ }
+ function parse()
+ {
$d = explode(' ',trim($this->d));
$i=0;
$data = array();
return;
}
*/
-
+ if (!is_array($this->d)) {
+ print_R($this);exit;
+ }
foreach($this->d as $a) {
switch($a[0]) {
var $xx = 0;
var $yy = 0;
var $nonprintable = false;
+ var $maxWidth;
function writePDF($pdf,$data) {
class XML_SvgToPDF_Text extends XML_SvgToPDF_Base {
var $linespacing;
-
+ var $xx;
+ var $yy;
function fromXmlNode($node) {
parent::fromXmlNode($node);
+ $this->parse();
+ }
+ function fromNode($node) {
+ parent::fromNode($node);
+ $this->parse();
+ }
+ function parse()
+ {
// any text ???
if (empty($this->children) || empty($this->children[0]->content)) {
return;
}
$ffont = $font;
if (preg_match('/big5/i',$this->style['font-family'])) {
- $ffont = 'ARIALUNI';
- $font = 'arial'; // default if not big4
+ $font = 'Big5';
+
+ //$ffont = 'ARIALUNI';
+ // $font = 'arial'; // default if not bigg
}
$xx = $c->x !== false ? $c->x + @$this->xx : $x;
$yy = $c->y !== false ? $c->y + @$this->yy : $y + ($lineno * $size * 1.3);
- $lineno++;
+ $lineno++;
+ if (empty($c->content)) {
+ //print_R($c);exit;
+ }
$val = $c->content;
- if ($ffont == 'ARIALUNI') { //) && preg_match('/[\x7f-\xff]+/',$val)) {
- $pdf->setFont('ARIALUNI' ,
- $weight,
- $size);
- }
+ //if ($ffont == 'ARIALUNI') { //) && preg_match('/[\x7f-\xff]+/',$val)) {
+ // $pdf->setFont('ARIALUNI' ,
+ // $weight,
+ // $size);
+ //}
if (isset($c->args)) {
$args = array();
$has_template = preg_match('/%s/', $val);
- $val = trim(vsprintf($val,$args));
+ $val = empty($val) || empty($args) ? $val : trim(vsprintf($val,$args));
- if ($has_template && ($ffont == 'ARIALUNI') && preg_match('/[\x7f-\xff]+/',$val)) {
- //require_once 'Text/ZhDetect.php';
- //$detect = new Text_zhDetect;
- //$type = $detect->guess($val);
- //if ($v == 'S') {
-
- // $val = @iconv('utf8', 'GB2312//IGNORE', $val);
- // $pdf->setFont('GB' ,
- // $weight,
- // $size);
- //} else {
-// $val = @iconv('utf8', 'BIG5//IGNORE', $val);
- $pdf->setFont('ARIALUNI' ,
+ //if ($has_template && ($ffont == 'ARIALUNI') && preg_match('/[\x7f-\xff]+/',$val)) {
+ if ($has_template && ($font == 'Big5') && preg_match('/[\x7f-\xff]+/',$val)) {
+ require_once 'Text/ZhDetect.php';
+ $detect = new Text_zhDetect;
+ $type = $detect->guess($val);
+ if ($v == 'S') {
+
+ $val = @iconv('utf8', 'GB2312//IGNORE', $val);
+ $pdf->setFont('GB' ,
+ $weight,
+ $size);
+ } else {
+ $val = @iconv('utf8', 'BIG5//IGNORE', $val);
+ $pdf->setFont('Big5' ,
$weight,
$size);
- //}
+ }
} else {
$val = @iconv('utf8','ascii//ignore',$val);
}
var $args = array(); // arguments..
var $role;
- function fromXmlNode($node) {
+ function fromXmlNode($node)
+ {
parent::fromXmlNode($node);
+ $this->content = $node->textContent;
+
+ $this->parse();
+ }
+
+ function fromNode($node)
+ {
+ parent::fromNode($node);
+
+ $this->content = $node->content;
+
+ $this->parse();
+ }
+ function parse()
+ {
$this->x = false;
$this->y = false;
- $this->content = $node->textContent;
/*
if (isset($this->x)) {
unset($this->x);
$trans = array_flip(get_html_translation_table(HTML_ENTITIES));
}
- if (strlen($this->content)) {
+ if (!empty($this->content) && strlen($this->content)) {
// convert & etc.
if (strpos($this->content,'&') !== false) {
$this->content = strtr($this->content, $trans);
--- /dev/null
+<?php
+
+/* usage:
+
+ *install Fpdf as a PEAR package by:
+ pear install http://www.akbkhome.com:81/svn/akpear/Fpdf/Fpdf-1.51.tgz
+
+
+ $data=array(
+
+ 'address' => array(
+ array(
+ 'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+ ),
+ array(
+ 'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+ ),
+ array(
+ 'name' => = "Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx Xxxxxxxx xxxxxxxxxxxx xxxxxxxxxx xxxxxxx";
+ ),
+ );
+ $pdf = XML_SvgToPDF::construct(dirname(__FILE__).'/test.svg',$data);
+
+ $pdf->output();
+
+
+
+ expects an svg file (probably made by sodipodi)
+ a block is the group,
+ a) it has a text component with
+ dynamic=address
+ rows=7
+ cols=3
+ b) a non-printable rectangle (which is the bounding box)
+ c) some text {xxxx}{yyyy} which is replaced with
+ address[0....][xxxx] = 'somevalue;
+ address[0....][yyyy] = 'somevalue;
+
+
+
+
+*/
+
+require_once 'XML/Tree/Morph.php';
+require_once 'XML/SvgToPdfAlt/Base.php';
+
+// current options for generated file..
+
+$GLOBALS['_XML_SVGTOPDF']['options'] = array(
+ 'debug' => 0,
+ );
+
+
+class XML_SvgToPDFAlt {
+
+ var $language;
+ static function debug($s,$e=0) {
+ if (!$GLOBALS['_XML_SVGTOPDF']['options']['debug']) {
+ return;
+ }
+ echo "<PRE>".print_R($s,true). "</PRE>";
+ if ($e) {
+ exit;
+ }
+ }
+ static function construct($svg, $data=array()) {
+
+ $t = new XML_SvgToPDFAlt;
+ $t->language = @$data['language'];
+ if (empty($svg)) {
+ trigger_error(__CLASS__.':construct called without svg', E_USER_ERROR);
+ }
+
+ $x = new XML_Tree_Morph(
+ $svg,
+ array(
+ 'debug' => 0,
+ 'filter' => array(
+ 'svg' => array($t, 'buildObject'),
+ 'image' => array($t, 'buildObject'),
+ 'text' => array($t, 'buildObject'),
+ 'tspan' => array($t, 'buildObject'),
+ 'rect' => array($t, 'buildObject'),
+ 'g' => array($t, 'buildObject'),
+ 'path' => array($t, 'buildObject'),
+ 'sodipodi:namedview' => array($t, 'buildNull'),
+ 'defs' => array($t, 'buildNull'),
+ 'metadata' => array($t, 'buildNull'),
+
+ )
+ )
+ );
+
+ $tree = $x->getTreeFromFile();
+
+
+ //echo '<PRE>'.htmlspecialchars(print_r($tree,true));exit;
+
+ $tree = $t->buildobject($tree);
+ //echo '<PRE>'.htmlspecialchars(print_r($tree,true));
+ //echo "<PRE>";print_r($tree);exit;
+ $orientation = ($tree->width > $tree->height) ? 'L' : 'P';
+
+ $GLOBALS['_XML_SVGTOPDF']['options']['file'] = $svg;
+
+ if ($data['language'] == 'big5') {
+
+ require_once 'FpdfAlt/Chinese.php';
+
+ $pdf=new FpdfAlt_Chinese($orientation ,'mm','A4');
+ $pdf->AddGBFont();
+ $pdf->AddBig5Font();
+ $pdf->AddUniCNShwFont();
+ $pdf->open();
+ } else {
+ require_once 'Fpdf.php';
+
+ $pdf=new FPDF($orientation ,'mm','A4');
+ $pdf->open();
+ }
+
+ $pdf->setAutoPageBreak(false);
+ $pdf->AliasNbPages();
+ // convert data to array.
+ if (is_object($data)) {
+ $data = (array) $data;
+ }
+ // assoc. array of key => no of fields per page.
+ $perPage = $tree->calcPerPage();
+
+ // no dynamic blocks:
+ if (!$perPage || empty($data)) {
+ $pdf->addPage();
+ $tree->writePDF($pdf,$data);
+ $t->debug($tree);
+ return $pdf;
+ }
+
+ // build blocks of data for each page.
+ $haveData = true;
+ $page = 0;
+ while (true == $haveData ) {
+ $page_data = $data;
+ $haveData = false;
+ foreach($perPage as $k=>$v) {
+ if (!$data[$k]) {
+ $page_data[$k] = array();
+ continue;
+ }
+ $haveData = true;
+ $page_data[$k] = array_splice ( $data[$k], 0,$v);
+ }
+ $page++;
+ if (!$haveData) {
+ break;
+ }
+
+ $t->debug("<B>PAGE $page<B>");
+ $pdf->addPage();
+ // echo '<PRE>'.htmlspecialchars(print_r($page_data,true));
+ $tree->writePDF($pdf,$page_data);
+ }
+
+ $t->debug($tree);
+ return $pdf;
+ }
+
+ function buildNull($node) {
+ return;
+ }
+ function buildObject($node) {
+ $class = 'XML_SvgToPDFAlt_'.$node->name;
+
+ if (!empty($node->content) && strlen(trim($node->content)) && (@$this->language)) {
+ $node->language = $this->language;
+
+ }
+
+
+ //echo "look for $class?";
+ if (!class_exists($class) && !empty($node->name)) {
+ // try loading it..
+ $file = dirname(__FILE__) . '/SvgToPdfAlt/'.ucfirst(strtolower($node->name)). '.php';
+ $this->debug("loading $file");
+ if (file_exists($file)) {
+ require_once 'XML/SvgToPdfAlt/'.ucfirst(strtolower($node->name)) . '.php';
+ }
+ }
+ // now if it doesnt exist..
+ if (!class_exists($class)) {
+ $this->debug("can not find $class");
+ $class = 'XML_SvgToPDFAlt_Base';
+ }
+ //echo '<PRE>';print_r($node);
+
+ $r = new $class;
+ $r->fromNode($node);
+ return $r;
+ }
+
+
+
+
+}
--- /dev/null
+<?php
+
+/*
+The base node includes:
+ fromNode - convert the XML_Tree node into object with vars
+ (and parse styles)
+
+ // iternate tree with writePDF
+ writePDF($pdf,$data)
+ childrenWritePDF($pdf,$data)
+
+ // shift coordinates of group dynamic elements
+ // so the x is relative to the block corner.
+ shiftChildren($x,$y) {
+ shift($x,$y)
+
+ // find a dynamic block and calculate how much data it can hold.
+ // so you know how many pages are needed.
+ calcPerPage()
+*/
+
+#[AllowDynamicProperties]
+class XML_SvgToPDFAlt_Base {
+
+ var $content;
+
+ function fromNode($node) {
+
+ if ($node->attributes) {
+ foreach($node->attributes as $k=>$v) {
+ if (strpos($k,':')) {
+ $kk = explode(':',$k);
+ $k = $kk[1];
+ }
+ $this->$k = $v;
+ $this->{'_'.$k} = $v;
+ if (preg_match('/[0-9]+mm$/',$v)) {
+ $v = str_replace('mm','',$v);
+ $v = $v * 3.543307;
+
+ $this->$k = $v;
+ $this->{'_'.$k} = $v;// save the original..
+ continue;
+ }
+
+ }
+ }
+
+ if (isset($this->style)) {
+ $s = explode(';',$this->style);
+ foreach($s as $ss) {
+ if (!strlen(trim($ss))) {
+ continue;
+ }
+ if (strpos($ss,':') === false) {
+ $style[$ss] = true;
+ continue;
+ }
+ $sss = explode(':',$ss);
+ if (preg_match('/[0-9]+pt$/',$sss[1])) {
+ $sss[1] = str_replace('pt','',$sss[1]);
+ }
+ $style[$sss[0]] = $sss[1];
+ }
+ $this->style = $style;
+ }
+
+
+ if ($node->content) {
+ $this->content = trim($node->content);
+ }
+ if ($node->children) {
+ $this->children = $node->children;
+ }
+ $this->transform();
+ }
+
+
+ function transform() {
+ if (!@$this->transform) {
+ return;
+ }
+ // deal with transformation..
+ $tr = $this->transform;
+ if (preg_match('/scale\(([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+ $xscale = (float)$args[1];
+ $yscale = (float)$args[2];
+ $method = 'scale';
+ } else if (preg_match('/matrix\(([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+ array_shift($args);
+ require_once 'Math/Matrix.php';
+ $matrix = new Math_Matrix( array(
+ array((float)$args[0],(float)$args[2],(float)$args[4]),
+ array((float)$args[1],(float)$args[3],(float)$args[5]),
+ array( 0, 0, 1))
+ );
+ $method = 'matrix';
+ } else if (preg_match('/translate\(([0-9e.-]+),([0-9e.-]+)\)/',$tr,$args)) {
+ $x = (float)$args[1];
+ $y =(float) $args[2];
+ $method = 'translate';
+ } else {
+ echo "<PRE>no match?";print_r($this); exit;
+ return;
+ }
+ //
+ switch ($method) {
+ case 'scale':
+ $this->x *= $xscale;
+ $this->y *= $yscale;
+ if (!@$this->children) {
+ return;
+ }
+ foreach(array_keys($this->children) as $i) {
+ if (!isset($this->children[$i]->x)) {
+ continue;
+ // echo "<PRE>";print_r($this);exit;
+ }
+ $this->children[$i]->x *= $xscale;
+ $this->children[$i]->y *= $yscale;
+ }
+ break;
+ case 'matrix':
+ $v = new Math_Vector(array($this->x,$this->y,0));
+
+ $r = $matrix->vectorMultiply($v);
+ $r = $r->getData();
+ $this->x = $r[0];
+ $this->y = $r[1];
+ //echo "<PRE>";var_dump( $r);exit;
+ if (!@$this->children) {
+ return;
+ }
+ foreach(array_keys($this->children) as $i) {
+ if (!isset($this->children[$i]->x)) {
+ continue;
+ // echo "<PRE>";print_r($this);exit;
+ }
+ $v = new Math_Vector(array($this->children[$i]->x,$this->children[$i]->y,0));
+ $r = $matrix->vectorMultiply($v);
+ $r = $r->getData();
+ $this->children[$i]->x = $r[0];
+ $this->children[$i]->y = $r[1];
+
+ }
+ break;
+ case 'translate':
+ //echo 'translate' . $x .',' . $y . "\n";
+ if (isset($this->x) && isset($this->y)) {
+
+ $this->x += $x;
+ $this->y += $y;
+ }
+ if (!@$this->children) {
+ return;
+ }
+ foreach(array_keys($this->children) as $i) {
+ if (!isset($this->children[$i]->x) || !isset($this->children[$i]->y)) {
+ continue;
+ // echo "<PRE>";print_r($this);exit;
+ }
+ $this->children[$i]->x += $x;
+ $this->children[$i]->y += $y;
+ }
+ break;
+
+ }
+ }
+
+
+
+
+
+ function writePDF($pdf,$data) {
+ $this->childrenWritePDF($pdf,$data);
+ }
+
+ function childrenWritePDF(&$pdf,&$data) {
+ if (!@$this->children) {
+ return;
+ }
+ foreach(array_keys($this->children) as $k) {
+ if (!$this->children[$k]) {
+ continue;
+ }
+ if (!method_exists($this->children[$k],'writePDF')) {
+ echo "OOPS unknown object? <PRE>" ; print_r($this->children[$k]); exit;
+ }
+ $this->children[$k]->writePDF($pdf,$data);
+ }
+ }
+
+ function shiftChildren($x,$y) {
+ if (!@$this->children) {
+ return;
+ }
+ foreach(array_keys($this->children) as $k) {
+ if (!$this->children[$k]) {
+ continue;
+ }
+ $this->children[$k]->shift($x,$y);
+ }
+ }
+
+ function shift($x,$y) {
+ //XML_SvgToPDF::debug('shift');
+ //XML_SvgToPDF::debug(array($x,$y));
+ //XML_SvgToPDF::debug($this);
+ if (isset($this->x)) {
+
+ $this->x -= $x;
+ }
+ if (isset($this->y)) {
+ $this->y -= $y;
+ }
+ //XML_SvgToPDF::debug($this);
+ $this->shiftChildren($x,$y);
+ }
+ function calcPerPage() {
+ $ret = array();
+ foreach($this->children as $n) {
+ if (!$n) {
+ continue;
+ }
+ if (!is_a($n, 'XML_SvgToPDF_G')) {
+ continue;
+ }
+ if (!isset($n->settings)) {
+ continue;
+ }
+
+ $rows = isset($n->settings['rows']) ? $n->settings['rows'] : 1;
+ $cols = isset($n->settings['cols']) ? $n->settings['cols'] : 1;
+
+
+ $ret[$n->settings['dynamic']] = $rows * $cols;
+
+
+
+ }
+ return $ret;
+
+
+
+
+
+ }
+
+ function toColor($color) {
+ if (!$color || ($color == 'none')) {
+ return false;
+ }
+
+ if ($color == 'black') {
+ $color = '#000000';
+ }
+
+ return array(
+ hexdec(substr($color,1,2)),
+ hexdec(substr($color,3,2)),
+ hexdec(substr($color,5,2)));
+
+ }
+
+
+}
--- /dev/null
+<?php
+
+/* code that deals with svg groups
+it does alot of smart stuff to handle 'dynamic' blocks
+
+*/
+
+
+class XML_SvgToPDFAlt_G extends XML_SvgToPDFAlt_Base {
+
+ function fromNode($node) {
+ parent::fromNode($node);
+ // look for
+ if (!@$this->children) {
+ return;
+ }
+ $settings = array(
+ 'rows' => 1,
+ 'cols' => 1
+ );
+
+ $isDynamic = false;
+ foreach(array_keys($this->children) as $k) {
+ if (!is_a($this->children[$k], 'XML_SvgToPDF_Text')) {
+ continue;
+ }
+
+ if (!isset($this->children[$k]->children[0]->content) ||
+ (strpos($this->children[$k]->children[0]->content,'=') === false)) {
+
+ continue;
+ }
+
+ foreach($this->children[$k]->children as $o) {
+ list($l,$r) = explode('=',$o->content);
+ $settings[$l] = $r;
+ }
+
+
+ unset($this->children[$k]);
+ $isDynamic = true;
+ break;
+ }
+
+ if (!$isDynamic) {
+ return;
+ }
+
+
+
+ //look for the bounding box..
+ $boundingbox = false;
+ foreach(array_keys($this->children) as $k) {
+ if (!is_a($this->children[$k], 'XML_SvgToPDF_Rect')) {
+ continue;
+ }
+ if (@$this->children[$k]->nonprintable == 'true') {
+ $boundingbox = clone($this->children[$k]);
+ $this->children[$k]->style['fill'] = 'none';
+ // unset($this->children[$k]);
+ }
+ }
+ if (!$boundingbox) {
+ return;
+ }
+
+ $this->boundingbox = $boundingbox;
+ $this->settings = $settings;
+ $this->shiftChildren($this->boundingbox->x,$this->boundingbox->y);
+ }
+
+ function shift($x,$y) {
+
+ if ($this->boundingbox) {
+ return;
+ }
+
+ $this->shiftChildren($x,$y);
+
+ }
+
+
+
+ function writePDF($pdf,$data) {
+ // g group = does it have a
+ // look for
+ if (!@$this->children) {
+ return;
+ }
+
+
+ if (empty($this->settings)) {
+ return $this->childrenWritePDF($pdf,$data);
+ }
+ $use = false;
+ if (substr($this->settings['dynamic'],-2,2) == '()') {
+
+ $use = $data->{substr($this->settings['dynamic'],0,-2)}();
+
+ } else {
+ $use = @$data[$this->settings['dynamic']];
+ }
+
+
+ if ($use === false) {
+ return;
+ }
+
+ if (!is_array($use) || !$use) {
+ return $this->childrenWritePDF($pdf,$data);
+ }
+
+
+
+
+ $this->x = $x = $this->boundingbox->x;
+ $this->y =$y = $this->boundingbox->y;
+ $w = $this->boundingbox->width;
+ $h = $this->boundingbox->height;
+
+
+ //echo '<PRE>';print_r($this);exit;
+ // shift... ** this does not handle groups!!!
+
+ //print_R($use);
+ $keys = array_keys($use);
+ $kpos = 0;
+ $kmax = count($keys);
+ //XML_SvgToPDF::debug(array($x,$y,$w,$h));
+ //XML_SvgToPDF::debug($keys);
+ XML_SvgToPDF::debug($this->settings);
+ for($r=0;$r<$this->settings['rows'];$r++) {
+ $yy = $y + ($r*$h);
+ for($c=0;$c<$this->settings['cols'];$c++) {
+ $xx = $x + ($c*$w);
+ XML_SvgToPDF::debug(array($xx,$yy));
+ foreach(array_keys($this->children) as $k) {
+ if (!$this->children[$k]) {
+ continue;
+ }
+ $this->children[$k]->xx = $xx;
+ $this->children[$k]->yy = $yy;
+ $this->children[$k]->maxWidth = $w - 20;
+ $this->children[$k]->writePDF($pdf,$use[$keys[$kpos]]);
+ }
+ $kpos++;
+ if ($kpos >= $kmax) {
+ break 2;
+ }
+ }
+ }
+
+
+
+ }
+
+
+
+
+}
--- /dev/null
+<?php
+
+/* output a rectangle
+
+*/
+
+class XML_SvgToPDFAlt_Image extends XML_SvgToPDFAlt_Base {
+ function writePDF($pdf,$data) {
+
+
+ $dir = dirname($GLOBALS['_XML_SVGTOPDF']['options']['file']);
+ $pdf->Image($dir .'/'.basename($this->href), $this->x/ 3.543307, $this->y/ 3.543307, $this->width/ 3.543307,$this->height/ 3.543307);
+
+
+ }
+
+
+
+
+}
--- /dev/null
+<?php
+
+/* output a line
+
+*/
+
+class XML_SvgToPDFAlt_Path extends XML_SvgToPDFAlt_Base {
+
+ function fromNode($node) {
+ parent::fromNode($node);
+ $d = explode(' ',trim($this->d));
+ $i=0;
+ $data = array();
+
+ while ($i < count($d)) {
+ $action = $d[$i];
+ switch(strtolower($action)) {
+
+
+
+ case 'c': // ????
+
+ $data[] = array('L',$d[$i+3],$d[$i+4]);
+ $i+=7;
+ break;
+ case 'm': // move
+ case 'l': // line
+ $data[] = array($action,$d[$i+1],$d[$i+2]);
+ $i+=3;
+ break;
+ case 'h': // move horizontal
+ case 'v': // move horizontal
+ $data[] = array($action,$d[$i+1]);
+ $i+=2;
+ break;
+
+
+ case 'z': // close path..
+ $data[] = array($action);
+ $i++;
+ break;
+ default:
+ echo "oops found something odd in path? '$action'";
+ echo $this->d;
+ exit;
+ break;
+ }
+ }
+ $this->d = $data;
+ }
+
+
+ // TODO!! - shift!!!
+
+
+
+
+
+ function shift($x,$y) {
+ //XML_SvgToPDF::debug('shift');
+ //XML_SvgToPDF::debug(array($x,$y));
+ //XML_SvgToPDF::debug($this);
+ foreach($this->d as $i=>$a) {
+ if (count($a) < 2) {
+ continue;
+ }
+ if ($a[0] == 'v') {
+ $this->d[$i][1] -= $y;
+ } else {
+ $this->d[$i][1] -= $x;
+ if (isset($this->d[$i][2])) {
+ $this->d[$i][2] -= $y;
+ }
+ }
+ }
+
+ }
+
+
+
+ function writePDF($pdf,$data) {
+
+ $l = $this->toColor(@$this->style['stroke']);
+ if ($l) {
+ $pdf->setDrawColor($l[0],$l[1],$l[2]);
+ }
+ $pdf->setLineWidth($this->style['stroke-width']/ 3.543307);
+
+ $c = array();
+ if (count($this->d) > 2) {
+ $cc = array();
+ foreach($this->d as $a) {
+ if (count($a) < 2) {
+ continue;
+ }
+ $x = $a[1] + @$this->xx;
+ $y = $a[2] + @$this->yy;
+ $cc[] = $x/ 3.543307;
+ $cc[] = $y/ 3.543307;
+ }
+ $pdf->line($cc,0,0,0);
+ return;
+ }
+
+ foreach($this->d as $a) {
+ switch($a[0]) {
+ case 'M':
+ $x = $a[1] + @$this->xx;
+ $y = $a[2] + @$this->yy;
+ $c = array($x,$y);
+ break;
+
+ case 'L':
+ $x = $a[1] + @$this->xx;
+ $y = $a[2] + @$this->yy;
+ $pdf->line($c[0]/ 3.543307,$c[1]/ 3.543307,$x/ 3.543307,$y/ 3.543307);
+ $c = array($x,$y);
+ break;
+ default:
+ break;
+ }
+ }
+
+
+
+
+ }
+
+
+
+
+
+ function toColor($color) {
+ if (!$color || ($color == 'none')) {
+ return false;
+ }
+ return array(
+ hexdec(substr($color,1,2)),
+ hexdec(substr($color,3,2)),
+ hexdec(substr($color,5,2)));
+
+ }
+
+
+
+}
--- /dev/null
+<?php
+
+/* output a rectangle
+
+*/
+
+class XML_SvgToPDFAlt_Rect extends XML_SvgToPDFAlt_Base {
+ function writePDF($pdf,$data) {
+ $x = $this->x + @$this->xx;
+ $y = $this->y + @$this->yy;
+
+
+
+ $pdf->setLineWidth($this->style['stroke-width']);
+ $f = $this->toColor($this->style['fill']);
+ if ($f) {
+ $pdf->setFillColor($f[0],$f[1],$f[2]);
+ }
+
+ $l = $this->toColor(@$this->style['stroke']);
+ if ($l) {
+ $pdf->setDrawColor($l[0],$l[1],$l[2]);
+ }
+ // no fill, no line = dont draw...
+ if (!$l && !$f) {
+ return;
+ }
+ XML_SvgToPDFAlt::debug("RECT:" .($x/ 3.543307).',' .($y/ 3.543307). ','
+ .($this->width/ 3.543307).',' . ($this->height/ 3.543307));
+ $pdf->rect($x/ 3.543307,$y/ 3.543307,
+ $this->width/ 3.543307,$this->height/ 3.543307,($l ? 'D' : ''). ($f ? 'F' : ''));
+
+
+
+ }
+
+
+ function toColor($color) {
+ if (!$color || ($color == 'none')) {
+ return false;
+ }
+ return array(
+ hexdec(substr($color,1,2)),
+ hexdec(substr($color,3,2)),
+ hexdec(substr($color,5,2)));
+
+ }
+
+
+}
\ No newline at end of file
--- /dev/null
+<?php
+
+
+class XML_SvgToPDFAlt_Text extends XML_SvgToPDFAlt_Base {
+
+ function fromNode($node) {
+ parent::fromNode($node);
+ if (!isset($this->children[0]->content)) {
+ return;
+ }
+ if (substr($this->children[0]->content,0,2) == '==') {
+ $this->style['text-anchor'] = 'justify';
+ $this->children[0]->content = substr($this->children[0]->content,2);
+ }
+ }
+
+ function transform() {
+ parent::transform();
+ if (!@$this->transform) {
+ return;
+ }
+ if (preg_match('/scale\(([0-9e.-]+),([0-9e.-]+)\)/',$this->transform,$args)) {
+ $xscale = $args[1];
+ $yscale = $args[2];
+ $this->style['font-size'] *= $args[1];
+ }
+ }
+
+
+
+
+ function writePDF($pdf,$data) {
+ // set up font..
+
+ $font = strtolower($this->style['font-family']);
+
+ static $map = array(
+ 'times new roman' => 'times',
+ 'courier new' => 'courier',
+ 'arial' => 'arial',
+ );
+ if (isset($map[$font])) {
+ $font = $map[$font];
+ } else {
+ $font = 'times';
+ }
+ if (preg_match('/big5/i',$this->style['font-family'])) {
+ $font = 'Big5';
+ }
+
+
+
+ $weight = '';
+ if ($this->style['font-weight'] == 'bold') {
+ $weight .= 'B';
+ }
+ if (@$this->style['font-style'] == 'italic') {
+ $weight .= 'I';
+ }
+
+ if (@$this->style['text-decoration'] == 'underline') {
+ $weight .= 'U';
+ }
+ // size..
+ $size = $this->style['font-size'] * 0.85;
+
+ $pdf->setFont($font,$weight,$size);
+
+ switch(@$this->style['text-anchor']) {
+ case 'end':
+ $align = 'E';
+ break;
+ case 'middle':
+ $align = 'M';
+ break;
+ case 'justify':
+ $align = 'J';
+ $max = 0;
+ foreach ($this->children as $child) {
+ if (!@$child->content) {
+ continue;
+ }
+ $l = $pdf->getStringWidth($child->content);
+ $max = ($l > $max) ? $l : $max;
+ }
+ // fudge factor!
+ $this->justifyLen = $max;
+ break;
+ default:
+ $align = 'L';
+
+ }
+
+ $f = $this->toColor(@$this->style['fill']);
+ if ($f) {
+ $pdf->setTextColor($f[0],$f[1],$f[2]);
+ }
+
+
+
+ $yoffset = 0;
+ $x = $this->x + @$this->xx;
+ $y = $this->y + @$this->yy;
+ if (!@$this->children) {
+ return;
+ }
+ $lineno = 0;
+ foreach($this->children as $i=>$c) {
+
+ $xx = isset($c->x) ? $c->x + @$this->xx : $x;
+ $yy = isset($c->y) ? $c->y + @$this->yy : $y + ($lineno * $size * 1.3);
+ $lineno++;
+ $val = @$c->content;
+
+ if (isset($c->args)) {
+
+ $args = array();
+ foreach($c->args as $v) {
+ if ($v == 'page') {
+ $args[] = $pdf->PageNo();
+ continue;
+ }
+ if ($v == 'nb') {
+ $args[] = '{nb}';
+ continue;
+ }
+ $args[] = $this->getValue($data,trim($v));
+ }
+
+ $has_template = preg_match('/%s/', $val);
+
+ $val = vsprintf($val,$args);
+
+ if ($has_template && ($font == 'Big5')) {
+ require_once 'Text/ZhDetect.php';
+ $detect = new Text_zhDetect;
+ $type = $detect->guess($val);
+ if ($v == 'S') {
+
+ $val = @iconv('utf8', 'GB2312//IGNORE', $val);
+ $pdf->setFont('GB' ,
+ $weight,
+ $size);
+ } else {
+ $val = @iconv('utf8', 'BIG5//IGNORE', $val);
+ $pdf->setFont('Big5' ,
+ $weight,
+ $size);
+ }
+ }
+
+ /*
+
+
+ if ($has_template && ($font == 'Big5')) {
+
+
+ $val = @iconv('utf8', 'utf16be//TRANSLIT', $val);
+
+ $pdf->setFont('Uni-hw' ,
+ $weight,
+ $size);
+ }
+ */
+ }
+
+ $talign = $align;
+ if ((!@$this->children[$i+1] || !strlen(trim(@$this->children[$i+1]->content))) && ($align == 'J')) {
+ $talign = 'L';
+ }
+
+
+
+
+
+
+
+
+ $yoffset += $this->multiLine($pdf,explode("\n",$val),
+ $xx/ 3.543307,
+ ($yy / 3.543307) + $yoffset,
+ ($size / 3.543307) + 1,
+ $talign
+ );
+
+
+ }
+
+ // now daraw
+
+ }
+
+ /**
+ * get a value from the data
+ *
+ * eg. $data = array(
+ * 'fred' => 'somevalue'
+ *
+ * getValue ($data,'fred') returns 'somevalue'
+ *
+ * value can also be a method = eg. getFred()
+ *
+ * @param object|array $data
+ * @param string $v key to get.
+ *
+ *
+ * @return string
+ * @access public
+ */
+
+ function iconvert($str) {
+ if (is_object($str) || is_array($str)) {
+ return $str;
+ }
+ return $str ;//. ' - ' . @iconv( "UTF-8" , "Big5//IGNORE", $str );
+ }
+
+ function getValue($data,$v) {
+
+ // not a method:
+
+ if ($v[strlen($v)-1] != ')') {
+ $data = (array) $data;
+ if (false === strpos($v,'.')) {
+ if (!isset($data[$v])) {
+ return '';
+ }
+ if (is_array($data[$v]) || is_object($data[$v])) {
+ return '';
+ }
+
+ return $this->iconvert(@$data[$v]);
+ }
+ $dd = (array)$data;
+ foreach(explode('.', $v) as $vv) {
+ if (!is_array($dd)) {
+ return '';
+ }
+ if (!isset($dd[$vv])) {
+ return '';
+ }
+ $dd = is_object($dd[$vv]) ? ((array) $dd[$vv]) : $this->iconvert($dd[$vv]);
+ }
+ //echo "ATTEMPT: $v: got $dd\n";
+ //exit;
+ if (is_array($dd) || is_object($dd)) {
+ return '';
+ }
+ return $this->iconvert($dd);
+ }
+ // method !!!
+ if (!is_object($data)) {
+ return '';
+ }
+ $method = substr($v,0,-2);
+ if (is_callable(array($data,$method))) {
+ $ret = $data->$method();
+ if (is_array($ret) || is_object($ret)) {
+ return '';
+ }
+ // not in original!!!
+ return $this->iconvert($ret);
+ }
+ //echo
+ //print_r($data);
+
+ //exit;
+ return "no method $method in ".get_class($data);
+
+
+ }
+
+
+ function breakLines(&$pdf,$str,$x,$y,$h,$align) {
+ // do the estimation...
+ $len = strlen($str);
+
+ $total = $pdf->getStringWidth($str . ' ');
+
+ $charsize = $total/$len;
+
+ $max_chars = floor(($this->maxWidth / 3.543307) / $charsize);
+ //echo "LEN: $len, $total, $charsize, $max_chars";
+ $lines = explode("\n",wordwrap($str,$max_chars));
+
+ return $this->multiLine($pdf,$lines,$x,$y,$h,$align);
+ }
+
+ function multiLine(&$pdf,$lines,$x,$y,$h,$align) {
+ // now dealing with mm
+ XML_SvgToPDFAlt::debug("MULTILINE " .implode("\n",$lines) . " $x, $y, $h");
+ $yoffset = 0;
+ $line = -1;
+ foreach ($lines as $l=>$v) {
+ $line++;
+ if (@$this->maxWidth && ($pdf->getStringWidth($v) > ($this->maxWidth / 3.543307))) {
+ $yoffset += $this->breakLines($pdf,$v,$x,$y + ($l * $h) + $yoffset, $h,$align);
+ continue;
+ }
+
+ $xoffset = 0;
+ if ($align == 'M') { // center
+ $xoffset = -1 * ($pdf->getStringWidth($v) / 2);
+ }
+ if ($align == 'E') { // right/end
+ $xoffset = -1 * $pdf->getStringWidth($v);
+ }
+
+ if ($align == 'J' ) { // justified (eg. started with ==
+ $this->justify($pdf, $x , $y + ($l * $h) + $yoffset , $v, $this->justifyLen);
+ continue;
+ }
+ XML_SvgToPDFAlt::debug("TEXT: " . ( $xoffset + $x ) . "," .
+ ($y + ($l * $h) + $yoffset) . "," .
+ $v);
+
+ $pdf->text(
+ $xoffset + $x ,
+ $y + ($l * $h) + $yoffset ,
+ $v);
+
+ }
+ return ($l * $h) + $yoffset;
+
+ }
+
+
+ function justify(&$pdf,$x,$y,$text,$len) {
+ if (!strlen(trim($text))) {
+ return;
+ }
+ $bits = explode(' ', $text);
+ $textlen = $pdf->getStringWidth(implode('',$bits));
+ $spacesize = ($len - $textlen) / (count($bits) -1);
+ foreach($bits as $word) {
+ $pdf->text($x , $y ,$word );
+ $x += $spacesize + $pdf->getStringWidth($word);
+ }
+ }
+
+
+
+}
--- /dev/null
+<?php
+
+/* the actual text container..
+
+does a quick bit of parsing to see if it a {template}var ..
+*/
+
+class XML_SvgToPDFAlt_Tspan extends XML_SvgToPDFAlt_Base {
+
+ function fromNode($node) {
+ parent::fromNode($node);
+ if (isset($this->x)) {
+ unset($this->x);
+ }
+ if (isset($this->y)) {
+ unset($this->y);
+ }
+ static $trans = false;
+ if (!$trans) {
+ $trans = array_flip(get_html_translation_table(HTML_ENTITIES));
+ }
+ if (@$this->content) {
+ if (strpos($this->content,'&') !== false) {
+ $this->content = strtr($this->content, $trans);
+ $this->content = str_replace(''',"'",$this->content);
+
+ $this->content = preg_replace_callback(
+ '/&#(\d+);/m',
+ function($m) { return chr($m[1]); } ,$this->content);
+ }
+ if (@$node->language) {
+ // todo - other conversions....
+
+ $this->content = mb_convert_encoding($this->content,'BIG-5','UTF-8');
+
+
+ }
+
+ if (false === strpos($this->content,'{')) {
+ return;
+ }
+ preg_match_all('/\{([a-z0-9_.]+(\(\))?)\}/i',$this->content,$matches);
+//echo "<PRE>"; print_r($matches);
+ //if (false !== strpos($this->content,'(')) {
+
+ // echo "<PRE>";print_R($matches);
+ // exit;
+ //}
+
+ $this->args = $matches[1];
+ foreach($this->args as $v) {
+ $this->content = str_replace('{'.$v.'}', '%s',$this->content);
+ }
+ //$this->content = preg_replace('/\{('.implode('|',$matches[1]).')\}/','%s',$this->content);
+ }
+
+ }
+
+
+
+
+}
* @var string
*/
var $version = '1.0';
+
+
+ var $obj = array();
/**
* Constructor
function getTreeFromFile ()
{
$this->folding = false;
- $this->XML_Parser(null, 'event');
+ parent::__construct(null, 'event');
$err = $this->setInputFile($this->filename);
if (PEAR::isError($err)) {
return $err;
function getTreeFromString($str)
{
$this->folding = false;
- $this->XML_Parser(null, 'event');
+ parent::__construct(null, 'event');
$this->cdata = null;
$err = $this->parseString($str);
if (PEAR::isError($err)) {
*
* @access private
*/
- function startHandler($xp, $elem, &$attribs)
+ function startHandler($xp, $elem, $attribs)
{
- $lineno = xml_get_current_line_number($xp);
+ $lineno = xml_get_current_line_number($this->parser);
// root elem
- if (!isset($this->i)) {
- $this->obj1 = $this->addRoot($elem, null, $attribs, $lineno);
+ if (empty($this->i)) {
+ $this->obj[1] = $this->addRoot($elem, null, $attribs, $lineno);
$this->i = 2;
} else {
// mixed contents
if (!empty($this->cdata)) {
- $parent_id = 'obj' . ($this->i - 1);
- $parent = $this->$parent_id;
+ $parent_id = $this->i - 1;
+ $parent = $this->obj[$parent_id];
$parent->children[] = new XML_Tree_Node(null, $this->cdata, null, $lineno);
}
- $obj_id = 'obj' . $this->i++;
- $this->$obj_id = new XML_Tree_Node($elem, null, $attribs, $lineno);
+ $obj_id = $this->i++;
+ $this->obj[$obj_id] = new XML_Tree_Node($elem, null, $attribs, $lineno);
}
$this->cdata = null;
return null;
*
* @access private
*/
- function endHandler($xp, $elem)
+ function endHandler($elem)
{
$this->i--;
if ($this->i > 1) {
- $obj_id = 'obj' . $this->i;
+ $obj_id = $this->i;
// recover the node created in StartHandler
- $node = $this->$obj_id;
+ $node = $this->obj[$obj_id];
// mixed contents
if (count($node->children) > 0) {
if (trim($this->cdata)) {
} else {
$node->setContent($this->cdata);
}
- $parent_id = 'obj' . ($this->i - 1);
- $parent = $this->$parent_id;
+ $parent_id = ($this->i - 1);
+ $parent = $this->obj[$parent_id];
// attach the node to its parent node children array
$parent->children[] = $node;
}
*/
function cdataHandler($xp, $data)
{
+ //var_dump($data);
if (trim($data) != '') {
$this->cdata .= $data;
}
return $result;
}
}
-?>
*/
class XML_Tree_Morph extends XML_Tree {
- var $cdata;
+ var $cdata = '';
var $_morphOptions;
+
+ var $i;
+
/**
* Constructor
- function endHandler($xp, $elem) {
+ function endHandler($elem) {
$this->i--;
if ($this->i > 1) {
- $obj_id = 'obj' . $this->i;
+ $obj_id = $this->i;
// recover the node created in StartHandler
- $node = $this->$obj_id;
+ $node = $this->obj[$obj_id];
// mixed contents
- if (count($node->children) > 0) {
- if (trim($this->cdata)) {
+ //var_dump($this->cdata, typeof($node->children);
+ if (is_array($node->children) && count($node->children) > 0) {
+ if (!empty($this->cdata) && trim($this->cdata)) {
$node->children[] = new XML_Tree_Node(null, $this->cdata);
}
- } else {
+ } else if ($this->cdata !== null) {
+
$node->setContent($this->cdata);
+ //var_dump(array($node, $this->cdata));
+ } else {
+ $node->setContent('');
}
- $parent_id = 'obj' . ($this->i - 1);
- $parent = $this->$parent_id;
+ $parent_id = ($this->i - 1);
+ $parent = $this->obj[$parent_id];
// attach the node to its parent node children array
-
+ // print_r($this);exit;
if (isset($this->_morphOptions['filter'][$node->name])) {
- $f = &$this->_morphOptions['filter'][$node->name];
+ $f = $this->_morphOptions['filter'][$node->name];
if (is_string($f) && method_exists($this,'morph'.$f)) {
$parent->children[] = $this->{'morph'.$this->_morphOptions['filter'][$node->name]}($node);
$this->cdata = null;
}
$parent->children[] = $node;
+
}
$this->cdata = null;
return null;
* @package XML_Tree
* @version 1.0 16-Aug-2001
*/
+#[AllowDynamicProperties]
+
class XML_Tree_Node {
/**
* Attributes of this node
* @var string
*/
var $name;
-
+
+ var $lineno;
/**
* Constructor
*
* @param string content Node content (text)
* @param array attributes Attribute-hash for the node
*/
- function XML_Tree_Node($name, $content = '', $attributes = array(), $lineno = null)
+ function __construct($name, $content = '', $attributes = array(), $lineno = null)
{
$this->name = $name;
- $this->setContent($content);
+ if ($content !== null) {
+ $this->setContent($content);
+ }
$this->attributes = $attributes;
$this->children = array();
$this->lineno = $lineno;
return null;
}
+ function hasAttribute($name)
+ {
+ return isset($this->attributes[strtolower($name)]);
+ }
+
/**
* Sets an attribute for this node.
*
*
* @access public
*/
- function setContent(&$content)
+ function setContent($content)
{
+
$this->content = $this->encodeXmlEntities($content);
+ // var_dump(array($this->content, $content));
}
/**
*/
function encodeXmlEntities($xml)
{
- $xml = str_replace(array('ü', 'Ü', 'ö',
+ $xml = preg_replace_callback("/[\x{0080}-\x{FFFF}]/u", function($v) {
+ // var_dump($v);
+ return '&#'. mb_ord($v[0]).';';
+
+ //"'&#'.ord('\\1').';'"
+ },
+ $xml
+ );
+ //var_dump($xml);
+ $xml = str_replace(array('ü', 'Ü', 'ö',
'Ö', 'ä', 'Ä',
'ß', '<', '>',
'"', '\''
),
$xml
);
- // fixme - remove the /e!!!
- $xml = @preg_replace(array("/\&([a-z\d\#]+)\;/i",
+ // var_dump($xml);
+ $xml = preg_replace(array("/\&([a-z\d\#]+)\;/i",
"/\&/",
"/\#\|\|([a-z\d\#]+)\|\|\#/i",
- "/([^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_])/e"
),
array("#||\\1||#",
"&",
"&\\1;",
- "'&#'.ord('\\1').';'"
+
),
$xml
- );
-
+ );
+
+/*
+ $xml = preg_replace_callback("/[^a-zA-Z\d\s\<\>\&\;\.\:\=\"\-\/\%\?\!\'\(\)\[\]\{\}\$\#\+\,\@_]/u",
+ function($v) {
+ var_dump($v);
+ return '&#'. mb_ord($v[0]).';';
+
+ //"'&#'.ord('\\1').';'"
+ },
+ $xml
+ );
+ */
+//var_dump($xml);
return $xml;
}