32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-12-23 08:58:55 +00:00

6.0.074 (2014-05-03)

- Bug #917 "Using realtive Units like ex or em for images distort output in HTML mode" was fixed.
- Bug #915 "Problem with SVG Image using Radial Gradients" was fixed.
This commit is contained in:
nicolaasuni 2014-05-03 14:34:00 +01:00
parent 214e1ea511
commit f40c7e4165
5 changed files with 30 additions and 27 deletions

View File

@ -1,3 +1,7 @@
6.0.074 (2014-05-03)
- Bug #917 "Using realtive Units like ex or em for images distort output in HTML mode" was fixed.
- Bug #915 "Problem with SVG Image using Radial Gradients" was fixed.
6.0.073 (2014-04-29) 6.0.073 (2014-04-29)
- Bug #913 "Possible bug with line-height" was fixed. - Bug #913 "Possible bug with line-height" was fixed.
- Bug #914 "MultiCell and FitCell" was fixed. - Bug #914 "MultiCell and FitCell" was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 6.0.073 Version: 6.0.074
Release date: 2014-04-29 Release date: 2014-05-03
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2014: Copyright (c) 2002-2014:

View File

@ -1,6 +1,6 @@
{ {
"name": "tecnick.com/tcpdf", "name": "tecnick.com/tcpdf",
"version": "6.0.073", "version": "6.0.074",
"homepage": "http://www.tcpdf.org/", "homepage": "http://www.tcpdf.org/",
"type": "library", "type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.", "description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version. * Current TCPDF version.
* @private static * @private static
*/ */
private static $tcpdf_version = '6.0.073'; private static $tcpdf_version = '6.0.074';
/** /**
* String alias for total number of pages. * String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 6.0.073 // Version : 6.0.074
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2014-04-29 // Last Update : 2014-05-03
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -104,7 +104,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 6.0.073 * @version 6.0.074
*/ */
// TCPDF configuration // TCPDF configuration
@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.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 6.0.073 * @version 6.0.074
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {
@ -2418,7 +2418,7 @@ class TCPDF {
if ($padding) { if ($padding) {
$height += ($this->cell_padding['T'] + $this->cell_padding['B']); $height += ($this->cell_padding['T'] + $this->cell_padding['B']);
} }
return round($height, 3); return round($height, 6);
} }
/** /**
@ -17295,9 +17295,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// vertically align image in line // vertically align image in line
if ((!$this->newline) AND ($dom[$key]['value'] == 'img') AND (isset($dom[$key]['height'])) AND ($dom[$key]['height'] > 0)) { if ((!$this->newline) AND ($dom[$key]['value'] == 'img') AND (isset($dom[$key]['height'])) AND ($dom[$key]['height'] > 0)) {
// get image height // get image height
$imgh = $this->getHTMLUnitToUnits($dom[$key]['height'], $this->lasth, 'px'); $imgh = $this->getHTMLUnitToUnits($dom[$key]['height'], 1, 'px');
$autolinebreak = false; $autolinebreak = false;
if (isset($dom[$key]['width']) AND ($dom[$key]['width'] > 0)) { if (!empty($dom[$key]['width'])) {
$imgw = $this->getHTMLUnitToUnits($dom[$key]['width'], 1, 'px', false); $imgw = $this->getHTMLUnitToUnits($dom[$key]['width'], 1, 'px', false);
if (($imgw <= ($this->w - $this->lMargin - $this->rMargin - $this->cell_padding['L'] - $this->cell_padding['R'])) if (($imgw <= ($this->w - $this->lMargin - $this->rMargin - $this->cell_padding['L'] - $this->cell_padding['R']))
AND ((($this->rtl) AND (($this->x - $imgw) < ($this->lMargin + $this->cell_padding['L']))) AND ((($this->rtl) AND (($this->x - $imgw) < ($this->lMargin + $this->cell_padding['L'])))
@ -17364,9 +17364,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$startliney = $this->y; $startliney = $this->y;
$this->newline = false; $this->newline = false;
} }
$this->y += (($this->getCellHeight($curfontsize / $this->k) + $curfontascent - $curfontdescent) / 2) - $imgh; $this->y += ($this->getCellHeight($curfontsize / $this->k) - ($curfontdescent * $this->cell_height_ratio) - $imgh);
$minstartliney = min($this->y, $minstartliney); $minstartliney = min($this->y, $minstartliney);
$maxbottomliney = ($startliney + $this->getCellHeight($this->FontSize)); $maxbottomliney = ($startliney + $this->getCellHeight($curfontsize / $this->k));
} }
} elseif (isset($dom[$key]['fontname']) OR isset($dom[$key]['fontstyle']) OR isset($dom[$key]['fontsize']) OR isset($dom[$key]['line-height'])) { } elseif (isset($dom[$key]['fontname']) OR isset($dom[$key]['fontstyle']) OR isset($dom[$key]['fontsize']) OR isset($dom[$key]['line-height'])) {
// account for different font size // account for different font size
@ -23014,7 +23014,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
return; return;
} }
$objstyle = ''; $objstyle = '';
$minlen = (0.01 / $this->k); // minimum acceptable length (3 point) $minlen = (0.01 / $this->k); // minimum acceptable length
if (!isset($svgstyle['opacity'])) { if (!isset($svgstyle['opacity'])) {
return $objstyle; return $objstyle;
} }
@ -23075,11 +23075,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
//set clipping area //set clipping area
if (!empty($clip_function) AND method_exists($this, $clip_function)) { if (!empty($clip_function) AND method_exists($this, $clip_function)) {
$bbox = call_user_func_array(array($this, $clip_function), $clip_params); $bbox = call_user_func_array(array($this, $clip_function), $clip_params);
if (is_array($bbox) AND (count($bbox) == 4)) { if ((!isset($gradient['type']) OR ($gradient['type'] != 3)) AND is_array($bbox) AND (count($bbox) == 4)) {
list($x, $y, $w, $h) = $bbox; list($x, $y, $w, $h) = $bbox;
} }
} }
if ($gradient['mode'] == 'measure') { if ($gradient['mode'] == 'measure') {
if (!isset($gradient['coords'][4])) {
$gradient['coords'][4] = 0.5;
}
if (isset($gradient['gradientTransform']) AND !empty($gradient['gradientTransform'])) { if (isset($gradient['gradientTransform']) AND !empty($gradient['gradientTransform'])) {
$gtm = $gradient['gradientTransform']; $gtm = $gradient['gradientTransform'];
// apply transformation matrix // apply transformation matrix
@ -23087,22 +23090,19 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$ya = ($gtm[1] * $gradient['coords'][0]) + ($gtm[3] * $gradient['coords'][1]) + $gtm[5]; $ya = ($gtm[1] * $gradient['coords'][0]) + ($gtm[3] * $gradient['coords'][1]) + $gtm[5];
$xb = ($gtm[0] * $gradient['coords'][2]) + ($gtm[2] * $gradient['coords'][3]) + $gtm[4]; $xb = ($gtm[0] * $gradient['coords'][2]) + ($gtm[2] * $gradient['coords'][3]) + $gtm[4];
$yb = ($gtm[1] * $gradient['coords'][2]) + ($gtm[3] * $gradient['coords'][3]) + $gtm[5]; $yb = ($gtm[1] * $gradient['coords'][2]) + ($gtm[3] * $gradient['coords'][3]) + $gtm[5];
if (isset($gradient['coords'][4])) { $r = sqrt(pow(($gtm[0] * $gradient['coords'][4]), 2) + pow(($gtm[1] * $gradient['coords'][4]), 2));
$gradient['coords'][4] = sqrt(pow(($gtm[0] * $gradient['coords'][4]), 2) + pow(($gtm[1] * $gradient['coords'][4]), 2));
}
$gradient['coords'][0] = $xa; $gradient['coords'][0] = $xa;
$gradient['coords'][1] = $ya; $gradient['coords'][1] = $ya;
$gradient['coords'][2] = $xb; $gradient['coords'][2] = $xb;
$gradient['coords'][3] = $yb; $gradient['coords'][3] = $yb;
$gradient['coords'][4] = $r;
} }
// convert SVG coordinates to user units // convert SVG coordinates to user units
$gradient['coords'][0] = $this->getHTMLUnitToUnits($gradient['coords'][0], 0, $this->svgunit, false); $gradient['coords'][0] = $this->getHTMLUnitToUnits($gradient['coords'][0], 0, $this->svgunit, false);
$gradient['coords'][1] = $this->getHTMLUnitToUnits($gradient['coords'][1], 0, $this->svgunit, false); $gradient['coords'][1] = $this->getHTMLUnitToUnits($gradient['coords'][1], 0, $this->svgunit, false);
$gradient['coords'][2] = $this->getHTMLUnitToUnits($gradient['coords'][2], 0, $this->svgunit, false); $gradient['coords'][2] = $this->getHTMLUnitToUnits($gradient['coords'][2], 0, $this->svgunit, false);
$gradient['coords'][3] = $this->getHTMLUnitToUnits($gradient['coords'][3], 0, $this->svgunit, false); $gradient['coords'][3] = $this->getHTMLUnitToUnits($gradient['coords'][3], 0, $this->svgunit, false);
if (isset($gradient['coords'][4])) { $gradient['coords'][4] = $this->getHTMLUnitToUnits($gradient['coords'][4], 0, $this->svgunit, false);
$gradient['coords'][4] = $this->getHTMLUnitToUnits($gradient['coords'][4], 0, $this->svgunit, false);
}
if ($w <= $minlen) { if ($w <= $minlen) {
$w = $minlen; $w = $minlen;
} }
@ -23122,9 +23122,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$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])) { $gradient['coords'][4] /= $w;
$gradient['coords'][4] /= $w;
}
} elseif ($gradient['mode'] == 'percentage') { } elseif ($gradient['mode'] == 'percentage') {
foreach($gradient['coords'] as $key => $val) { foreach($gradient['coords'] as $key => $val) {
$gradient['coords'][$key] = (intval($val) / 100); $gradient['coords'][$key] = (intval($val) / 100);
@ -23147,13 +23145,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$gradient['coords'][1] = $gradient['coords'][3]; $gradient['coords'][1] = $gradient['coords'][3];
$gradient['coords'][3] = $tmp; $gradient['coords'][3] = $tmp;
// set transformation map for gradient // set transformation map for gradient
$cy = ($this->h - $y);
if ($gradient['type'] == 3) { if ($gradient['type'] == 3) {
// circular gradient // circular gradient
$cy = $this->h - $y - ($gradient['coords'][1] * ($w + $h)); $cy -= ($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)));
} 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))); $cy -= $h;
} }
$this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $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);
} }