From 8fdafc1480214f23b58ee99bcf97eca208279491 Mon Sep 17 00:00:00 2001 From: nick Date: Sat, 10 Dec 2011 15:57:26 +0000 Subject: [PATCH] 5.9.138 --- CHANGELOG.TXT | 5 +++ README.TXT | 4 +- examples/example_056.php | 38 +++++++++--------- tcpdf.php | 87 +++++++++++++++++++++------------------- 4 files changed, 72 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 1d15894..674116e 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,8 @@ +5.9.138 (2011-12-10) + - cropMark() method was improved (check source code documentation). + - Example n. 56 was updated. + - Bug item #3452390 "Check Box still not ticked when set to true" was fixed. + 5.9.137 (2011-12-01) - Bug item #3447005 "Background color and border of Form Elements is printed" was fixed. - Color support for Form elements was improved. diff --git a/README.TXT b/README.TXT index 2062f24..4055767 100755 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.137 -Release date: 2011-12-01 +Version: 5.9.138 +Release date: 2011-12-10 Author: Nicola Asuni Copyright (c) 2002-2011: diff --git a/examples/example_056.php b/examples/example_056.php index 0cbc9a9..0b8a730 100755 --- a/examples/example_056.php +++ b/examples/example_056.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_056.php // Begin : 2010-03-26 -// Last Update : 2010-08-08 +// Last Update : 2011-12-10 // // Description : Example 056 for TCPDF class // Crop marks and color registration bars @@ -78,34 +78,34 @@ $pdf->Ln(5); // color registration bars -$pdf->colorRegistrationBar($x=50, $y=70, $w=40, $h=40, $transition=true, $vertical=false, $colors='A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar($x=90, $y=70, $w=40, $h=40, $transition=true, $vertical=true, $colors='A,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar($x=50, $y=115, $w=80, $h=5, $transition=false, $vertical=true, $colors='A,W,R,G,B,C,M,Y,K'); -$pdf->colorRegistrationBar($x=135, $y=70, $w=5, $h=50, $transition=false, $vertical=false, $colors='A,W,R,G,B,C,M,Y,K'); +$pdf->colorRegistrationBar(50, 70, 40, 40, true, false, 'A,R,G,B,C,M,Y,K'); +$pdf->colorRegistrationBar(90, 70, 40, 40, true, true, 'A,R,G,B,C,M,Y,K'); +$pdf->colorRegistrationBar(50, 115, 80, 5, false, true, 'A,W,R,G,B,C,M,Y,K'); +$pdf->colorRegistrationBar(135, 70, 5, 50, false, false, 'A,W,R,G,B,C,M,Y,K'); // corner crop marks -$pdf->cropMark($x=50, $y=70, $w=10, $h=10, $type='A', $color=array(0,0,0)); -$pdf->cropMark($x=140, $y=70, $w=10, $h=10, $type='B', $color=array(0,0,0)); -$pdf->cropMark($x=50, $y=120, $w=10, $h=10, $type='C', $color=array(0,0,0)); -$pdf->cropMark($x=140, $y=120, $w=10, $h=10, $type='D', $color=array(0,0,0)); +$pdf->cropMark(50, 70, 10, 10, 'TL', array(0,0,0)); +$pdf->cropMark(140, 70, 10, 10, 'TR', array(0,0,0)); +$pdf->cropMark(50, 120, 10, 10, 'BL', array(0,0,0)); +$pdf->cropMark(140, 120, 10, 10, 'BR', array(0,0,0)); // various crop marks -$pdf->cropMark($x=95, $y=65, $w=5, $h=5, $type='A,B', $color=array(255,0,0)); -$pdf->cropMark($x=95, $y=125, $w=5, $h=5, $type='C,D', $color=array(255,0,0)); +$pdf->cropMark(95, 65, 5, 5, 'LEFT,TOP,RIGHT', array(255,0,0)); +$pdf->cropMark(95, 125, 5, 5, 'LEFT,BOTTOM,RIGHT', array(255,0,0)); -$pdf->cropMark($x=45, $y=95, $w=5, $h=5, $type='A,C', $color=array(0,255,0)); -$pdf->cropMark($x=145, $y=95, $w=5, $h=5, $type='B,D', $color=array(0,255,0)); +$pdf->cropMark(45, 95, 5, 5, 'TL,BL', array(0,255,0)); +$pdf->cropMark(145, 95, 5, 5, 'TR,BR', array(0,255,0)); -$pdf->cropMark($x=95, $y=140, $w=5, $h=5, $type='A,D', $color=array(0,0,255)); +$pdf->cropMark(95, 140, 5, 5, 'A,D', array(0,0,255)); // registration marks -$pdf->registrationMark($x=40, $y=60, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255)); -$pdf->registrationMark($x=150, $y=60, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0)); -$pdf->registrationMark($x=40, $y=130, $r=5, $double=true, $cola=array(0,0,0), $colb=array(255,255,0)); -$pdf->registrationMark($x=150, $y=130, $r=5, $double=false, $cola=array(0,0,0), $colb=array(255,255,255)); +$pdf->registrationMark(40, 60, 5, false, array(0,0,0), array(255,255,255)); +$pdf->registrationMark(150, 60, 5, true, array(0,0,0), array(255,255,0)); +$pdf->registrationMark(40, 130, 5, true, array(0,0,0), array(255,255,0)); +$pdf->registrationMark(150, 130, 5, false, array(0,0,0), array(255,255,255)); // --------------------------------------------------------- @@ -113,5 +113,5 @@ $pdf->registrationMark($x=150, $y=130, $r=5, $double=false, $cola=array(0,0,0), $pdf->Output('example_056.pdf', 'I'); //============================================================+ -// END OF FILE +// END OF FILE //============================================================+ diff --git a/tcpdf.php b/tcpdf.php index 8d9b532..ce5b6b9 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.137 + * @version 5.9.138 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +150,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.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.137 + * @version 5.9.138 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -160,7 +161,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.137'; + private $tcpdf_version = '5.9.138'; // Protected properties @@ -17316,6 +17317,9 @@ class TCPDF { $opt['Subtype'] = 'Widget'; $opt['ft'] = 'Btn'; $opt['t'] = $name; + if ($this->empty_string($onvalue)) { + $onvalue = 'Yes'; + } $opt['opt'] = array($onvalue); if ($checked) { $opt['v'] = array('/Yes'); @@ -18238,72 +18242,73 @@ class TCPDF { } /** - * Paints crop mark + * Paints crop marks. * @param $x (float) abscissa of the crop mark center. * @param $y (float) ordinate of the crop mark center. * @param $w (float) width of the crop mark. * @param $h (float) height of the crop mark. - * @param $type (string) type of crop mark, one sybol per type separated by comma: A = top left, B = top right, C = bottom left, D = bottom right. + * @param $type (string) type of crop mark, one symbol per type separated by comma: T = TOP, F = BOTTOM, L = LEFT, R = RIGHT, TL = A = TOP-LEFT, TR = B = TOP-RIGHT, BL = C = BOTTOM-LEFT, BR = D = BOTTOM-RIGHT. * @param $color (array) crop mark color (default black). * @author Nicola Asuni * @since 4.9.000 (2010-03-26) * @public */ - public function cropMark($x, $y, $w, $h, $type='A,B,C,D', $color=array(0,0,0)) { + public function cropMark($x, $y, $w, $h, $type='T,R,B,L', $color=array(0,0,0)) { $this->SetLineStyle(array('width' => (0.5 / $this->k), 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => $color)); - $crops = explode(',', $type); - $numcrops = count($crops); // number of crop marks to print - $dw = $w / 4; // horizontal space to leave before the intersection point - $dh = $h / 4; // vertical space to leave before the intersection point + $type = strtoupper($type); + $type = preg_replace('/[^A-Z\-\,]*/', '', $type); + // split type in single components + $type = str_replace('-', ',', $type); + $type = str_replace('TL', 'T,L', $type); + $type = str_replace('TR', 'T,R', $type); + $type = str_replace('BL', 'F,L', $type); + $type = str_replace('BR', 'F,R', $type); + $type = str_replace('A', 'T,L', $type); + $type = str_replace('B', 'T,R', $type); + $type = str_replace('T,RO', 'BO', $type); + $type = str_replace('C', 'F,L', $type); + $type = str_replace('D', 'F,R', $type); + $crops = explode(',', strtoupper($type)); + // remove duplicates + $crops = array_unique($crops); + $dw = ($w / 4); // horizontal space to leave before the intersection point + $dh = ($h / 4); // vertical space to leave before the intersection point foreach ($crops as $crop) { switch ($crop) { - case 'A': { + case 'T': + case 'TOP': { $x1 = $x; - $y1 = $y - $h; + $y1 = ($y - $h); $x2 = $x; - $y2 = $y - $dh; - $x3 = $x - $w; - $y3 = $y; - $x4 = $x - $dw; - $y4 = $y; + $y2 = ($y - $dh); break; } - case 'B': { + case 'F': + case 'BOTTOM': { $x1 = $x; - $y1 = $y - $h; + $y1 = ($y + $dh); $x2 = $x; - $y2 = $y - $dh; - $x3 = $x + $dw; - $y3 = $y; - $x4 = $x + $w; - $y4 = $y; + $y2 = ($y + $h); break; } - case 'C': { - $x1 = $x - $w; + case 'L': + case 'LEFT': { + $x1 = ($x - $w); $y1 = $y; - $x2 = $x - $dw; + $x2 = ($x - $dw); $y2 = $y; - $x3 = $x; - $y3 = $y + $dh; - $x4 = $x; - $y4 = $y + $h; break; } - case 'D': { - $x1 = $x + $dw; + case 'R': + case 'RIGHT': { + $x1 = ($x + $dw); $y1 = $y; - $x2 = $x + $w; + $x2 = ($x + $w); $y2 = $y; - $x3 = $x; - $y3 = $y + $dh; - $x4 = $x; - $y4 = $y + $h; break; } } $this->Line($x1, $y1, $x2, $y2); - $this->Line($x3, $y3, $x4, $y4); } }