for the life of me i cant figure out what i am missing here
[php]<?php
$cwd = getcwd();
chdir( dirname(FILE) );
require ‘tfpdf/tfpdf.php’;
class FPDF extends tFPDF {}
{
private $_encoding = ‘UTF-8’;
var $angle=0;
}
public function Rotate($angle, $x=-1, $y=-1)
{
if($x==-1)
$x=$this->x;
if($y==-1)
$y=$this->y;
if($this->angle!=0)
$this->_out(‘Q’);
$this->angle=$angle;
if($angle!=0)
{
$angle*=M_PI/180;
$c=cos($angle);
$s=sin($angle);
$cx=$x*$this->k;
$cy=($this->h-$y)*$this->k;
$this->_out(sprintf(‘q %.5f %.5f %.5f %.5f %.2f %.2f cm 1 0 0 1 %.2f %.2f cm’, $c, $s, -$s, $c, $cx, $cy, -$cx, -$cy));
}
}
/*
Author : Fernando Herrero
Mail : fherrero[at]noticiasdenavarra.com
Program : pdf-cmyk.php
License : GPL v2
Description: Allow to use CMYK color space:
SetDrawColor() => Set draw color to black
SetDrawColor(int gray) => value in % (0 = black, 100 = white)
SetDrawColor(int red, int green, int blue) => 0 to 255
SetDrawColor(int cyan, int magenta, int yellow, int black) => values in % (0 to 100)
SetFillColor and SetTextColor same as SetDrawColor
Date : 2004-01-22
*/
public function SetDrawColor() {
//Set color for all stroking operations
switch(func_num_args()) {
case 1:
$g = func_get_arg(0);
$this->DrawColor = sprintf('%.3F G', $g / 100);
break;
case 3:
$r = func_get_arg(0);
$g = func_get_arg(1);
$b = func_get_arg(2);
$this->DrawColor = sprintf('%.3F %.3F %.3F RG', $r / 255, $g / 255, $b / 255);
break;
case 4:
$c = func_get_arg(0);
$m = func_get_arg(1);
$y = func_get_arg(2);
$k = func_get_arg(3);
$this->DrawColor = sprintf('%.3F %.3F %.3F %.3F K', $c / 100, $m / 100, $y / 100, $k / 100);
break;
default:
$this->DrawColor = '0 G';
}
if($this->page > 0)
$this->_out($this->DrawColor);
}
public function SetFillColor() {
//Set color for all filling operations
switch(func_num_args()) {
case 1:
$g = func_get_arg(0);
$this->FillColor = sprintf('%.3F g', $g / 100);
break;
case 3:
$r = func_get_arg(0);
$g = func_get_arg(1);
$b = func_get_arg(2);
$this->FillColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
break;
case 4:
$c = func_get_arg(0);
$m = func_get_arg(1);
$y = func_get_arg(2);
$k = func_get_arg(3);
$this->FillColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
break;
default:
$this->FillColor = '0 g';
}
$this->ColorFlag = ($this->FillColor != $this->TextColor);
if($this->page > 0)
$this->_out($this->FillColor);
}
public function SetTextColor() {
//Set color for text
switch(func_num_args()) {
case 1:
$g = func_get_arg(0);
$this->TextColor = sprintf('%.3F g', $g / 100);
break;
case 3:
$r = func_get_arg(0);
$g = func_get_arg(1);
$b = func_get_arg(2);
$this->TextColor = sprintf('%.3F %.3F %.3F rg', $r / 255, $g / 255, $b / 255);
break;
case 4:
$c = func_get_arg(0);
$m = func_get_arg(1);
$y = func_get_arg(2);
$k = func_get_arg(3);
$this->TextColor = sprintf('%.3F %.3F %.3F %.3F k', $c / 100, $m / 100, $y / 100, $k / 100);
break;
default:
$this->TextColor = '0 g';
}
$this->ColorFlag = ($this->FillColor != $this->TextColor);
}
/*
* END pdf-cmyk.php by Fernando Herrero
*/
public static function strip ($dirty=array())
{
if (is_array($dirty))
{
foreach ($dirty as $key=> $dirtyValue)
$clean[$key] = self::strip($dirtyValue);
} else {
$double = substr_count($dirty, "\"") == substr_count($dirty, "\\\"");
$single = substr_count($dirty, "'") == substr_count($dirty, "\\'");
$clean = self::encodeString( ($double && $single)? stripslashes($dirty): $dirty );
}
return $clean;
}
public static function encode_string ($string)
{
# create a utf32 string for comparison
$utf32_string = mb_convert_encoding($string, 'UTF-32', 'UTF-8');
# convert the utf32 string back to utf8, if it matches then the passed string is utf8
if ($string === mb_convert_encoding($utf32_string , 'UTF-8', 'UTF-32'))
{
return $string;
# otherwise it's not and should be converted
} else {
return mb_convert_encoding($string, 'UTF-8');
}
}
public function NbLines($w, $string)
{
$string = self::encode_string($string);
if ($this->FontSize < 0)
{
return 0;
}
$font_widths = $this->CurrentFont['cw'];
$max_width = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$string = str_replace("\r", '', $string);
$string_length = mb_strlen($string, $this->_encoding);
if (mb_substr($string, $string_length-1, 1, $this->_encoding) === "\n")
{
$string = mb_substr($string, 0, $string_length-1, $this->_encoding);
}
$last_space = -1;
$char_pos = 0;
$j = 0;
$line_length = 0;
$line_count = 1;
while($char = mb_substr($string, $char_pos, 1, $this->_encoding))
{
list(,$char_code) = unpack('N', mb_convert_encoding($char, 'UCS-4BE', $this->_encoding));
$char_width = isset($font_widths[$char_code])? $font_widths[$char_code]: 0;
if($char === "\n")
{
$char_pos++;
$line_count++;
$last_space = -1;
$j = $char_pos;
$line_length = 0;
continue;
}
if($char === ' ')
{
$last_space = $char_pos;
}
$line_length += $char_width;
if($line_length > $max_width)
{
if($last_space == -1)
{
($char_pos == $j) && $char_pos++;
} else {
$char_pos = $last_space+1;
}
$last_space = -1;
$j = $char_pos;
$line_length = 0;
$line_count++;
continue;
}
$char_pos++;
}
return $line_count;
}
}
require ‘FPDI-1.4/fpdi.php’;
chdir( $cwd );
[/php]