32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-25 13:57:33 +00:00
This commit is contained in:
nicolaasuni 2012-04-16 18:31:19 +01:00
parent d8cbe417c8
commit 9a76df62cd
3 changed files with 62 additions and 31 deletions

View File

@ -1,3 +1,6 @@
5.9.157 (2012-04-16)
- Some SVG-related bugs were fixed.
5.9.156 (2012-04-10) 5.9.156 (2012-04-10)
- Bug item #3515885 "TOC and booklet: left and right page exchanged". - Bug item #3515885 "TOC and booklet: left and right page exchanged".
- SetAutoPageBreak(false) now works also in multicolumn mode. - SetAutoPageBreak(false) now works also in multicolumn mode.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 5.9.156 Version: 5.9.157
Release date: 2012-04-10 Release date: 2012-04-16
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2012: Copyright (c) 2002-2012:

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 5.9.156 // Version : 5.9.157
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2012-04-10 // Last Update : 2012-04-16
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -137,7 +137,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p> * Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 5.9.156 * @version 5.9.157
*/ */
// Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
@ -149,7 +149,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.php');
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br> * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions. * @brief PHP class for generating PDF documents without requiring external extensions.
* @version 5.9.156 * @version 5.9.157
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {
@ -160,7 +160,7 @@ class TCPDF {
* Current TCPDF version. * Current TCPDF version.
* @private * @private
*/ */
private $tcpdf_version = '5.9.156'; private $tcpdf_version = '5.9.157';
// Protected properties // Protected properties
@ -27741,7 +27741,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// scale and translate // scale and translate
$e = $ox * $this->k * (1 - $svgscale_x); $e = $ox * $this->k * (1 - $svgscale_x);
$f = ($this->h - $oy) * $this->k * (1 - $svgscale_y); $f = ($this->h - $oy) * $this->k * (1 - $svgscale_y);
$this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, $e + $svgoffset_x, $f + $svgoffset_y)); $this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y)));
// creates a new XML parser to be used by the other XML functions // creates a new XML parser to be used by the other XML functions
$this->parser = xml_parser_create('UTF-8'); $this->parser = xml_parser_create('UTF-8');
// the following function allows to use parser inside object // the following function allows to use parser inside object
@ -28089,10 +28089,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$gradient['coords'][3] += $y; $gradient['coords'][3] += $y;
} }
// calculate percentages // calculate percentages
$gradient['coords'][0] = ($gradient['coords'][0] - $x) / $w; $gradient['coords'][0] = (($gradient['coords'][0] - $x) / $w);
$gradient['coords'][1] = ($gradient['coords'][1] - $y) / $h; $gradient['coords'][1] = (($gradient['coords'][1] - $y) / $h);
$gradient['coords'][2] = ($gradient['coords'][2] - $x) / $w; $gradient['coords'][2] = (($gradient['coords'][2] - $x) / $w);
$gradient['coords'][3] = ($gradient['coords'][3] - $y) / $h; $gradient['coords'][3] = (($gradient['coords'][3] - $y) / $h);
if (isset($gradient['coords'][4])) { if (isset($gradient['coords'][4])) {
$gradient['coords'][4] /= $w; $gradient['coords'][4] /= $w;
} }
@ -28121,9 +28121,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if ($gradient['type'] == 3) { if ($gradient['type'] == 3) {
// circular gradient // circular gradient
$cy = $this->h - $y - ($gradient['coords'][1] * ($w + $h)); $cy = $this->h - $y - ($gradient['coords'][1] * ($w + $h));
$this->_out(sprintf('%F 0 0 %F %F %F cm', $w*$this->k, $w*$this->k, $x*$this->k, $cy*$this->k)); $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($w * $this->k), ($x * $this->k), ($cy * $this->k)));
} else { } else {
$this->_out(sprintf('%F 0 0 %F %F %F cm', $w*$this->k, $h*$this->k, $x*$this->k, ($this->h-($y+$h))*$this->k)); $this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), (($this->h - ($y + $h)) * $this->k)));
} }
if (count($gradient['stops']) > 1) { if (count($gradient['stops']) > 1) {
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); $this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false);
@ -28752,15 +28752,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox'; $this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox';
} }
//$attribs['spreadMethod'] //$attribs['spreadMethod']
$x1 = (isset($attribs['x1'])?$attribs['x1']:'0%'); if (((!isset($attribs['x1'])) AND (!isset($attribs['y1'])) AND (!isset($attribs['x2'])) AND (!isset($attribs['y2'])))
$y1 = (isset($attribs['y1'])?$attribs['y1']:'0%'); OR ((isset($attribs['x1']) AND (substr($attribs['x1'], -1) == '%'))
$x2 = (isset($attribs['x2'])?$attribs['x2']:'100%'); OR (isset($attribs['y1']) AND (substr($attribs['y1'], -1) == '%'))
$y2 = (isset($attribs['y2'])?$attribs['y2']:'0%'); OR (isset($attribs['x2']) AND (substr($attribs['x2'], -1) == '%'))
if (substr($x1, -1) != '%') { OR (isset($attribs['y2']) AND (substr($attribs['y2'], -1) == '%')))) {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'percentage'; $this->svggradients[$this->svggradientid]['mode'] = 'percentage';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
} }
$x1 = (isset($attribs['x1'])?$attribs['x1']:'0');
$y1 = (isset($attribs['y1'])?$attribs['y1']:'0');
$x2 = (isset($attribs['x2'])?$attribs['x2']:'100');
$y2 = (isset($attribs['y2'])?$attribs['y2']:'0');
if (isset($attribs['gradientTransform'])) { if (isset($attribs['gradientTransform'])) {
$this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']); $this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']);
} }
@ -28788,16 +28792,18 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox'; $this->svggradients[$this->svggradientid]['gradientUnits'] = 'objectBoundingBox';
} }
//$attribs['spreadMethod'] //$attribs['spreadMethod']
if (((!isset($attribs['cx'])) AND (!isset($attribs['cy'])))
OR ((isset($attribs['cx']) AND (substr($attribs['cx'], -1) == '%'))
OR (isset($attribs['cy']) AND (substr($attribs['cy'], -1) == '%')) )) {
$this->svggradients[$this->svggradientid]['mode'] = 'percentage';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
}
$cx = (isset($attribs['cx'])?$attribs['cx']:0.5); $cx = (isset($attribs['cx'])?$attribs['cx']:0.5);
$cy = (isset($attribs['cy'])?$attribs['cy']:0.5); $cy = (isset($attribs['cy'])?$attribs['cy']:0.5);
$fx = (isset($attribs['fx'])?$attribs['fx']:$cx); $fx = (isset($attribs['fx'])?$attribs['fx']:$cx);
$fy = (isset($attribs['fy'])?$attribs['fy']:$cy); $fy = (isset($attribs['fy'])?$attribs['fy']:$cy);
$r = (isset($attribs['r'])?$attribs['r']:0.5); $r = (isset($attribs['r'])?$attribs['r']:0.5);
if (isset($attribs['cx']) AND (substr($attribs['cx'], -1) != '%')) {
$this->svggradients[$this->svggradientid]['mode'] = 'measure';
} else {
$this->svggradients[$this->svggradientid]['mode'] = 'percentage';
}
if (isset($attribs['gradientTransform'])) { if (isset($attribs['gradientTransform'])) {
$this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']); $this->svggradients[$this->svggradientid]['gradientTransform'] = $this->getSVGTransformMatrix($attribs['gradientTransform']);
} }
@ -29050,14 +29056,26 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// text // text
case 'text': case 'text':
case 'tspan': { case 'tspan': {
// only basic support - advanced features must be implemented
$this->svgtextmode['invisible'] = $invisible; $this->svgtextmode['invisible'] = $invisible;
if ($invisible) { if ($invisible) {
break; break;
} }
array_push($this->svgstyles, $svgstyle); array_push($this->svgstyles, $svgstyle);
// only basic support - advanced features must be implemented if (isset($attribs['x'])) {
$x = (isset($attribs['x'])?$this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false):$this->x); $x = $this->getHTMLUnitToUnits($attribs['x'], 0, $this->svgunit, false);
$y = (isset($attribs['y'])?$this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false):$this->y); } elseif ($name == 'tspan') {
$x = $this->x;
} else {
$x = 0;
}
if (isset($attribs['y'])) {
$y = $this->getHTMLUnitToUnits($attribs['y'], 0, $this->svgunit, false);
} elseif ($name == 'tspan') {
$y = $this->y;
} else {
$y = 0;
}
$svgstyle['text-color'] = $svgstyle['fill']; $svgstyle['text-color'] = $svgstyle['fill'];
$this->svgtext = ''; $this->svgtext = '';
if (isset($svgstyle['text-anchor'])) { if (isset($svgstyle['text-anchor'])) {
@ -29096,8 +29114,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if (isset($attribs['id'])) { if (isset($attribs['id'])) {
unset($attribs['id']); unset($attribs['id']);
} }
$attribs = array_merge($use['attribs'], $attribs); $attribs = array_merge($attribs, $use['attribs']);
$this->startSVGElementHandler($parser, $use['name'], $use['attribs']); $this->startSVGElementHandler($parser, $use['name'], $attribs);
} }
break; break;
} }
@ -29162,7 +29180,17 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$textrendermode = $this->textrendermode; $textrendermode = $this->textrendermode;
$textstrokewidth = $this->textstrokewidth; $textstrokewidth = $this->textstrokewidth;
$this->setTextRenderingMode($this->svgtextmode['stroke'], true, false); $this->setTextRenderingMode($this->svgtextmode['stroke'], true, false);
if ($name == 'text') {
// store current coordinates
$tmpx = $this->x;
$tmpy = $this->y;
}
$this->Cell($textlen, 0, $text, 0, 0, '', false, '', 0, false, 'L', 'T'); $this->Cell($textlen, 0, $text, 0, 0, '', false, '', 0, false, 'L', 'T');
if ($name == 'text') {
// restore coordinates
$this->x = $tmpx;
$this->y = $tmpy;
}
// restore previous rendering mode // restore previous rendering mode
$this->textrendermode = $textrendermode; $this->textrendermode = $textrendermode;
$this->textstrokewidth = $textstrokewidth; $this->textstrokewidth = $textstrokewidth;