webgame php源码,fpdf.php 源代码在线查看 – WEBGAME源码,有架设说明,只是非常简单 资源下载 虫虫电子下载站…[通俗易懂]

webgame php源码,fpdf.php 源代码在线查看 – WEBGAME源码,有架设说明,只是非常简单 资源下载 虫虫电子下载站…[通俗易懂]$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);…

大家好,欢迎来到IT知识分享网。

$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 { //Get next character $c=$s{$i}; 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($c==’ ‘) $sep=$i; $l+=$cw[$c]; if($l>$wmax) { //Automatic line break if($sep==-1) { 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++; $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=$sep+1; } $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++; } //Last chunk if($i!=$j) $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,”,0,$link);}function Image($file,$x,$y,$w=0,$h=0,$type=”,$link=”){ //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’ or $type==’jpeg’) $info=$this->_parsejpg($file); elseif($type==’png’) $info=$this->_parsepng($file); 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); $info[‘i’]=count($this->images)+1; $this->images[$file]=$info; } else $info=$this->images[$file]; //Automatic width and height calculation if needed if($w==0 and $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’]; $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);}function Ln($h=”){ //Line feed; default value is last cell height $this->x=$this->lMargin; if(is_string($h)) $this->y+=$this->lasth; else $this->y+=$h;}function GetX(){ //Get x position return $this->x;}function SetX($x){ //Set x position if($x>=0) $this->x=$x; else $this->x=$this->w+$x;}function GetY(){ //Get y position return $this->y;}function SetY($y){ //Set y position and reset x $this->x=$this->lMargin; if($y>=0) $this->y=$y; else $this->y=$this->h+$y;}function SetXY($x,$y){ //Set x and y positions $this->SetY($y); $this->SetX($x);}function Output($name=”,$dest=”){ //Output PDF to some destination // lem9 //global $HTTP_SERVER_VARS; //Finish document if necessary if($this->state $this->Close(); //Normalize parameters if(is_bool($dest)) $dest=$dest ? ‘D’ : ‘F’; $dest=strtoupper($dest); if($dest==”) { if($name==”) { $name=’doc.pdf’; $dest=’I’; } else $dest=’F’; } switch($dest) { case ‘I’: //Send to standard output // lem9 //if(isset($HTTP_SERVER_VARS[‘SERVER_NAME’])) if(PMA_getenv(‘SERVER_NAME’)) { //We send to a browser Header(‘Content-Type: application/pdf’); if(headers_sent()) $this->Error(‘Some data has already been output to browser, can\’t send PDF file’); Header(‘Content-Length: ‘.strlen($this->buffer)); Header(‘Content-disposition: inline; filename=”‘.$name.'”‘); } echo $this->buffer; break; case ‘D’: //Download file // lem9 //if(isset($HTTP_SERVER_VARS[‘HTTP_USER_AGENT’]) and strpos($HTTP_SERVER_VARS[‘HTTP_USER_AGENT’],’MSIE’)) if(PMA_getenv(‘HTTP_USER_AGENT’) and strpos(PMA_getenv(‘HTTP_USER_AGENT’), ‘MSIE’)) Header(‘Content-Type: application/force-download’); else Header(‘Content-Type: application/octet-stream’); if(headers_sent()) $this->Error(‘Some data has already been output to browser, can\’t send PDF file’); Header(‘Content-Length: ‘.strlen($this->buffer)); Header(‘Content-disposition: attachment; filename=”‘.$name.'”‘); echo $this->buffer; break; case ‘F’: //Save to local file $f=fopen($name,’wb’); if(!$f) $this->Error(‘Unable to create output file: ‘.$name); fwrite($f,$this->buffer,strlen($this->buffer)); fclose($f); break; case ‘S’: //Return as a string return $this->buffer; default: $this->Error(‘Incorrect output destination: ‘.$dest); } return ”;}/******************************************************************************** ** Protected methods ** ********************************************************************************/function _dochecks(){ //Check for locale-related bug if(1.1==1) $this->Error(‘Don\’t alter the locale before including class file’); //Check for decimal separator if(sprintf(‘%.1f’,1.0)!=’1.0′) setlocale(LC_NUMERIC,’C’);}function _begindoc(){ //Start document $this->state=1; $this->_out(‘%PDF-1.3′);}function _strreplace($what, $to, $where) { return str_replace($what, $to, $where);}function _putpages(){ $nb=$this->page; if(!empty($this->AliasNbPages)) { //Replace number of pages for($n=1;$n $this->pages[$n]=$this->_strreplace($this->AliasNbPages,$nb,$this->pages[$n]); } if($this->DefOrientation==’P’) { $wPt=$this->fwPt; $hPt=$this->fhPt; } else { $wPt=$this->fhPt; $hPt=$this->fwPt; } $filter=($this->compress) ? ‘/Filter /FlateDecode ‘ : ”; for($n=1;$n { //Page $this->_newobj(); $this->_out(‘ $this->_out(‘/Parent 1 0 R’); if(isset($this->OrientationChanges[$n])) $this->_out(sprintf(‘/MediaBox [0 0 %.2f %.2f]’,$hPt,$wPt)); $this->_out(‘/Resources 2 0 R’); if(isset($this->PageLinks[$n])) { //Links $annots=’/Annots [‘; foreach($this->PageLinks[$n] as $pl) { $rect=sprintf(‘%.2f %.2f %.2f %.2f’,$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); $annots.=’ if(is_string($pl[4])) $annots.=’/A >>>’; else { $l=$this->links[$pl[4]]; $h=isset($this->OrientationChanges[$l[0]]) ? $wPt : $hPt; $annots.=sprintf(‘/Dest [%d 0 R /XYZ 0 %.2f null]>>’,1+2*$l[0],$h-$l[1]*$this->k); } } $this->_out($annots.’]’); } $this->_out(‘/Contents ‘.($this->n+1).’ 0 R>>’); $this->_out(‘endobj’); //Page content $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; $this->_newobj(); $this->_out(”); $this->_putstream($p); $this->_out(‘endobj’); } //Pages root $this->offsets[1]=strlen($this->buffer); $this->_out(‘1 0 obj’); $this->_out(‘ $kids=’/Kids [‘; for($i=0;$i $kids.=(3+2*$i).’ 0 R ‘; $this->_out($kids.’]’); $this->_out(‘/Count ‘.$nb); $this->_out(sprintf(‘/MediaBox [0 0 %.2f %.2f]’,$wPt,$hPt)); $this->_out(‘>>’); $this->_out(‘endobj’);}function _putfonts(){ $nf=$this->n; foreach($this->diffs as $diff) { //Encodings $this->_newobj(); $this->_out(”); $this->_out(‘endobj’); } $mqr=get_magic_quotes_runtime(); set_magic_quotes_runtime(0); 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(‘ 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’); } set_magic_quotes_runtime($mqr); foreach($this->fonts as $k=>$font) { //Font objects $this->fonts[$k][‘n’]=$this->n+1; $type=$font[‘type’]; $name=$font[‘name’]; if($type==’core’) { //Standard font $this->_newobj(); $this->_out(‘ $this->_out(‘/BaseFont /’.$name); $this->_out(‘/Subtype /Type1′); if($name!=’Symbol’ and $name!=’ZapfDingbats’) $this->_out(‘/Encoding /WinAnsiEncoding’); $this->_out(‘>>’); $this->_out(‘endobj’); } elseif($type==’Type1′ or $type==’TrueType’) { //Additional Type1 or TrueType font $this->_newobj(); $this->_out(‘ $this->_out(‘/BaseFont /’.$name); $this->_out(‘/Subtype /’.$type); $this->_out(‘/FirstChar 32 /LastChar 255’); $this->_out(‘/Widths ‘.($this->n+1).’ 0 R’); $this->_out(‘/FontDescriptor ‘.($this->n+2).’ 0 R’); if($font[‘enc’])

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/7532.html

(0)
上一篇 2022-12-20 22:00
下一篇 2023-01-06 08:50

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信