32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-17 10:35:11 +00:00
This commit is contained in:
nicolaasuni 2010-08-26 11:46:00 +02:00
parent dfca9ce46f
commit c318a61d79
22 changed files with 403 additions and 381 deletions

View File

@ -1,3 +1,8 @@
5.8.019 (2010-08-26)
- XObject Templates now includes support for links and annotations.
- A problem related to link alignment on cell was fixed.
- A problem related to SVG styles was fixed.
5.8.018 (2010-08-25) 5.8.018 (2010-08-25)
- Method getNumberOfColumns() was added. - Method getNumberOfColumns() was added.
- A problem related to table header was fixed. - A problem related to table header was fixed.

View File

@ -8,8 +8,8 @@ http: sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 5.8.018 Version: 5.8.019
Release date: 2010-08-25 Release date: 2010-08-26
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2010: Copyright (c) 2002-2010:

View File

@ -60,7 +60,7 @@
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1003,7 +1003,7 @@ $code)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -5551,7 +5551,7 @@ $frame)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

File diff suppressed because it is too large Load Diff

View File

@ -299,7 +299,7 @@ $type)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1377,7 +1377,7 @@ $type)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -542,7 +542,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -97,7 +97,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -157,7 +157,7 @@ Class to create PDF417 barcode arrays for TCPDF class.<br /><br /><p>PDF417 (ISO
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -480,7 +480,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -82,7 +82,7 @@ This is a PHP class for generating PDF documents without requiring external exte
<td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td> <td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td>
</tr> </tr>
<tr> <tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>5.8.018</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>5.8.019</td>
</tr> </tr>
<tr> <tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td> <td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td>
@ -113,7 +113,7 @@ unicode data<br /><br /></div>
<div class="tags"> <div class="tags">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border"> <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code"> <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>PDF_PRODUCER = 'TCPDF 5.8.018 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 5.8.019 (http://www.tcpdf.org)'</code>
</td></tr></table> </td></tr></table>
</td></tr></table> </td></tr></table>
@ -124,7 +124,7 @@ unicode data<br /><br /></div>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:13 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -246,7 +246,7 @@ Unicode data for TCPDF library.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -2056,7 +2056,7 @@
<a href="elementindex.html#top">top</a><br> <a href="elementindex.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -2088,7 +2088,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br> <a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br> <a href="#Post-parsing">Post-parsing</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 25 Aug 2010 20:19:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Thu, 26 Aug 2010 11:45:47 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 5.8.018 // Version : 5.8.019
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2010-08-25 // Last Update : 2010-08-26
// Author : Nicola Asuni - Tecnick.com S.r.l - Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com S.r.l - Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - 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)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -128,7 +128,7 @@
* @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 5.8.018 * @version 5.8.019
*/ */
/** /**
@ -152,14 +152,14 @@ if (!class_exists('TCPDF', false)) {
/** /**
* define default PDF document producer * define default PDF document producer
*/ */
define('PDF_PRODUCER', 'TCPDF 5.8.018 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 5.8.019 (http://www.tcpdf.org)');
/** /**
* This is a PHP class for generating PDF documents without requiring external extensions.<br> * This is a PHP class for generating PDF documents without requiring external extensions.<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> * 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>
* @name TCPDF * @name TCPDF
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 5.8.018 * @version 5.8.019
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -1523,7 +1523,7 @@ if (!class_exists('TCPDF', false)) {
protected $xobjects = array(); protected $xobjects = array();
/** /**
* @var boolean true when we are inside a XObject * @var boolean true when we are inside an XObject
* @access protected * @access protected
* @since 5.8.017 (2010-08-24) * @since 5.8.017 (2010-08-24)
*/ */
@ -3529,7 +3529,7 @@ if (!class_exists('TCPDF', false)) {
*/ */
public function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) { public function AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false) {
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // we are inside an XObject template
return; return;
} }
if (!isset($this->original_lMargin) OR $keepmargins) { if (!isset($this->original_lMargin) OR $keepmargins) {
@ -4566,7 +4566,7 @@ if (!class_exists('TCPDF', false)) {
$subsetchars = array_fill(0, 256, true); $subsetchars = array_fill(0, 256, true);
$this->setFontBuffer($fontkey, array('fontkey' => $fontkey, 'i' => $this->numfonts, 'type' => $type, 'name' => $name, 'desc' => $desc, 'up' => $up, 'ut' => $ut, 'cw' => $cw, 'dw' => $dw, 'enc' => $enc, 'cidinfo' => $cidinfo, 'file' => $file, 'ctg' => $ctg, 'subset' => $subset, 'subsetchars' => $subsetchars)); $this->setFontBuffer($fontkey, array('fontkey' => $fontkey, 'i' => $this->numfonts, 'type' => $type, 'name' => $name, 'desc' => $desc, 'up' => $up, 'ut' => $ut, 'cw' => $cw, 'dw' => $dw, 'enc' => $enc, 'cidinfo' => $cidinfo, 'file' => $file, 'ctg' => $ctg, 'subset' => $subset, 'subsetchars' => $subsetchars));
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // we are inside an XObject template
$this->xobjects[$this->xobjid]['fonts'][$fontkey] = $this->numfonts; $this->xobjects[$this->xobjid]['fonts'][$fontkey] = $this->numfonts;
} }
if (isset($diff) AND (!empty($diff))) { if (isset($diff) AND (!empty($diff))) {
@ -4723,10 +4723,6 @@ if (!class_exists('TCPDF', false)) {
* @see Cell(), Write(), Image(), Link(), SetLink() * @see Cell(), Write(), Image(), Link(), SetLink()
*/ */
public function AddLink() { public function AddLink() {
if ($this->inxobj) {
// we are inside a template
return;
}
//Create a new internal link //Create a new internal link
$n = count($this->links) + 1; $n = count($this->links) + 1;
$this->links[$n] = array(0, 0); $this->links[$n] = array(0, 0);
@ -4743,10 +4739,6 @@ if (!class_exists('TCPDF', false)) {
* @see AddLink() * @see AddLink()
*/ */
public function SetLink($link, $y=0, $page=-1) { public function SetLink($link, $y=0, $page=-1) {
if ($this->inxobj) {
// we are inside a template
return;
}
if ($y == -1) { if ($y == -1) {
$y = $this->y; $y = $this->y;
} }
@ -4788,7 +4780,8 @@ if (!class_exists('TCPDF', false)) {
*/ */
public function Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), $spaces=0) { public function Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), $spaces=0) {
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // store parameters for later use on template
$this->xobjects[$this->xobjid]['annotations'][] = array('x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'text' => $text, 'opt' => $opt, 'spaces' => $spaces);
return; return;
} }
if ($x === '') { if ($x === '') {
@ -4798,7 +4791,7 @@ if (!class_exists('TCPDF', false)) {
$y = $this->y; $y = $this->y;
} }
// recalculate coordinates to account for graphic transformations // recalculate coordinates to account for graphic transformations
if (isset($this->transfmatrix)) { if (isset($this->transfmatrix) AND !empty($this->transfmatrix)) {
for ($i=$this->transfmatrix_key; $i > 0; --$i) { for ($i=$this->transfmatrix_key; $i > 0; --$i) {
$maxid = count($this->transfmatrix[$i]) - 1; $maxid = count($this->transfmatrix[$i]) - 1;
for ($j=$maxid; $j >= 0; --$j) { for ($j=$maxid; $j >= 0; --$j) {
@ -5095,7 +5088,7 @@ if (!class_exists('TCPDF', false)) {
} }
case 'B': { case 'B': {
// bottom // bottom
$y -= ($h - $this->FontAscent - $this->FontDescent - ($this->LineWidth / 2)); $y -= ($h - $this->FontAscent - $this->FontDescent - $this->cMargin - ($this->LineWidth / 2));
break; break;
} }
default: default:
@ -5118,7 +5111,7 @@ if (!class_exists('TCPDF', false)) {
} }
case 'B': { case 'B': {
// bottom // bottom
$y -= ($h - $this->FontDescent - ($this->LineWidth / 2)); $y -= ($h - $this->FontDescent- $this->cMargin - ($this->LineWidth / 2));
break; break;
} }
default: default:
@ -5136,7 +5129,7 @@ if (!class_exists('TCPDF', false)) {
switch ($valign) { switch ($valign) {
case 'T': { case 'T': {
// top // top
$y -= ($this->FontAscent + $this->FontDescent + ($this->LineWidth / 2)); $y -= ($this->FontAscent + $this->FontDescent + $this->cMargin + ($this->LineWidth / 2));
break; break;
} }
case 'B': { case 'B': {
@ -5148,7 +5141,7 @@ if (!class_exists('TCPDF', false)) {
case 'C': case 'C':
case 'M': { case 'M': {
// center // center
$y -= (($h + $this->FontAscent + $this->FontDescent) / 2); $y -= (($h + $this->FontAscent + $this->FontDescent) / 2) + $this->cMargin;
break; break;
} }
} }
@ -5175,11 +5168,13 @@ if (!class_exists('TCPDF', false)) {
case 'T': { case 'T': {
// top // top
$basefonty = $y + $this->FontAscent + ($this->LineWidth / 2); $basefonty = $y + $this->FontAscent + ($this->LineWidth / 2);
$yt = $y + ($this->LineWidth / 2);
break; break;
} }
case 'B': { case 'B': {
// bottom // bottom
$basefonty = $y + $h - $this->FontDescent - ($this->LineWidth / 2); $basefonty = $y + $h - $this->FontDescent - $this->cMargin - ($this->LineWidth / 2);
$yt = $y + $h - $this->FontSize - $this->cMargin - ($this->LineWidth / 2);
break; break;
} }
default: default:
@ -5187,6 +5182,7 @@ if (!class_exists('TCPDF', false)) {
case 'M': { case 'M': {
// center // center
$basefonty = $y + (($h + $this->FontAscent - $this->FontDescent) / 2); $basefonty = $y + (($h + $this->FontAscent - $this->FontDescent) / 2);
$yt = $y + (($h - $this->FontSize) / 2);
break; break;
} }
} }
@ -5385,7 +5381,7 @@ if (!class_exists('TCPDF', false)) {
$s .= ' Q'; $s .= ' Q';
} }
if ($link) { if ($link) {
$this->Link($xdx, $y + (($h - $this->FontSize)/2), $width, $this->FontSize, $link, $ns); $this->Link($xdx, $yt, $width, ($this->FontSize + $this->cMargin), $link, $ns);
} }
} }
// output cell // output cell
@ -6971,7 +6967,7 @@ if (!class_exists('TCPDF', false)) {
} }
$this->endlinex = $this->img_rb_x; $this->endlinex = $this->img_rb_x;
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // we are inside an XObject template
$this->xobjects[$this->xobjid]['images'][] = $info['i']; $this->xobjects[$this->xobjid]['images'][] = $info['i'];
} }
return $info['i']; return $info['i'];
@ -8077,6 +8073,7 @@ if (!class_exists('TCPDF', false)) {
// reference to XObject that define the appearance for this mode-state // reference to XObject that define the appearance for this mode-state
$apsobjid = $this->_putAPXObject($c, $d, $stream); $apsobjid = $this->_putAPXObject($c, $d, $stream);
$annots .= ' /'.$apstate.' '.$apsobjid.' 0 R'; $annots .= ' /'.$apstate.' '.$apsobjid.' 0 R';
$annots .= ' /'.$apstate.' /'.$stream;
} }
$annots .= ' >>'; $annots .= ' >>';
} else { } else {
@ -10527,7 +10524,7 @@ if (!class_exists('TCPDF', false)) {
protected function _out($s) { protected function _out($s) {
if ($this->state == 2) { if ($this->state == 2) {
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // we are inside an XObject template
$this->xobjects[$this->xobjid]['outdata'] .= $s."\n"; $this->xobjects[$this->xobjid]['outdata'] .= $s."\n";
} elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) { } elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
// puts data before page footer // puts data before page footer
@ -14379,6 +14376,11 @@ if (!class_exists('TCPDF', false)) {
$prop['display'] = 'display.noPrint'; $prop['display'] = 'display.noPrint';
// get annotation data // get annotation data
$popt = $this->getAnnotOptFromJSProp($prop); $popt = $this->getAnnotOptFromJSProp($prop);
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
$fontstyle = sprintf('/F%d %.2F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
$popt['da'] = $fontstyle;
$popt['ap'] = array();
$popt['ap']['n'] = 'q BT '.$fontstyle.' ET Q';
// set additional default options // set additional default options
if (!isset($popt['mk'])) { if (!isset($popt['mk'])) {
$popt['mk'] = array(); $popt['mk'] = array();
@ -14393,11 +14395,6 @@ if (!class_exists('TCPDF', false)) {
$popt['mk']['ca'] = $this->_textstring($caption, $ann_obj_id); $popt['mk']['ca'] = $this->_textstring($caption, $ann_obj_id);
$popt['mk']['rc'] = $this->_textstring($caption, $ann_obj_id); $popt['mk']['rc'] = $this->_textstring($caption, $ann_obj_id);
$popt['mk']['ac'] = $this->_textstring($caption, $ann_obj_id); $popt['mk']['ac'] = $this->_textstring($caption, $ann_obj_id);
$this->annotation_fonts[$this->CurrentFont['fontkey']] = $this->CurrentFont['i'];
$fontstyle = sprintf('/F%d %.2F Tf %s', $this->CurrentFont['i'], $this->FontSizePt, $this->TextColor);
$popt['da'] = $fontstyle;
$popt['ap'] = array();
$popt['ap']['n'] = 'q BT '.$fontstyle.' ET Q';
// merge options // merge options
$opt = array_merge($popt, $opt); $opt = array_merge($popt, $opt);
// set remaining annotation data // set remaining annotation data
@ -22496,7 +22493,7 @@ if (!class_exists('TCPDF', false)) {
*/ */
public function startTemplate($w=0, $h=0) { public function startTemplate($w=0, $h=0) {
if ($this->inxobj) { if ($this->inxobj) {
// we are inside a template // we are already inside an XObject template
return false; return false;
} }
$this->inxobj = true; $this->inxobj = true;
@ -22512,6 +22509,7 @@ if (!class_exists('TCPDF', false)) {
$this->xobjects[$this->xobjid]['xobjects'] = array(); $this->xobjects[$this->xobjid]['xobjects'] = array();
$this->xobjects[$this->xobjid]['images'] = array(); $this->xobjects[$this->xobjid]['images'] = array();
$this->xobjects[$this->xobjid]['fonts'] = array(); $this->xobjects[$this->xobjid]['fonts'] = array();
$this->xobjects[$this->xobjid]['annotations'] = array();
// set new environment // set new environment
$this->num_columns = 1; $this->num_columns = 1;
$this->current_column = 0; $this->current_column = 0;
@ -22598,8 +22596,8 @@ if (!class_exists('TCPDF', false)) {
if ($y === '') { if ($y === '') {
$y = $this->y; $y = $this->y;
} }
$ow = $this->xobjects[$this->xobjid]['w']; $ow = $this->xobjects[$id]['w'];
$oh = $this->xobjects[$this->xobjid]['h']; $oh = $this->xobjects[$id]['h'];
// calculate image width and height on document // calculate image width and height on document
if (($w <= 0) AND ($h <= 0)) { if (($w <= 0) AND ($h <= 0)) {
$w = $ow; $w = $ow;
@ -22640,8 +22638,8 @@ if (!class_exists('TCPDF', false)) {
// print XObject Template + Transformation matrix // print XObject Template + Transformation matrix
$this->StartTransform(); $this->StartTransform();
// translate and scale // translate and scale
$sx = ($w / $this->xobjects[$this->xobjid]['w']); $sx = ($w / $this->xobjects[$id]['w']);
$sy = ($h / $this->xobjects[$this->xobjid]['h']); $sy = ($h / $this->xobjects[$id]['h']);
$tm = array(); $tm = array();
$tm[0] = $sx; $tm[0] = $sx;
$tm[1] = 0; $tm[1] = 0;
@ -22653,6 +22651,19 @@ if (!class_exists('TCPDF', false)) {
// set object // set object
$this->_out('/'.$id.' Do'); $this->_out('/'.$id.' Do');
$this->StopTransform(); $this->StopTransform();
// add annotations
if (!empty($this->xobjects[$id]['annotations'])) {
foreach ($this->xobjects[$id]['annotations'] as $annot) {
// transform original coordinates
$coordlt = $this->getTransformationMatrixProduct($tm, array(1, 0, 0, 1, ($annot['x'] * $this->k), (-$annot['y'] * $this->k)));
$ax = ($coordlt[4] / $this->k);
$ay = ($this->h - $h - ($coordlt[5] / $this->k));
$coordrb = $this->getTransformationMatrixProduct($tm, array(1, 0, 0, 1, (($annot['x'] + $annot['w']) * $this->k), ((-$annot['y'] - $annot['h']) * $this->k)));
$aw = ($coordrb[4] / $this->k) - $ax;
$ah = ($this->h - $h - ($coordrb[5] / $this->k)) - $ay;
$this->Annotation($ax, $ay, $aw, $ah, $annot['text'], $annot['opt'], $annot['spaces']);
}
}
// set pointer to align the next text/objects // set pointer to align the next text/objects
switch($align) { switch($align) {
case 'T': { case 'T': {
@ -23744,7 +23755,7 @@ if (!class_exists('TCPDF', false)) {
// get styling properties // get styling properties
$prev_svgstyle = $this->svgstyles[(count($this->svgstyles) - 1)]; // previous style $prev_svgstyle = $this->svgstyles[(count($this->svgstyles) - 1)]; // previous style
$svgstyle = array(); // current style $svgstyle = array(); // current style
if (isset($attribs['style'])) { if (isset($attribs['style']) AND !$this->empty_string($attribs['style'])) {
$attribs['style'] = ';'.$attribs['style']; $attribs['style'] = ';'.$attribs['style'];
} }
foreach ($prev_svgstyle as $key => $val) { foreach ($prev_svgstyle as $key => $val) {
@ -23754,7 +23765,7 @@ if (!class_exists('TCPDF', false)) {
} else { } else {
$svgstyle[$key] = $attribs[$key]; $svgstyle[$key] = $attribs[$key];
} }
} elseif (isset($attribs['style'])) { } elseif (isset($attribs['style']) AND !$this->empty_string($attribs['style'])) {
// CSS style syntax // CSS style syntax
$attrval = array(); $attrval = array();
if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) { if (preg_match('/[;\"\s]{1}'.$key.'[\s]*:[\s]*([^;\"]*)/si', $attribs['style'], $attrval) AND isset($attrval[1])) {
@ -23765,7 +23776,13 @@ if (!class_exists('TCPDF', false)) {
} }
} else { } else {
// default value // default value
$svgstyle[$key] = $this->svgstyles[0][$key]; if (in_array($key, $this->svginheritprop)) {
// inherit previous value
$svgstyle[$key] = $val;
} else {
// default value
$svgstyle[$key] = $this->svgstyles[0][$key];
}
} }
} else { } else {
if (in_array($key, $this->svginheritprop)) { if (in_array($key, $this->svginheritprop)) {