32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-29 15:43:53 +00:00
This commit is contained in:
nicolaasuni 2010-08-17 13:12:11 +02:00
parent ef49f2754d
commit 15ae4c9cb1
22 changed files with 408 additions and 317 deletions

View File

@ -1,3 +1,7 @@
5.8.004 (2010-08-17)
- Better support for HTML and SVG "font-family" property.
- A bug related to HTML multicolumn was fixed.
5.8.003 (2010-08-16)
- Better support for HTML "font-family" property.

View File

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

View File

@ -60,7 +60,7 @@
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1003,7 +1003,7 @@ $code)</code>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -5551,7 +5551,7 @@ $frame)</code>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

File diff suppressed because it is too large Load Diff

View File

@ -299,7 +299,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1377,7 +1377,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -542,7 +542,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:55 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:12:04 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -97,7 +97,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -157,7 +157,7 @@ Class to create PDF417 barcode arrays for TCPDF class.<br /><br /><p>PDF417 (ISO
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -480,7 +480,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -124,7 +124,7 @@ unicode data<br /><br /></div>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:12:00 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -246,7 +246,7 @@ Unicode data for TCPDF library.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:55 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:12:04 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -554,13 +554,13 @@
<dt><b>getBarcode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file pdf417.php, method <a href="com-tecnick-tcpdf/PDF417.html#methodgetBarcodeArray">PDF417::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBitStream</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd>
<dt><b>getBorderMode</b></dt>
@ -613,6 +613,8 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontDescent">TCPDF::getFontDescent()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the font descent value</dd>
<dt><b>getFontFamily</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontFamily">TCPDF::getFontFamily()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the current font family name.</dd>
<dt><b>getFontFamilyName</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontFamilyName">TCPDF::getFontFamilyName()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return normalized font name</dd>
<dt><b>getFontSize</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontSize">TCPDF::getFontSize()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the current font size.</dd>
<dt><b>getFontSizePt</b></dt>
@ -2040,7 +2042,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -748,13 +748,13 @@
<dt><b>getBarcode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBarcodeArray">QRcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file 2dbarcodes.php, method <a href="com-tecnick-tcpdf/TCPDF2DBarcode.html#methodgetBarcodeArray">TCPDF2DBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file pdf417.php, method <a href="com-tecnick-tcpdf/PDF417.html#methodgetBarcodeArray">PDF417::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a barcode array which is readable by TCPDF</dd>
<dt><b>getBarcodeArray</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methodgetBarcodeArray">TCPDFBarcode::getBarcodeArray()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return an array representations of barcode.</dd>
<dt><b>getBitStream</b></dt>
<dd>in file qrcode.php, method <a href="com-tecnick-tcpdf/QRcode.html#methodgetBitStream">QRcode::getBitStream()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns a stream of bits.</dd>
<dt><b>getBorderMode</b></dt>
@ -807,6 +807,8 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontDescent">TCPDF::getFontDescent()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return the font descent value</dd>
<dt><b>getFontFamily</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontFamily">TCPDF::getFontFamily()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the current font family name.</dd>
<dt><b>getFontFamilyName</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontFamilyName">TCPDF::getFontFamilyName()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Return normalized font name</dd>
<dt><b>getFontSize</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetFontSize">TCPDF::getFontSize()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the current font size.</dd>
<dt><b>getFontSizePt</b></dt>
@ -2072,7 +2074,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br>
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:55 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:12:04 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Mon, 16 Aug 2010 12:57:49 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Tue, 17 Aug 2010 13:11:58 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

111
tcpdf.php
View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 5.8.003
// Version : 5.8.004
// Begin : 2002-08-03
// Last Update : 2010-08-16
// Last Update : 2010-08-17
// 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)
// -------------------------------------------------------------------
@ -4330,6 +4330,16 @@ if (!class_exists('TCPDF', false)) {
$this->Error('Empty font family');
}
}
// move embedded styles on $style
if (substr($family, -1) == 'I') {
$style .= 'I';
$family = substr($family, 0, -1);
}
if (substr($family, -1) == 'B') {
$style .= 'B';
$family = substr($family, 0, -1);
}
// normalize family name
$family = strtolower($family);
if ((!$this->isunicode) AND ($family == 'arial')) {
$family = 'helvetica';
@ -17015,14 +17025,7 @@ if (!class_exists('TCPDF', false)) {
if (isset($dom[$key]['style']['font-family'])) {
// font family
if (isset($dom[$key]['style']['font-family'])) {
$fontslist = preg_split('/[,]/', $dom[$key]['style']['font-family']);
foreach ($fontslist as $font) {
$font = preg_replace('/[\s\'\"]/', '', strtolower($font));
if (in_array($font, $this->fontlist) OR in_array($font, $this->fontkeys)) {
$dom[$key]['fontname'] = $font;
break;
}
}
$dom[$key]['fontname'] = $this->getFontFamilyName($dom[$key]['style']['font-family']);
}
}
// list-style-type
@ -17272,14 +17275,7 @@ if (!class_exists('TCPDF', false)) {
if ($dom[$key]['value'] == 'font') {
// font family
if (isset($dom[$key]['attribute']['face'])) {
$fontslist = preg_split('/[,]/', $dom[$key]['attribute']['face']);
foreach ($fontslist as $font) {
$font = preg_replace('/[\s\'\"]/', '', strtolower($font));
if (in_array($font, $this->fontlist) OR in_array($font, $this->fontkeys)) {
$dom[$key]['fontname'] = $font;
break;
}
}
$dom[$key]['fontname'] = $this->getFontFamilyName($dom[$key]['attribute']['face']);
}
// font size
if (isset($dom[$key]['attribute']['size'])) {
@ -18276,23 +18272,6 @@ if (!class_exists('TCPDF', false)) {
$currentcmargin = 0;
}
$this->cMargin = $currentcmargin;
if (isset($dom[$key]['width'])) {
// user specified width
$cellw = $this->getHTMLUnitToUnits($dom[$key]['width'], $table_columns_width, 'px');
$tmpcw = ($cellw / $colspan);
for ($i = 0; $i < $colspan; ++$i) {
$table_colwidths[($colid + $i)] = $tmpcw;
}
} else {
// inherit column width
$cellw = 0;
for ($i = 0; $i < $colspan; ++$i) {
$cellw += $table_colwidths[($colid + $i)];
}
}
$cellw += (($colspan - 1) * $cellspacing);
// increment column indicator
$colid += $colspan;
if (isset($dom[$key]['height'])) {
// minimum cell height
$cellh = $this->getHTMLUnitToUnits($dom[$key]['height'], 0, 'px');
@ -18364,6 +18343,8 @@ if (!class_exists('TCPDF', false)) {
AND (($trwsp['starty'] < ($this->y - $this->feps)) OR ($trwsp['startpage'] < $this->page) OR ($trwsp['startcolumn'] < $this->current_column))) {
// set the starting X position of the current cell
$this->x = $rsendx + $cellspacingx;
// increment column indicator
$colid += $trwsp['colspan'];
if (($trwsp['rowspan'] == 1)
AND (isset($dom[$trid]['endy']))
AND (isset($dom[$trid]['endpage']))
@ -18380,6 +18361,23 @@ if (!class_exists('TCPDF', false)) {
}
}
}
if (isset($dom[$parentid]['width'])) {
// user specified width
$cellw = $this->getHTMLUnitToUnits($dom[$parentid]['width'], $table_columns_width, 'px');
$tmpcw = ($cellw / $colspan);
for ($i = 0; $i < $colspan; ++$i) {
$table_colwidths[($colid + $i)] = $tmpcw;
}
} else {
// inherit column width
$cellw = 0;
for ($i = 0; $i < $colspan; ++$i) {
$cellw += $table_colwidths[($colid + $i)];
}
}
$cellw += (($colspan - 1) * $cellspacing);
// increment column indicator
$colid += $colspan;
// add rowspan information to table element
if ($rowspan > 1) {
$trsid = array_push($dom[$table_el]['rowspans'], array('trid' => $trid, 'rowspan' => $rowspan, 'mrowspan' => $rowspan, 'colspan' => $colspan, 'startpage' => $this->page, 'startcolumn' => $this->current_column, 'startx' => $this->x, 'starty' => $this->y));
@ -18719,7 +18717,9 @@ if (!class_exists('TCPDF', false)) {
}
// restore previous values
$this->setGraphicVars($gvars);
if ($this->page > $prevPage) {
if ($this->num_columns > 1) {
$this->selectColumn();
} elseif ($this->page > $prevPage) {
$this->lMargin = $this->pagedim[$this->page]['olm'];
$this->rMargin = $this->pagedim[$this->page]['orm'];
}
@ -22070,6 +22070,43 @@ if (!class_exists('TCPDF', false)) {
return (($this->CurrentFont['type'] == 'TrueTypeUnicode') OR ($this->CurrentFont['type'] == 'cidfont0'));
}
/**
* Return normalized font name
* @param string $fontfamily property string containing font family names
* @return string normalized font name
* @author Nicola Asuni
* @access public
* @since 5.8.004 (2010-08-17)
*/
public function getFontFamilyName($fontfamily) {
// remove spaces and symbols
$fontfamily = preg_replace('/[^a-z0-9\,]/', '', strtolower($fontfamily));
// extract all font names
$fontslist = preg_split('/[,]/', $fontfamily);
// find first valid font name
foreach ($fontslist as $font) {
// replace font variations
$font = preg_replace('/italic$/', 'I', $font);
$font = preg_replace('/oblique$/', 'I', $font);
$font = preg_replace('/bold([I]?)$/', 'B\\1', $font);
// replace common family names and core fonts
$pattern = array();
$replacement = array();
$pattern[] = '/^serif|^cursive|^fantasy|^timesnewroman/';
$replacement[] = 'times';
$pattern[] = '/^sansserif/';
$replacement[] = 'helvetica';
$pattern[] = '/^monospace/';
$replacement[] = 'courier';
$font = preg_replace($pattern, $replacement, $font);
if (in_array(strtolower($font), $this->fontlist) OR in_array($font, $this->fontkeys)) {
return $font;
}
}
// return current font as default
return $this->CurrentFont['fontkey'];
}
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
// SVG METHODS
// -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
@ -22690,7 +22727,7 @@ if (!class_exists('TCPDF', false)) {
$regs = array();
if (!empty($svgstyle['font'])) {
if (preg_match('/font-family[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle['font'], $regs)) {
$font_family = trim($regs[1]);
$font_family = $this->getFontFamilyName($regs[1]);
} else {
$font_family = $svgstyle['font-family'];
}