From 396fa840c8b64a366252e90a40e68da311482645 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 25 Jun 2011 14:50:10 +0000 Subject: [PATCH] Fix: upgrade tcpdf with some fix --- COPYRIGHT | 2 +- htdocs/includes/dolibarr_changes.txt | 4 +- htdocs/includes/tcpdf/2dbarcodes.php | 71 +- htdocs/includes/tcpdf/CHANGELOG.TXT | 134 ++ htdocs/includes/tcpdf/README.TXT | 12 +- htdocs/includes/tcpdf/barcodes.php | 452 +++- htdocs/includes/tcpdf/cache/utf8test.txt | 250 +-- htdocs/includes/tcpdf/config/lang/far.php | 47 + htdocs/includes/tcpdf/config/tcpdf_config.php | 8 +- .../tcpdf/config/tcpdf_config_alt.php | 8 +- htdocs/includes/tcpdf/doc/index.html | 82 +- .../includes/tcpdf/examples/example_001.php | 102 + .../includes/tcpdf/examples/example_002.php | 87 + .../includes/tcpdf/examples/example_003.php | 118 ++ .../includes/tcpdf/examples/example_004.php | 121 ++ .../includes/tcpdf/examples/example_005.php | 158 ++ .../includes/tcpdf/examples/example_006.php | 332 +++ .../includes/tcpdf/examples/example_007.php | 113 + .../includes/tcpdf/examples/example_008.php | 94 + .../includes/tcpdf/examples/example_009.php | 146 ++ .../includes/tcpdf/examples/example_010.php | 150 ++ .../includes/tcpdf/examples/example_011.php | 138 ++ .../includes/tcpdf/examples/example_012.php | 205 ++ .../includes/tcpdf/examples/example_013.php | 229 ++ .../includes/tcpdf/examples/example_014.php | 190 ++ .../includes/tcpdf/examples/example_015.php | 135 ++ .../includes/tcpdf/examples/example_016.php | 134 ++ .../includes/tcpdf/examples/example_017.php | 117 ++ .../includes/tcpdf/examples/example_018.php | 132 ++ .../includes/tcpdf/examples/example_019.php | 106 + .../includes/tcpdf/examples/example_020.php | 146 ++ .../includes/tcpdf/examples/example_021.php | 91 + .../includes/tcpdf/examples/example_022.php | 146 ++ .../includes/tcpdf/examples/example_023.php | 113 + .../includes/tcpdf/examples/example_024.php | 118 ++ .../includes/tcpdf/examples/example_025.php | 118 ++ .../includes/tcpdf/examples/example_026.php | 145 ++ .../includes/tcpdf/examples/example_027.php | 409 ++++ .../includes/tcpdf/examples/example_028.php | 138 ++ .../includes/tcpdf/examples/example_029.php | 124 ++ .../includes/tcpdf/examples/example_030.php | 188 ++ .../includes/tcpdf/examples/example_031.php | 103 + .../includes/tcpdf/examples/example_032.php | 93 + .../includes/tcpdf/examples/example_033.php | 105 + .../includes/tcpdf/examples/example_034.php | 96 + .../includes/tcpdf/examples/example_035.php | 111 + .../includes/tcpdf/examples/example_036.php | 89 + .../includes/tcpdf/examples/example_037.php | 202 ++ .../includes/tcpdf/examples/example_038.php | 87 + .../includes/tcpdf/examples/example_039.php | 104 + .../includes/tcpdf/examples/example_040.php | 116 + .../includes/tcpdf/examples/example_041.php | 90 + .../includes/tcpdf/examples/example_042.php | 102 + .../includes/tcpdf/examples/example_043.php | 85 + .../includes/tcpdf/examples/example_044.php | 128 ++ .../includes/tcpdf/examples/example_045.php | 130 ++ .../includes/tcpdf/examples/example_046.php | 123 ++ .../includes/tcpdf/examples/example_047.php | 117 ++ .../includes/tcpdf/examples/example_048.php | 313 +++ .../includes/tcpdf/examples/example_049.php | 126 ++ .../includes/tcpdf/examples/example_050.php | 205 ++ .../includes/tcpdf/examples/example_051.php | 145 ++ .../includes/tcpdf/examples/example_052.php | 115 + .../includes/tcpdf/examples/example_053.php | 108 + .../includes/tcpdf/examples/example_054.php | 128 ++ .../includes/tcpdf/examples/example_055.php | 115 + .../includes/tcpdf/examples/example_056.php | 117 ++ .../includes/tcpdf/examples/example_057.php | 268 +++ .../includes/tcpdf/examples/example_058.php | 94 + .../includes/tcpdf/examples/example_059.php | 190 ++ .../includes/tcpdf/examples/example_060.php | 108 + .../includes/tcpdf/examples/example_061.php | 273 +++ .../includes/tcpdf/examples/example_062.php | 136 ++ .../includes/tcpdf/examples/example_063.php | 131 ++ .../includes/tcpdf/examples/example_064.php | 176 ++ htdocs/includes/tcpdf/examples/index.php | 88 + htdocs/includes/tcpdf/fonts/ZarBold.ctg.z | Bin 1107 -> 0 bytes htdocs/includes/tcpdf/fonts/ZarBold.z | Bin 32143 -> 0 bytes .../AUTHORS | 7 +- .../BUGS | 2 +- .../LICENSE | 2 +- .../NEWS | 87 +- .../README | 4 +- .../langcover.txt | 22 +- .../status.txt | 554 +++-- .../unicover.txt | 74 +- htdocs/includes/tcpdf/fonts/dejavusans.ctg.z | Bin 10030 -> 10064 bytes htdocs/includes/tcpdf/fonts/dejavusans.php | 596 +++--- htdocs/includes/tcpdf/fonts/dejavusans.z | Bin 347072 -> 360887 bytes htdocs/includes/tcpdf/fonts/dejavusansb.ctg.z | Bin 9784 -> 9804 bytes htdocs/includes/tcpdf/fonts/dejavusansb.php | 593 +++--- htdocs/includes/tcpdf/fonts/dejavusansb.z | Bin 318072 -> 333097 bytes .../includes/tcpdf/fonts/dejavusansbi.ctg.z | Bin 8680 -> 8707 bytes htdocs/includes/tcpdf/fonts/dejavusansbi.php | 480 ++--- htdocs/includes/tcpdf/fonts/dejavusansbi.z | Bin 297277 -> 311444 bytes .../tcpdf/fonts/dejavusanscondensed.ctg.z | Bin 10030 -> 10064 bytes .../tcpdf/fonts/dejavusanscondensed.php | 596 +++--- .../tcpdf/fonts/dejavusanscondensed.z | Bin 298138 -> 314094 bytes .../tcpdf/fonts/dejavusanscondensedb.ctg.z | Bin 9784 -> 9804 bytes .../tcpdf/fonts/dejavusanscondensedb.php | 593 +++--- .../tcpdf/fonts/dejavusanscondensedb.z | Bin 296635 -> 310453 bytes .../tcpdf/fonts/dejavusanscondensedbi.ctg.z | Bin 8680 -> 8707 bytes .../tcpdf/fonts/dejavusanscondensedbi.php | 480 ++--- .../tcpdf/fonts/dejavusanscondensedbi.z | Bin 283788 -> 298335 bytes .../tcpdf/fonts/dejavusanscondensedi.ctg.z | Bin 8915 -> 8949 bytes .../tcpdf/fonts/dejavusanscondensedi.php | 482 ++--- .../tcpdf/fonts/dejavusanscondensedi.z | Bin 279483 -> 295107 bytes .../tcpdf/fonts/dejavusansextralight.php | 23 +- htdocs/includes/tcpdf/fonts/dejavusansi.ctg.z | Bin 8915 -> 8949 bytes htdocs/includes/tcpdf/fonts/dejavusansi.php | 482 ++--- htdocs/includes/tcpdf/fonts/dejavusansi.z | Bin 296396 -> 311768 bytes .../includes/tcpdf/fonts/dejavusansmono.ctg.z | Bin 6076 -> 6272 bytes .../includes/tcpdf/fonts/dejavusansmono.php | 526 ++--- htdocs/includes/tcpdf/fonts/dejavusansmono.z | Bin 189401 -> 196843 bytes .../tcpdf/fonts/dejavusansmonob.ctg.z | Bin 5857 -> 6037 bytes .../includes/tcpdf/fonts/dejavusansmonob.php | 502 ++--- htdocs/includes/tcpdf/fonts/dejavusansmonob.z | Bin 182372 -> 189149 bytes .../tcpdf/fonts/dejavusansmonobi.ctg.z | Bin 4723 -> 4914 bytes .../includes/tcpdf/fonts/dejavusansmonobi.php | 388 ++-- .../includes/tcpdf/fonts/dejavusansmonobi.z | Bin 134815 -> 142365 bytes .../tcpdf/fonts/dejavusansmonoi.ctg.z | Bin 4963 -> 5142 bytes .../includes/tcpdf/fonts/dejavusansmonoi.php | 412 ++-- htdocs/includes/tcpdf/fonts/dejavusansmonoi.z | Bin 136621 -> 144033 bytes htdocs/includes/tcpdf/fonts/dejavuserif.ctg.z | Bin 5973 -> 6354 bytes htdocs/includes/tcpdf/fonts/dejavuserif.php | 563 ++--- htdocs/includes/tcpdf/fonts/dejavuserif.z | Bin 185864 -> 201287 bytes .../includes/tcpdf/fonts/dejavuserifb.ctg.z | Bin 5717 -> 6099 bytes htdocs/includes/tcpdf/fonts/dejavuserifb.php | 535 ++--- htdocs/includes/tcpdf/fonts/dejavuserifb.z | Bin 171017 -> 187555 bytes .../includes/tcpdf/fonts/dejavuserifbi.ctg.z | Bin 5724 -> 6107 bytes htdocs/includes/tcpdf/fonts/dejavuserifbi.php | 541 ++--- htdocs/includes/tcpdf/fonts/dejavuserifbi.z | Bin 169327 -> 187880 bytes .../tcpdf/fonts/dejavuserifcondensed.ctg.z | Bin 5973 -> 6354 bytes .../tcpdf/fonts/dejavuserifcondensed.php | 565 ++--- .../tcpdf/fonts/dejavuserifcondensed.z | Bin 165227 -> 180554 bytes .../tcpdf/fonts/dejavuserifcondensedb.ctg.z | Bin 5717 -> 6099 bytes .../tcpdf/fonts/dejavuserifcondensedb.php | 537 ++--- .../tcpdf/fonts/dejavuserifcondensedb.z | Bin 155642 -> 171676 bytes .../tcpdf/fonts/dejavuserifcondensedbi.ctg.z | Bin 5724 -> 6107 bytes .../tcpdf/fonts/dejavuserifcondensedbi.php | 537 ++--- .../tcpdf/fonts/dejavuserifcondensedbi.z | Bin 170779 -> 189848 bytes .../tcpdf/fonts/dejavuserifcondensedi.ctg.z | Bin 5949 -> 6334 bytes .../tcpdf/fonts/dejavuserifcondensedi.php | 563 ++--- .../tcpdf/fonts/dejavuserifcondensedi.z | Bin 173141 -> 192149 bytes .../includes/tcpdf/fonts/dejavuserifi.ctg.z | Bin 5949 -> 6334 bytes htdocs/includes/tcpdf/fonts/dejavuserifi.php | 563 ++--- htdocs/includes/tcpdf/fonts/dejavuserifi.z | Bin 171334 -> 189967 bytes .../AUTHORS | 2 +- .../COPYING | 0 .../CREDITS | 2 +- .../ChangeLog | 2 +- .../INSTALL | 2 +- .../README | 2 +- htdocs/includes/tcpdf/fonts/freemonob.php | 2 +- htdocs/includes/tcpdf/fonts/freemonobi.php | 2 +- htdocs/includes/tcpdf/fonts/freesans.php | 2 +- htdocs/includes/tcpdf/fonts/freesansb.php | 2 +- htdocs/includes/tcpdf/fonts/freesansbi.php | 2 +- htdocs/includes/tcpdf/fonts/freeserif.php | 2 +- htdocs/includes/tcpdf/fonts/freeserifb.php | 2 +- htdocs/includes/tcpdf/fonts/freeserifbi.php | 2 +- htdocs/includes/tcpdf/fonts/utils/README.TXT | 7 +- .../tcpdf/fonts/utils/makeallotfufm.php | 68 + .../tcpdf/fonts/utils/makeallttffonts.php | 53 +- htdocs/includes/tcpdf/tcpdf.php | 1859 +++++++++++------ 165 files changed, 17276 insertions(+), 6376 deletions(-) create mode 100644 htdocs/includes/tcpdf/config/lang/far.php create mode 100644 htdocs/includes/tcpdf/examples/example_001.php create mode 100644 htdocs/includes/tcpdf/examples/example_002.php create mode 100644 htdocs/includes/tcpdf/examples/example_003.php create mode 100644 htdocs/includes/tcpdf/examples/example_004.php create mode 100644 htdocs/includes/tcpdf/examples/example_005.php create mode 100644 htdocs/includes/tcpdf/examples/example_006.php create mode 100644 htdocs/includes/tcpdf/examples/example_007.php create mode 100644 htdocs/includes/tcpdf/examples/example_008.php create mode 100644 htdocs/includes/tcpdf/examples/example_009.php create mode 100644 htdocs/includes/tcpdf/examples/example_010.php create mode 100644 htdocs/includes/tcpdf/examples/example_011.php create mode 100644 htdocs/includes/tcpdf/examples/example_012.php create mode 100644 htdocs/includes/tcpdf/examples/example_013.php create mode 100644 htdocs/includes/tcpdf/examples/example_014.php create mode 100644 htdocs/includes/tcpdf/examples/example_015.php create mode 100644 htdocs/includes/tcpdf/examples/example_016.php create mode 100644 htdocs/includes/tcpdf/examples/example_017.php create mode 100644 htdocs/includes/tcpdf/examples/example_018.php create mode 100644 htdocs/includes/tcpdf/examples/example_019.php create mode 100644 htdocs/includes/tcpdf/examples/example_020.php create mode 100644 htdocs/includes/tcpdf/examples/example_021.php create mode 100644 htdocs/includes/tcpdf/examples/example_022.php create mode 100644 htdocs/includes/tcpdf/examples/example_023.php create mode 100644 htdocs/includes/tcpdf/examples/example_024.php create mode 100644 htdocs/includes/tcpdf/examples/example_025.php create mode 100644 htdocs/includes/tcpdf/examples/example_026.php create mode 100644 htdocs/includes/tcpdf/examples/example_027.php create mode 100644 htdocs/includes/tcpdf/examples/example_028.php create mode 100644 htdocs/includes/tcpdf/examples/example_029.php create mode 100644 htdocs/includes/tcpdf/examples/example_030.php create mode 100644 htdocs/includes/tcpdf/examples/example_031.php create mode 100644 htdocs/includes/tcpdf/examples/example_032.php create mode 100644 htdocs/includes/tcpdf/examples/example_033.php create mode 100644 htdocs/includes/tcpdf/examples/example_034.php create mode 100644 htdocs/includes/tcpdf/examples/example_035.php create mode 100644 htdocs/includes/tcpdf/examples/example_036.php create mode 100644 htdocs/includes/tcpdf/examples/example_037.php create mode 100644 htdocs/includes/tcpdf/examples/example_038.php create mode 100644 htdocs/includes/tcpdf/examples/example_039.php create mode 100644 htdocs/includes/tcpdf/examples/example_040.php create mode 100644 htdocs/includes/tcpdf/examples/example_041.php create mode 100644 htdocs/includes/tcpdf/examples/example_042.php create mode 100644 htdocs/includes/tcpdf/examples/example_043.php create mode 100644 htdocs/includes/tcpdf/examples/example_044.php create mode 100644 htdocs/includes/tcpdf/examples/example_045.php create mode 100644 htdocs/includes/tcpdf/examples/example_046.php create mode 100644 htdocs/includes/tcpdf/examples/example_047.php create mode 100644 htdocs/includes/tcpdf/examples/example_048.php create mode 100644 htdocs/includes/tcpdf/examples/example_049.php create mode 100644 htdocs/includes/tcpdf/examples/example_050.php create mode 100644 htdocs/includes/tcpdf/examples/example_051.php create mode 100644 htdocs/includes/tcpdf/examples/example_052.php create mode 100644 htdocs/includes/tcpdf/examples/example_053.php create mode 100644 htdocs/includes/tcpdf/examples/example_054.php create mode 100644 htdocs/includes/tcpdf/examples/example_055.php create mode 100644 htdocs/includes/tcpdf/examples/example_056.php create mode 100644 htdocs/includes/tcpdf/examples/example_057.php create mode 100644 htdocs/includes/tcpdf/examples/example_058.php create mode 100644 htdocs/includes/tcpdf/examples/example_059.php create mode 100644 htdocs/includes/tcpdf/examples/example_060.php create mode 100644 htdocs/includes/tcpdf/examples/example_061.php create mode 100644 htdocs/includes/tcpdf/examples/example_062.php create mode 100644 htdocs/includes/tcpdf/examples/example_063.php create mode 100644 htdocs/includes/tcpdf/examples/example_064.php create mode 100644 htdocs/includes/tcpdf/examples/index.php delete mode 100755 htdocs/includes/tcpdf/fonts/ZarBold.ctg.z delete mode 100755 htdocs/includes/tcpdf/fonts/ZarBold.z rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/AUTHORS (85%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/BUGS (52%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/LICENSE (98%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/NEWS (94%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/README (95%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/langcover.txt (95%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/status.txt (94%) rename htdocs/includes/tcpdf/fonts/{dejavu-fonts-ttf-2.30 => dejavu-fonts-ttf-2.33}/unicover.txt (82%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/AUTHORS (99%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/COPYING (100%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/CREDITS (99%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/ChangeLog (99%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/INSTALL (97%) rename htdocs/includes/tcpdf/fonts/{freefont-20090104 => freefont-20100919}/README (98%) create mode 100644 htdocs/includes/tcpdf/fonts/utils/makeallotfufm.php diff --git a/COPYRIGHT b/COPYRIGHT index 1531ef24da5..991d0edc0e3 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -39,7 +39,7 @@ PHP_ExcelReader 2.21 MIT License Yes Parse an PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files Smarty 2.6.26 LGPL 2.1 Yes Templates engine used by some pages SMTPs 1.15 GPL Yes SMTPS library -TCPDF 5.9.060 LGPL 3.0 Yes PDF generation +TCPDF 5.9.098 LGPL 3.0 Yes PDF generation VCard 2.0 GPL 2.0 Yes VCard library For licenses compatibility informations: diff --git a/htdocs/includes/dolibarr_changes.txt b/htdocs/includes/dolibarr_changes.txt index 44887b70e3a..01a1e6667e4 100644 --- a/htdocs/includes/dolibarr_changes.txt +++ b/htdocs/includes/dolibarr_changes.txt @@ -40,11 +40,13 @@ FPDFI and FPDF_TPL: TCPDF: ------ -To be compatible with FPDF, replace line +* To be compatible with FPDF, replace line public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false) { by public function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=false, $maxh=0, $valign='T', $fitcell=false) { +* Open tcpdf.php and find function getRandomSeed() +in this function change "getmypid()" by "mt_rand()" JSGANTT: diff --git a/htdocs/includes/tcpdf/2dbarcodes.php b/htdocs/includes/tcpdf/2dbarcodes.php index 270f2a8bab8..47b0bed75bc 100644 --- a/htdocs/includes/tcpdf/2dbarcodes.php +++ b/htdocs/includes/tcpdf/2dbarcodes.php @@ -1,13 +1,13 @@ barcode_array; } + /** + * Send barcode as SVG image object to the standard output. + * @param $w (int) Width of a single rectangle element in user units. + * @param $h (int) Height of a single rectangle element in user units. + * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @public + */ + public function getBarcodeSVG($w=2, $h=3, $color='black') { + // send XML headers + $code = $this->getBarcodeSVGcode($w, $h, $color); + header('Content-Type: application/svg+xml'); + header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Pragma: public'); + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + header('Content-Disposition: inline; filename="'.md5($code).'.svg";'); + //header('Content-Length: '.strlen($code)); + echo $code; + } + + /** + * Return a SVG string representation of barcode. + * @param $w (int) Width of a single rectangle element in user units. + * @param $h (int) Height of a single rectangle element in user units. + * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @return string SVG code. + * @public + */ + public function getBarcodeSVGcode($w=3, $h=3, $color='black') { + // replace table for special characters + $repstr = array("\0" => '', '&' => '&', '<' => '<', '>' => '>'); + $svg = '<'.'?'.'xml version="1.0" standalone="no"'.'?'.'>'."\n"; + $svg .= ''."\n"; + $svg .= ''."\n"; + $svg .= "\t".''.strtr($this->barcode_array['code'], $repstr).''."\n"; + $svg .= "\t".''."\n"; + // print barcode elements + $xstart = 0; + $y = 0; + // for each row + for ($r = 0; $r < $this->barcode_array['num_rows']; ++$r) { + $x = $xstart; + // for each column + for ($c = 0; $c < $this->barcode_array['num_cols']; ++$c) { + if ($this->barcode_array['bcode'][$r][$c] == 1) { + // draw a single barcode cell + $svg .= "\t\t".''."\n"; + } + $x += $w; + } + $y += $h; + } + $svg .= "\t".''."\n"; + $svg .= ''."\n"; + return $svg; + } + /** * Set the barcode. * @param $code (string) code to print @@ -94,6 +151,7 @@ class TCPDF2DBarcode { } $qrcode = new QRcode($code, strtoupper($mode[1])); $this->barcode_array = $qrcode->getBarcodeArray(); + $this->barcode_array['code'] = $code; break; } case 'PDF417': { // PDF417 (ISO/IEC 15438:2006) @@ -124,6 +182,7 @@ class TCPDF2DBarcode { } $qrcode = new PDF417($code, $ecl, $aspectratio, $macro); $this->barcode_array = $qrcode->getBarcodeArray(); + $this->barcode_array['code'] = $code; break; } case 'RAW': @@ -147,6 +206,7 @@ class TCPDF2DBarcode { foreach ($rows as $r) { $this->barcode_array['bcode'][] = str_split($r, 1); } + $this->barcode_array['code'] = $code; break; } case 'TEST': { // TEST MODE @@ -158,6 +218,7 @@ class TCPDF2DBarcode { array(0,1,0,0,1,1,0,0,1,1,1,0,0,1,0), array(0,1,0,0,1,0,0,0,0,0,1,0,0,1,0), array(0,1,0,0,1,1,1,0,1,1,1,0,0,1,0)); + $this->barcode_array['code'] = $code; break; } default: { diff --git a/htdocs/includes/tcpdf/CHANGELOG.TXT b/htdocs/includes/tcpdf/CHANGELOG.TXT index 1b96279bb96..6e85bbee82c 100644 --- a/htdocs/includes/tcpdf/CHANGELOG.TXT +++ b/htdocs/includes/tcpdf/CHANGELOG.TXT @@ -1,3 +1,137 @@ +5.9.098 (2011-06-23) + - The Named Destination feature was fixed. + +5.9.097 (2011-06-23) + - The method setHtmlVSpace() now can be used also for tags: div, li, br, dt and dd. + - The Named Destination feature was added (check the example n. 15) - thanks to Christian Deligant. + +5.9.096 (2011-06-19) + - Bug item #3322234 "Surrogate pairs codes in arrUTF8ToUTF16BE" was fixed. + +5.9.095 (2011-06-18) + - Numbers alignment for Table-Of-Content methods was improved and fixed. + - Font subsetting was fixed to include all parts of composite fonts. + +5.9.094 (2011-06-17) + - Bug item #3317898 "Page Group numbering broken in 5.9.093" was fixed. + +5.9.093 (2011-06-16) + - Method setStartingPageNumber() was added to set starting page number (for automatic page numbering). + +5.9.092 (2011-06-15) + - Method _putpages() was improved. + - Bug item #3316678 "Memory overflow when use Rotate and SetAutoPageBreak" was fixed. + - Right alignment of page numbers was improved. + +5.9.090 (2011-06-14) + - Methods AliasNbPages() and AliasNumPage() were re-added as deprecated for backward compatibility. + +5.9.089 (2011-06-13) + - Example n. 8 was updated. + - Method sendOutputData() was changed to remove default compression (it was incompatible with some server settings). + - Bugs related to page group numbers were fixed. + - Method copyPage() was fixed. + - Method Image() was improved to include support for alternative and external images. + +5.9.088 (2011-06-01) + - Method getAutoPageBreak() was added (see example n. 51). + - Example n. 51 (full page background) was updated. + +5.9.087 (2011-06-01) + - Method sendOutputData() was improved to include deflate encoding. + - Barcode classes on PHP 4 version were fixed. + +5.9.086 (2011-05-31) + - Font files were updated (the ones on the previous release were broken). + - The script fonts/utils/makeallttffonts.php was updated and fixed. + - Output() method was improved to use compression when available. + +5.9.085 (2011-05-31) + - TCPDFBarcode class (barcodes.php) now includes getBarcodeSVG() and getBarcodeSVGcode() methods to get SVG image representation of the barcode. + - TCPDF2DBarcode class (2dbarcodes.php) now includes getBarcodeSVG() and getBarcodeSVGcode() methods to get SVG image representation of the barcode. + +5.9.084 (2011-05-29) + - Font files were updated. + - The file fonts/utils/makeallttffonts.php was updated. + - Bug item# 3308774 "Problems with font subsetting" was fixed. + +5.9.083 (2011-05-24) + - Bug item #3308387 "line height & SetCellHeightRatio" was fixed. + +5.9.082 (2011-05-22) + - Bug item #3305592 "Setting fill color <> text color breaks text clipping" was fixed. + +5.9.081 (2011-05-18) + - Method resetHeaderTemplate() was added to reset the xobject template used by Header() method. + - Method setHeaderTemplateAutoreset() was added to automatically reset the xobject template used by Header() method at each page. + +5.9.080 (2011-05-17) + - A problem related to file path calculation for images was fixed. + - A problem related to unsupressed getimagesize() error was fixed. + +5.9.079 (2011-05-16) + - Footer() method was changed to use C128 barcode as default (instead of the previous C128B). + +5.9.078 (2011-05-12) + - Bug item #3300878 "wrong rendering for html bullet list in some case" was fixed. + - Bug item #3301017 "Emphasized vs. font-weight" was fixed. + - Barcode Code 128 was improved to include AUTO mode (automatically switch between A, B and C modes). + - Examples n. 27 and 49 were updated. + +5.9.077 (2011-05-07) + - Bug item #3298591 "error code93" was fixed. + - SetLineStyle() function was improved. + +5.9.076 (2011-05-06) + - Bug item #3298264 "codebar 93 error" was fixed. + +5.9.075 (2011-05-02) + - Table header alignment when using WriteHTMLCell() or MultiCell() was fixed. + +5.9.074 (2011-04-28) + - Bug item #3294306 "CSS classes not work in table section" was fixed. + +5.9.073 (2011-04-27) + - A bug related to character entities on HTML cells was fixed. + +5.9.072 (2011-04-26) + - Method resetColumns() was added to remove multiple columns and reset page margins (example n. 10 was updated). + +5.9.071 (2011-04-19) + - Bug #3288574 "
trouble" was fixed. + +5.9.069 (2011-04-19) + - Bug #3288763 "HTML-Table: non-breaking table rows: Bug" was fixed. + +5.9.068 (2011-04-15) + - Bookmark, addTOC and addHTMLTOC methods were improved to include font style and color (Examples 15, 49 and 59 were updated). + - Default $_SERVER['DOCUMENT_ROOT'] value on tcpdf_config.php file was changed. + +5.9.067 (2011-04-10) + - Performances were drastically improved (PDF documents are now created more quickly). + +5.9.066 (2011-04-09) + - A bug related to digital signature + encryption was fixed. + - A bug related to encryption + xobject templates was fixed. + +5.9.065 (2011-04-08) + - Bug item #3280512 "Text encoding iso-8859-2 crashes" was fixed. + +5.9.064 (2011-04-05) + - A bug related to character entities on HTML cells was fixed. + +5.9.063 (2011-04-01) + - Bug item #3267235 "WriteHTML() and image that doesn't fit on the page" was fixed. + +5.9.062 (2011-03-23) + - Bug item #3232650 "Using Write if there are pageRegions active creates error" was fixed. + - Bug item #3221891 "text input borders" was fixed. + - Bug item #3228958 "Adobe Reader 9.4.2 crash" was fixed. + +5.9.061 (2011-03-15) + - Bug item #3213488 "wrong function call in function Write" was fixed. + - Bug item #3203007 "list element with black background" was fixed. + 5.9.060 (2011-03-08) - addTOC() method was fixed for text alignment problems. diff --git a/htdocs/includes/tcpdf/README.TXT b/htdocs/includes/tcpdf/README.TXT index 7b5ef2fd168..5b5c94f7771 100644 --- a/htdocs/includes/tcpdf/README.TXT +++ b/htdocs/includes/tcpdf/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.060 -Release date: 2011-03-08 +Version: 5.9.098 +Release date: 2011-06-23 Author: Nicola Asuni Copyright (c) 2002-2011: @@ -45,7 +45,7 @@ Main Features: * text rendering modes (fill, stroke and clipping); * multiple columns mode; * no-write page regions; - * bookmarks and table of content; + * bookmarks, named destinations and table of content; * text hyphenation; * text stretching and spacing (tracking/kerning); * automatic page break, line break and text alignments including justification; @@ -64,7 +64,7 @@ Source Code Documentation: http://www.tcpdf.org/doc/ For Additional Documentation: - http: www.tcpdf.org + http://www.tcpdf.org License Copyright (C) 2002-2011 Nicola Asuni - Tecnick.com S.r.l. @@ -72,8 +72,8 @@ License TCPDF is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the - License, or (at your option) any later version. Additionally, - YOU CAN'T REMOVE ANY TCPDF COPYRIGHT NOTICE OR LINK FROM THE + License, or (at your option) any later version. Additionally, + YOU CAN'T REMOVE ANY TCPDF COPYRIGHT NOTICE OR LINK FROM THE GENERATED PDF DOCUMENTS. TCPDF is distributed in the hope that it will be useful, but diff --git a/htdocs/includes/tcpdf/barcodes.php b/htdocs/includes/tcpdf/barcodes.php index a16ed6ec121..5409ae5cda4 100644 --- a/htdocs/includes/tcpdf/barcodes.php +++ b/htdocs/includes/tcpdf/barcodes.php @@ -1,13 +1,13 @@ * @package com.tecnick.tcpdf - * @version 1.0.012 + * @version 1.0.017 * @author Nicola Asuni */ class TCPDFBarcode { @@ -59,15 +59,16 @@ class TCPDFBarcode { * This is the class constructor. * Return an array representations for common 1D barcodes: * @param $code (string) code to print - * @param $type (string) type of barcode: + * @param $type (string) type of barcode: + * @public */ public function __construct($code, $type) { $this->setBarcode($code, $type); @@ -76,16 +77,71 @@ class TCPDFBarcode { /** * Return an array representations of barcode. * @return array + * @public */ public function getBarcodeArray() { return $this->barcode_array; } + /** + * Send barcode as SVG image object to the standard output. + * @param $w (int) Minimum width of a single bar in user units. + * @param $h (int) Height of barcode in user units. + * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @public + */ + public function getBarcodeSVG($w=2, $h=30, $color='black') { + // send XML headers + $code = $this->getBarcodeSVGcode($w, $h, $color); + header('Content-Type: application/svg+xml'); + header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1 + header('Pragma: public'); + header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + header('Content-Disposition: inline; filename="'.md5($code).'.svg";'); + //header('Content-Length: '.strlen($code)); + echo $code; + } + + /** + * Return a SVG string representation of barcode. + * @param $w (int) Minimum width of a single bar in user units. + * @param $h (int) Height of barcode in user units. + * @param $color (string) Foreground color (in SVG format) for bar elements (background is transparent). + * @return string SVG code. + * @public + */ + public function getBarcodeSVGcode($w=2, $h=30, $color='black') { + // replace table for special characters + $repstr = array("\0" => '', '&' => '&', '<' => '<', '>' => '>'); + $svg = '<'.'?'.'xml version="1.0" standalone="no"'.'?'.'>'."\n"; + $svg .= ''."\n"; + $svg .= ''."\n"; + $svg .= "\t".''.strtr($this->barcode_array['code'], $repstr).''."\n"; + $svg .= "\t".''."\n"; + // print bars + $x = 0; + foreach ($this->barcode_array['bcode'] as $k => $v) { + $bw = round(($v['w'] * $w), 3); + $bh = round(($v['h'] * $h / $this->barcode_array['maxh']), 3); + if ($v['t']) { + $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); + // draw a vertical bar + $svg .= "\t\t".''."\n"; + } + $x += $bw; + } + $svg .= "\t".''."\n"; + $svg .= ''."\n"; + return $svg; + } + /** * Set the barcode. * @param $code (string) code to print - * @param $type (string) type of barcode: - * @return array + * @param $type (string) type of barcode: + * @return array barcode array + * @public */ public function setBarcode($code, $type) { switch (strtoupper($type)) { @@ -125,6 +181,10 @@ class TCPDFBarcode { $arrcode = $this->barcode_i25($code, true); break; } + case 'C128': { // CODE 128 + $arrcode = $this->barcode_c128($code, ''); + break; + } case 'C128A': { // CODE 128 A $arrcode = $this->barcode_c128($code, 'A'); break; @@ -268,7 +328,6 @@ class TCPDFBarcode { $chr['+'] = '121112121'; $chr['%'] = '111212121'; $chr['*'] = '121121211'; - $code = strtoupper($code); if ($extended) { // extended mode @@ -283,7 +342,6 @@ class TCPDFBarcode { } // add start and stop codes $code = '*'.$code.'*'; - $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array()); $k = 0; $clen = strlen($code); @@ -392,54 +450,54 @@ class TCPDFBarcode { * @protected */ protected function barcode_code93($code) { - $chr['0'] = '131112'; - $chr['1'] = '111213'; - $chr['2'] = '111312'; - $chr['3'] = '111411'; - $chr['4'] = '121113'; - $chr['5'] = '121212'; - $chr['6'] = '121311'; - $chr['7'] = '111114'; - $chr['8'] = '131211'; - $chr['9'] = '141111'; - $chr['A'] = '211113'; - $chr['B'] = '211212'; - $chr['C'] = '211311'; - $chr['D'] = '221112'; - $chr['E'] = '221211'; - $chr['F'] = '231111'; - $chr['G'] = '112113'; - $chr['H'] = '112212'; - $chr['I'] = '112311'; - $chr['J'] = '122112'; - $chr['K'] = '132111'; - $chr['L'] = '111123'; - $chr['M'] = '111222'; - $chr['N'] = '111321'; - $chr['O'] = '121122'; - $chr['P'] = '131121'; - $chr['Q'] = '212112'; - $chr['R'] = '212211'; - $chr['S'] = '211122'; - $chr['T'] = '211221'; - $chr['U'] = '221121'; - $chr['V'] = '222111'; - $chr['W'] = '112122'; - $chr['X'] = '112221'; - $chr['Y'] = '122121'; - $chr['Z'] = '123111'; - $chr['-'] = '121131'; - $chr['.'] = '311112'; - $chr[' '] = '311211'; - $chr['$'] = '321111'; - $chr['/'] = '112131'; - $chr['+'] = '113121'; - $chr['%'] = '211131'; + $chr[48] = '131112'; // 0 + $chr[49] = '111213'; // 1 + $chr[50] = '111312'; // 2 + $chr[51] = '111411'; // 3 + $chr[52] = '121113'; // 4 + $chr[53] = '121212'; // 5 + $chr[54] = '121311'; // 6 + $chr[55] = '111114'; // 7 + $chr[56] = '131211'; // 8 + $chr[57] = '141111'; // 9 + $chr[65] = '211113'; // A + $chr[66] = '211212'; // B + $chr[67] = '211311'; // C + $chr[68] = '221112'; // D + $chr[69] = '221211'; // E + $chr[70] = '231111'; // F + $chr[71] = '112113'; // G + $chr[72] = '112212'; // H + $chr[73] = '112311'; // I + $chr[74] = '122112'; // J + $chr[75] = '132111'; // K + $chr[76] = '111123'; // L + $chr[77] = '111222'; // M + $chr[78] = '111321'; // N + $chr[79] = '121122'; // O + $chr[80] = '131121'; // P + $chr[81] = '212112'; // Q + $chr[82] = '212211'; // R + $chr[83] = '211122'; // S + $chr[84] = '211221'; // T + $chr[85] = '221121'; // U + $chr[86] = '222111'; // V + $chr[87] = '112122'; // W + $chr[88] = '112221'; // X + $chr[89] = '122121'; // Y + $chr[90] = '123111'; // Z + $chr[45] = '121131'; // - + $chr[46] = '311112'; // . + $chr[32] = '311211'; // + $chr[36] = '321111'; // $ + $chr[47] = '112131'; // / + $chr[43] = '113121'; // + + $chr[37] = '211131'; // % $chr[128] = '121221'; // ($) $chr[129] = '311121'; // (/) $chr[130] = '122211'; // (+) $chr[131] = '312111'; // (%) - $chr['*'] = '111141'; + $chr[42] = '111141'; // start-stop $code = strtoupper($code); $encode = array( chr(0) => chr(131).'U', chr(1) => chr(128).'A', chr(2) => chr(128).'B', chr(3) => chr(128).'C', @@ -483,14 +541,14 @@ class TCPDFBarcode { $code_ext .= $encode[$code{$i}]; } // checksum - $code .= $this->checksum_code93($code); + $code_ext .= $this->checksum_code93($code_ext); // add start and stop codes - $code = '*'.$code.'*'; + $code = '*'.$code_ext.'*'; $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array()); $k = 0; $clen = strlen($code); for ($i = 0; $i < $clen; ++$i) { - $char = $code{$i}; + $char = ord($code{$i}); if(!isset($chr[$char])) { // invalid character return false; @@ -524,9 +582,10 @@ class TCPDFBarcode { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', - 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%'); + 'W', 'X', 'Y', 'Z', '-', '.', ' ', '$', '/', '+', '%', + '<', '=', '>', '?'); // translate special characters - $code = strtr($code, chr(128).chr(129).chr(130).chr(131), '$/+%'); + $code = strtr($code, chr(128).chr(131).chr(129).chr(130), '<=>?'); $len = strlen($code); // calculate check digit C $p = 1; @@ -555,7 +614,10 @@ class TCPDFBarcode { } $check %= 47; $k = $chars[$check]; - return $c.$k; + $checksum = $c.$k; + // resto respecial characters + $checksum = strtr($checksum, '<=>?', chr(128).chr(131).chr(129).chr(130)); + return $checksum; } /** @@ -781,11 +843,11 @@ class TCPDFBarcode { * C128 barcodes. * Very capable code, excellent density, high reliability; in very wide use world-wide * @param $code (string) code to represent. - * @param $type (string) barcode type: A, B or C + * @param $type (string) barcode type: A, B, C or empty for automatic switch (AUTO mode) * @return array barcode representation. * @protected */ - protected function barcode_c128($code, $type='B') { + protected function barcode_c128($code, $type='') { $chr = array( '212222', /* 00 */ '222122', /* 01 */ @@ -891,71 +953,210 @@ class TCPDFBarcode { '311141', /* 101 */ '411131', /* 102 */ '211412', /* 103 START A */ - '211214', /* 104 START B */ - '211232', /* 105 START C */ + '211214', /* 104 START B */ + '211232', /* 105 START C */ '233111', /* STOP */ '200000' /* END */ ); - $keys = ''; + // ASCII characters for code A (ASCII 00 - 95) + $keys_a = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'; + $keys_a .= chr(0).chr(1).chr(2).chr(3).chr(4).chr(5).chr(6).chr(7).chr(8).chr(9); + $keys_a .= chr(10).chr(11).chr(12).chr(13).chr(14).chr(15).chr(16).chr(17).chr(18).chr(19); + $keys_a .= chr(20).chr(21).chr(22).chr(23).chr(24).chr(25).chr(26).chr(27).chr(28).chr(29); + $keys_a .= chr(30).chr(31); + // ASCII characters for code B (ASCII 32 - 127) + $keys_b = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'.chr(127); + // special codes + $fnc_a = array(241 => 102, 242 => 97, 243 => 96, 244 => 101); + $fnc_b = array(241 => 102, 242 => 97, 243 => 96, 244 => 100); + // array of symbols + $code_data = array(); + // lenght of the code + $len = strlen($code); switch(strtoupper($type)) { - case 'A': { + case 'A': { // MODE A $startid = 103; - $keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_'; - for ($i = 0; $i < 32; ++$i) { - $keys .= chr($i); + for ($i = 0; $i < $len; ++$i) { + $char = $code{$i}; + $char_id = ord($char); + if (($char_id >= 241) AND ($char_id <= 244)) { + $code_data[] = $fnc_a[$char_id]; + } elseif (($char_id >= 0) AND ($char_id <= 95)) { + $code_data[] = strpos($keys_a, $char); + } else { + return false; + } } break; } - case 'B': { + case 'B': { // MODE B $startid = 104; - $keys = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~'.chr(127); + for ($i = 0; $i < $len; ++$i) { + $char = $code{$i}; + $char_id = ord($char); + if (($char_id >= 241) AND ($char_id <= 244)) { + $code_data[] = $fnc_b[$char_id]; + } elseif (($char_id >= 32) AND ($char_id <= 127)) { + $code_data[] = strpos($keys_b, $char); + } else { + return false; + } + } break; } - case 'C': { + case 'C': { // MODE C $startid = 105; - $keys = ''; - if ((strlen($code) % 2) != 0) { - // The length of barcode value must be even ($code). You must pad the number with zeros + if (ord($code{0}) == 241) { + $code_data[] = 102; + $code = substr($code, 1); + --$len; + } + if (($len % 2) != 0) { + // the length must be even return false; } - for ($i = 0; $i <= 99; ++$i) { - $keys .= chr($i); + for ($i = 0; $i < $len; $i+=2) { + $chrnum = $code{$i}.$code{$i+1}; + if (preg_match('/([0-9]{2})/', $chrnum) > 0) { + $code_data[] = intval($chrnum); + } else { + return false; + } } - $new_code = ''; - $hclen = (strlen($code) / 2); - for ($i = 0; $i < $hclen; ++$i) { - $new_code .= chr(intval($code{(2 * $i)}.$code{(2 * $i + 1)})); - } - $code = $new_code; break; } - default: { - return false; + default: { // MODE AUTO + // split code into sequences + $sequence = array(); + // get numeric sequences (if any) + $numseq = array(); + preg_match_all('/([0-9]{4,})/', $code, $numseq, PREG_OFFSET_CAPTURE); + if (isset($numseq[1]) AND !empty($numseq[1])) { + $end_offset = 0; + foreach ($numseq[1] as $val) { + $offset = $val[1]; + if ($offset > $end_offset) { + // non numeric sequence + $sequence = array_merge($sequence, $this->get128ABsequence(substr($code, $end_offset, ($offset - $end_offset)))); + } + // numeric sequence + $slen = strlen($val[0]); + if (($slen % 2) != 0) { + // the length must be even + --$slen; + } + $sequence[] = array('C', substr($code, $offset, $slen), $slen); + $end_offset = $offset + $slen; + } + if ($end_offset < $len) { + $sequence = array_merge($sequence, $this->get128ABsequence(substr($code, $end_offset))); + } + } else { + // text code (non C mode) + $sequence = array_merge($sequence, $this->get128ABsequence($code)); + } + // process the sequence + foreach ($sequence as $key => $seq) { + switch($seq[0]) { + case 'A': { + if ($key == 0) { + $startid = 103; + } elseif ($sequence[($key - 1)][0] != 'A') { + if (($seq[2] == 1) AND ($key > 0) AND ($sequence[($key - 1)][0] == 'B') AND (!isset($sequence[($key - 1)][3]))) { + // single character shift + $code_data[] = 98; + // mark shift + $sequence[$key][3] = true; + } elseif (!isset($sequence[($key - 1)][3])) { + $code_data[] = 101; + } + } + for ($i = 0; $i < $seq[2]; ++$i) { + $char = $seq[1]{$i}; + $char_id = ord($char); + if (($char_id >= 241) AND ($char_id <= 244)) { + $code_data[] = $fnc_a[$char_id]; + } else { + $code_data[] = strpos($keys_a, $char); + } + } + break; + } + case 'B': { + if ($key == 0) { + $tmpchr = ord($seq[1]{0}); + if (($seq[2] == 1) AND ($tmpchr >= 241) AND ($tmpchr <= 244) AND isset($sequence[($key + 1)]) AND ($sequence[($key + 1)][0] != 'B')) { + switch ($sequence[($key + 1)][0]) { + case 'A': { + $startid = 103; + $sequence[$key][0] = 'A'; + $code_data[] = $fnc_a[$tmpchr]; + break; + } + case 'C': { + $startid = 105; + $sequence[$key][0] = 'C'; + $code_data[] = $fnc_a[$tmpchr]; + break; + } + } + break; + } else { + $startid = 104; + } + } elseif ($sequence[($key - 1)][0] != 'B') { + if (($seq[2] == 1) AND ($key > 0) AND ($sequence[($key - 1)][0] == 'A') AND (!isset($sequence[($key - 1)][3]))) { + // single character shift + $code_data[] = 98; + // mark shift + $sequence[$key][3] = true; + } elseif (!isset($sequence[($key - 1)][3])) { + $code_data[] = 100; + } + } + for ($i = 0; $i < $seq[2]; ++$i) { + $char = $seq[1]{$i}; + $char_id = ord($char); + if (($char_id >= 241) AND ($char_id <= 244)) { + $code_data[] = $fnc_b[$char_id]; + } else { + $code_data[] = strpos($keys_b, $char); + } + } + break; + } + case 'C': { + if ($key == 0) { + $startid = 105; + } elseif ($sequence[($key - 1)][0] != 'C') { + $code_data[] = 99; + } + for ($i = 0; $i < $seq[2]; $i+=2) { + $chrnum = $seq[1]{$i}.$seq[1]{$i+1}; + $code_data[] = intval($chrnum); + } + break; + } + } + } } } // calculate check character $sum = $startid; - $clen = strlen($code); - for ($i = 0; $i < $clen; ++$i) { - $sum += (strpos($keys, $code{$i}) * ($i+1)); + foreach ($code_data as $key => $val) { + $sum += ($val * ($key + 1)); } - $check = ($sum % 103); - // add start, check and stop codes - $code = chr($startid).$code.chr($check).chr(106).chr(107); + // add check character + $code_data[] = ($sum % 103); + // add stop sequence + $code_data[] = 106; + $code_data[] = 107; + // add start code at the beginning + array_unshift($code_data, $startid); + // build barcode array $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array()); - $k = 0; - $len = strlen($code); - for ($i = 0; $i < $len; ++$i) { - $ck = strpos($keys, $code{$i}); - if (($i == 0) OR ($i > ($len-4))) { - $char_num = ord($code{$i}); - $seq = $chr[$char_num]; - } elseif(($ck >= 0) AND isset($chr[$ck])) { - $seq = $chr[$ck]; - } else { - // invalid character - return false; - } + foreach ($code_data as $val) { + $seq = $chr[$val]; for ($j = 0; $j < 6; ++$j) { if (($j % 2) == 0) { $t = true; // bar @@ -963,14 +1164,48 @@ class TCPDFBarcode { $t = false; // space } $w = $seq{$j}; - $bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); + $bararray['bcode'][] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0); $bararray['maxw'] += $w; - ++$k; } } return $bararray; } + /** + * Split text code in A/B sequence for 128 code + * @param $code (string) code to split. + * @return array sequence + * @protected + */ + protected function get128ABsequence($code) { + $len = strlen($code); + $sequence = array(); + // get A sequences (if any) + $numseq = array(); + preg_match_all('/([\0-\31])/', $code, $numseq, PREG_OFFSET_CAPTURE); + if (isset($numseq[1]) AND !empty($numseq[1])) { + $end_offset = 0; + foreach ($numseq[1] as $val) { + $offset = $val[1]; + if ($offset > $end_offset) { + // B sequence + $sequence[] = array('B', substr($code, $end_offset, ($offset - $end_offset)), ($offset - $end_offset)); + } + // A sequence + $slen = strlen($val[0]); + $sequence[] = array('A', substr($code, $offset, $slen), $slen); + $end_offset = $offset + $slen; + } + if ($end_offset < $len) { + $sequence[] = array('B', substr($code, $end_offset), ($len - $end_offset)); + } + } else { + // only B sequence + $sequence[] = array('B', $code, $len); + } + return $sequence; + } + /** * EAN13 and UPC-A barcodes. * EAN13: European Article Numbering international retail product code @@ -1544,7 +1779,6 @@ class TCPDFBarcode { '-' => '112111', 'S' => '112211' ); - $bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array()); $k = 0; $w = 0; diff --git a/htdocs/includes/tcpdf/cache/utf8test.txt b/htdocs/includes/tcpdf/cache/utf8test.txt index 723a37d84b0..291d4e73554 100644 --- a/htdocs/includes/tcpdf/cache/utf8test.txt +++ b/htdocs/includes/tcpdf/cache/utf8test.txt @@ -1,122 +1,128 @@ -Sentences that contain all letters commonly used in a language --------------------------------------------------------------- - -Markus Kuhn -- 2001-09-02 - -This file is UTF-8 encoded. - - -Danish (da) ---------- - - Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen - Wolther spillede på xylofon. - (= Quiz contestants were eating strawbery with cream while Wolther - the circus clown played on xylophone.) - -German (de) ------------ - - Falsches Üben von Xylophonmusik quält jeden größeren Zwerg - (= Wrongful practicing of xylophone music tortures every larger dwarf) - - Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich - (= Twelve boxing fighters hunted Eva across the dike of Sylt) - - Heizölrückstoßabdämpfung - (= fuel oil recoil absorber) - (jqvwxy missing, but all non-ASCII letters in one word) - -English (en) ------------- - - The quick brown fox jumps over the lazy dog - -Spanish (es) ------------- - - El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y - frío, añoraba a su querido cachorro. - (Contains every letter and every accent, but not every combination - of vowel + acute.) - -French (fr) ------------ - - Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à - côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce - qui lui permet de penser à la cænogenèse de l'être dont il est question - dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui, - pense-t-il, diminue çà et là la qualité de son œuvre. - - l'île exiguë - Où l'obèse jury mûr - Fête l'haï volapük, - Âne ex aéquo au whist, - Ôtez ce vœu déçu. - - Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en - canoë au delà des îles, près du mälström où brûlent les novæ. - -Irish Gaelic (ga) ------------------ - - D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh - -Hungarian (hu) --------------- - - Árvíztűrő tükörfúrógép - (= flood-proof mirror-drilling machine, only all non-ASCII letters) - -Icelandic (is) --------------- - - Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa - - Sævör grét áðan því úlpan var ónýt - (some ASCII letters missing) - -Greek (el) -------------- - - Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο - (= No more shall I see acacias or myrtles in the golden clearing) - - Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία - (= I uncover the soul-destroying abhorrence) - -Hebrew (iw) ------------ - - ? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה - -Polish (pl) ------------ - - Pchnąć w tę łódź jeża lub osiem skrzyń fig - (= To push a hedgehog or eight bins of figs in this boat) - - Zażółć gęślą jaźń - -Russian (ru) ------------- - - В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! - (= Would a citrus live in the bushes of south? Yes, but only a fake one!) - -Thai (th) ---------- - - [--------------------------|------------------------] - ๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน - จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร - ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย - ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ - - [The copyright for the Thai example is owned by The Computer - Association of Thailand under the Royal Patronage of His Majesty the - King.] - -Please let me know if you find others! Special thanks to the people -from all over the world who contributed these sentences. +Sentences that contain all letters commonly used in a language +-------------------------------------------------------------- + +This file is UTF-8 encoded. + +Czech (cz) +--------- + + Příšerně žluťoučký kůň úpěl ďábelské ódy. + Hleď, toť přízračný kůň v mátožné póze šíleně úpí. + Zvlášť zákeřný učeň s ďolíčky běží podél zóny úlů. + Loď čeří kýlem tůň obzvlášť v Grónské úžině. + Ó, náhlý déšť již zvířil prach a čilá laň teď běží s houfcem gazel k úkrytům. + +Danish (da) +--------- + + Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen + Wolther spillede på xylofon. + (= Quiz contestants were eating strawbery with cream while Wolther + the circus clown played on xylophone.) + +German (de) +----------- + + Falsches Üben von Xylophonmusik quält jeden größeren Zwerg + (= Wrongful practicing of xylophone music tortures every larger dwarf) + + Zwölf Boxkämpfer jagten Eva quer über den Sylter Deich + (= Twelve boxing fighters hunted Eva across the dike of Sylt) + + Heizölrückstoßabdämpfung + (= fuel oil recoil absorber) + (jqvwxy missing, but all non-ASCII letters in one word) + +English (en) +------------ + + The quick brown fox jumps over the lazy dog + +Spanish (es) +------------ + + El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y + frío, añoraba a su querido cachorro. + (Contains every letter and every accent, but not every combination + of vowel + acute.) + +French (fr) +----------- + + Portez ce vieux whisky au juge blond qui fume sur son île intérieure, à + côté de l'alcôve ovoïde, où les bûches se consument dans l'âtre, ce + qui lui permet de penser à la cænogenèse de l'être dont il est question + dans la cause ambiguë entendue à Moÿ, dans un capharnaüm qui, + pense-t-il, diminue çà et là la qualité de son œuvre. + + l'île exiguë + Où l'obèse jury mûr + Fête l'haï volapük, + Âne ex aéquo au whist, + Ôtez ce vœu déçu. + + Le cœur déçu mais l'âme plutôt naïve, Louÿs rêva de crapaüter en + canoë au delà des îles, près du mälström où brûlent les novæ. + +Irish Gaelic (ga) +----------------- + + D'fhuascail Íosa, Úrmhac na hÓighe Beannaithe, pór Éava agus Ádhaimh + +Hungarian (hu) +-------------- + + Árvíztűrő tükörfúrógép + (= flood-proof mirror-drilling machine, only all non-ASCII letters) + +Icelandic (is) +-------------- + + Kæmi ný öxi hér ykist þjófum nú bæði víl og ádrepa + + Sævör grét áðan því úlpan var ónýt + (some ASCII letters missing) + +Greek (el) +------------- + + Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο + (= No more shall I see acacias or myrtles in the golden clearing) + + Ξεσκεπάζω τὴν ψυχοφθόρα βδελυγμία + (= I uncover the soul-destroying abhorrence) + +Hebrew (iw) +----------- + + ? דג סקרן שט בים מאוכזב ולפתע מצא לו חברה איך הקליטה + +Polish (pl) +----------- + + Pchnąć w tę łódź jeża lub osiem skrzyń fig + (= To push a hedgehog or eight bins of figs in this boat) + + Zażółć gęślą jaźń + +Russian (ru) +------------ + + В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! + (= Would a citrus live in the bushes of south? Yes, but only a fake one!) + +Thai (th) +--------- + + [--------------------------|------------------------] + ๏ เป็นมนุษย์สุดประเสริฐเลิศคุณค่า กว่าบรรดาฝูงสัตว์เดรัจฉาน + จงฝ่าฟันพัฒนาวิชาการ อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร + ไม่ถือโทษโกรธแช่งซัดฮึดฮัดด่า หัดอภัยเหมือนกีฬาอัชฌาสัย + ปฏิบัติประพฤติกฎกำหนดใจ พูดจาให้จ๊ะๆ จ๋าๆ น่าฟังเอย ฯ + + [The copyright for the Thai example is owned by The Computer + Association of Thailand under the Royal Patronage of His Majesty the + King.] + +Please let me know if you find others! Special thanks to the people +from all over the world who contributed these sentences. diff --git a/htdocs/includes/tcpdf/config/lang/far.php b/htdocs/includes/tcpdf/config/lang/far.php new file mode 100644 index 00000000000..c2a2e289797 --- /dev/null +++ b/htdocs/includes/tcpdf/config/lang/far.php @@ -0,0 +1,47 @@ + + + + -TCPDF Documentation - +TCPDF DOCUMENTATION + - - - - - - - - - - -
com-tecnick-tcpdf
- - - [ class tree: com-tecnick-tcpdf ] - [ index: com-tecnick-tcpdf ] - [ all elements ] -
- - - - - - -
-
- -

TCPDF Documentation

-Welcome to com-tecnick-tcpdf!
-
-This documentation was generated by phpDocumentor v1.4.3
-
-
- Documentation generated on Thu, 25 Nov 2010 09:23:16 +0100 by phpDocumentor 1.4.3 -
-
-
- +TCPDF Documentation - \ No newline at end of file + diff --git a/htdocs/includes/tcpdf/examples/example_001.php b/htdocs/includes/tcpdf/examples/example_001.php new file mode 100644 index 00000000000..cde421682e3 --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_001.php @@ -0,0 +1,102 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 001'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING); + +// set header and footer fonts +$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); +$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); +$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); +$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set default font subsetting mode +$pdf->setFontSubsetting(true); + +// Set font +// dejavusans is a UTF-8 Unicode font, if you only need to +// print standard ASCII chars, you can use core fonts like +// helvetica or times to reduce file size. +$pdf->SetFont('dejavusans', '', 14, '', true); + +// Add a page +// This method has several options, check the source code documentation for more information. +$pdf->AddPage(); + +// Set some content to print +$html = <<Welcome to  TCPDF ! +This is the first example of TCPDF library. +

This text is printed using the writeHTMLCell() method but you can also use: Multicell(), writeHTML(), Write(), Cell() and Text().

+

Please check the source code documentation and other examples for further information.

+

TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

+EOD; + +// Print text using writeHTMLCell() +$pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $html, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); + +// --------------------------------------------------------- + +// Close and output PDF document +// This method has several options, check the source code documentation for more information. +$pdf->Output('example_001.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ diff --git a/htdocs/includes/tcpdf/examples/example_002.php b/htdocs/includes/tcpdf/examples/example_002.php new file mode 100644 index 00000000000..d8dd7412259 --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_002.php @@ -0,0 +1,87 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 002'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// remove default header/footer +$pdf->setPrintHeader(false); +$pdf->setPrintFooter(false); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('times', 'BI', 20); + +// add a page +$pdf->AddPage(); + +// set some text to print +$txt = <<Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0); + +// --------------------------------------------------------- + +//Close and output PDF document +$pdf->Output('example_002.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ diff --git a/htdocs/includes/tcpdf/examples/example_003.php b/htdocs/includes/tcpdf/examples/example_003.php new file mode 100644 index 00000000000..bc98a34371c --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_003.php @@ -0,0 +1,118 @@ +Image($image_file, 10, 10, 15, '', 'JPG', '', 'T', false, 300, '', false, false, 0, false, false, false); + // Set font + $this->SetFont('helvetica', 'B', 20); + // Title + $this->Cell(0, 15, '<< TCPDF Example 003 >>', 0, false, 'C', 0, '', 0, false, 'M', 'M'); + } + + // Page footer + public function Footer() { + // Position at 15 mm from bottom + $this->SetY(-15); + // Set font + $this->SetFont('helvetica', 'I', 8); + // Page number + $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'C', 0, '', 0, false, 'T', 'M'); + } +} + +// create new PDF document +$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); + +// set document information +$pdf->SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 003'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); + +// set header and footer fonts +$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); +$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); +$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); +$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('times', 'BI', 12); + +// add a page +$pdf->AddPage(); + +// set some text to print +$txt = <<Write($h=0, $txt, $link='', $fill=0, $align='C', $ln=true, $stretch=0, $firstline=false, $firstblock=false, $maxh=0); + +// --------------------------------------------------------- + +//Close and output PDF document +$pdf->Output('example_003.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ diff --git a/htdocs/includes/tcpdf/examples/example_004.php b/htdocs/includes/tcpdf/examples/example_004.php new file mode 100644 index 00000000000..75d7e429fe2 --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_004.php @@ -0,0 +1,121 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 004'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 004', PDF_HEADER_STRING); + +// set header and footer fonts +$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); +$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); +$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); +$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('times', '', 11); + +// add a page +$pdf->AddPage(); + +//Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M') + +// test Cell stretching +$pdf->Cell(0, 0, 'TEST CELL STRETCH: no stretch', 1, 1, 'C', 0, '', 0); +$pdf->Cell(0, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); +$pdf->Cell(0, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); +$pdf->Cell(0, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); +$pdf->Cell(0, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); + +$pdf->Ln(5); + +$pdf->Cell(45, 0, 'TEST CELL STRETCH: scaling', 1, 1, 'C', 0, '', 1); +$pdf->Cell(45, 0, 'TEST CELL STRETCH: force scaling', 1, 1, 'C', 0, '', 2); +$pdf->Cell(45, 0, 'TEST CELL STRETCH: spacing', 1, 1, 'C', 0, '', 3); +$pdf->Cell(45, 0, 'TEST CELL STRETCH: force spacing', 1, 1, 'C', 0, '', 4); + +$pdf->AddPage(); + +// example using general stretching and spacing + +for ($stretching = 90; $stretching <= 110; $stretching += 10) { + for ($spacing = -0.254; $spacing <= 0.254; $spacing += 0.254) { + + // set general stretching (scaling) value + $pdf->setFontStretching($stretching); + + // set general spacing value + $pdf->setFontSpacing($spacing); + + $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, no stretch', 1, 1, 'C', 0, '', 0); + $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, scaling', 1, 1, 'C', 0, '', 1); + $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force scaling', 1, 1, 'C', 0, '', 2); + $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, spacing', 1, 1, 'C', 0, '', 3); + $pdf->Cell(0, 0, 'Stretching '.$stretching.'%, Spacing '.sprintf('%+.3F', $spacing).'mm, force spacing', 1, 1, 'C', 0, '', 4); + + $pdf->Ln(2); + } +} + +// --------------------------------------------------------- + +//Close and output PDF document +$pdf->Output('example_004.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ diff --git a/htdocs/includes/tcpdf/examples/example_005.php b/htdocs/includes/tcpdf/examples/example_005.php new file mode 100644 index 00000000000..cc5cbc32cdb --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_005.php @@ -0,0 +1,158 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 005'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING); + +// set header and footer fonts +$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); +$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); +$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); +$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('times', '', 10); + +// add a page +$pdf->AddPage(); + +// set cell padding +$pdf->setCellPaddings(1, 1, 1, 1); + +// set cell margins +$pdf->setCellMargins(1, 1, 1, 1); + +// set color for background +$pdf->SetFillColor(255, 255, 127); + +// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) + +// set some text for example +$txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; + +// Multicell test +$pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true); +$pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true); +$pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true); +$pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true); +$pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true); + +$pdf->Ln(4); + +// set color for background +$pdf->SetFillColor(220, 255, 220); + +// Vertical alignment +$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T'); +$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M'); +$pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] '.$txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B'); + +$pdf->Ln(4); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// set color for background +$pdf->SetFillColor(215, 235, 255); + +// set some text for example +$txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. + +Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; + +// print a blox of text using multicell() +$pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// AUTO-FITTING + +// set color for background +$pdf->SetFillColor(255, 235, 235); + +// Fit text on cell by reducing font size +$pdf->MultiCell(55, 60, '[FIT CELL] '.$txt."\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// CUSTOM PADDING + +// set color for background +$pdf->SetFillColor(255, 255, 215); + +// set font +$pdf->SetFont('helvetica', '', 8); + +// set cell padding +$pdf->setCellPaddings(2, 4, 6, 8); + +$txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n"; + +$pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true); + +// move pointer to last page +$pdf->lastPage(); + +// --------------------------------------------------------- + +//Close and output PDF document +$pdf->Output('example_005.pdf', 'I'); + +//============================================================+ +// END OF FILE +//============================================================+ diff --git a/htdocs/includes/tcpdf/examples/example_006.php b/htdocs/includes/tcpdf/examples/example_006.php new file mode 100644 index 00000000000..9d1ffee6d9e --- /dev/null +++ b/htdocs/includes/tcpdf/examples/example_006.php @@ -0,0 +1,332 @@ +SetCreator(PDF_CREATOR); +$pdf->SetAuthor('Nicola Asuni'); +$pdf->SetTitle('TCPDF Example 006'); +$pdf->SetSubject('TCPDF Tutorial'); +$pdf->SetKeywords('TCPDF, PDF, example, test, guide'); + +// set default header data +$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 006', PDF_HEADER_STRING); + +// set header and footer fonts +$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); +$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + +// set default monospaced font +$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + +//set margins +$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); +$pdf->SetHeaderMargin(PDF_MARGIN_HEADER); +$pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + +//set auto page breaks +$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + +//set image scale factor +$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + +//set some language-dependent strings +$pdf->setLanguageArray($l); + +// --------------------------------------------------------- + +// set font +$pdf->SetFont('dejavusans', '', 10); + +// add a page +$pdf->AddPage(); + +// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='') +// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true) + +// create some HTML content +$html = '

HTML Example

+Some special characters: < € € € & è è © > \\slash \\\\double-slash \\\\\\triple-slash +

List

+List example: +
    +
  1. test alt attribute test image
  2. +
  3. bold text
  4. +
  5. italic text
  6. +
  7. underlined text
  8. +
  9. bbibiubib
  10. +
  11. link to http://www.tecnick.com
  12. +
  13. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
    Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.
  14. +
  15. SUBLIST +
      +
    1. row one +
        +
      • sublist
      • +
      +
    2. +
    3. row two
    4. +
    +
  16. +
  17. TEST line through
  18. +
  19. font + 3
  20. +
  21. small text normal small text normal subscript normal superscript normal
  22. +
+
+
Coffee
+
Black hot drink
+
Milk
+
White cold drink
+
+
IMAGES
+test alt attributetest alt attributetest alt attribute +
'; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + + +// output some RTL HTML content +$html = '
The words “מזל [mazel] טוב [tov]” mean “Congratulations!”
'; +$pdf->writeHTML($html, true, false, true, false, ''); + +// test some inline CSS +$html = '

This is just an example of html code to demonstrate some supported CSS inline styles. +bold text +line-trough +underline and line-trough +color +background color +bold +xx-small +x-small +small +medium +large +x-large +xx-large +

'; + +$pdf->writeHTML($html, true, false, true, false, ''); + +// reset pointer to the last page +$pdf->lastPage(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// Print a table + +// add a page +$pdf->AddPage(); + +// create some HTML content +$subtable = '
ab
cd
'; + +$html = '

HTML TABLE:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#RIGHT alignLEFT align4A
1A1 example link column span. One two tree four five six seven eight nine ten.
line after br
small text normal subscript normal superscript normal bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
  1. first
    1. sublist
    2. sublist
  2. second
small small small small small small small small small small small small small small small small small small small small
4B
'.$subtable.'A2 € € € & è è
A2 € € € & è è
Red Yellow BG4C
1A2AA
2AB
2AC
4D
1B4E
1C2C3C4F
'; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + +// Print some HTML Cells + +$html = 'red green blue
red green blue'; + +$pdf->SetFillColor(255,255,0); + +$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'L', true); +$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 1, true, 'C', true); +$pdf->writeHTMLCell(0, 0, '', '', $html, 'LRTB', 1, 0, true, 'R', true); + +// reset pointer to the last page +$pdf->lastPage(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// Print a table + +// add a page +$pdf->AddPage(); + +// create some HTML content +$html = '

Image alignments on HTML table

+ + + + + + + + +
'; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + +// reset pointer to the last page +$pdf->lastPage(); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// Print all HTML colors + +// add a page +$pdf->AddPage(); + +require('../htmlcolors.php'); + +$textcolors = '

HTML Text Colors

'; +$bgcolors = '

HTML Background Colors

'; + +foreach($webcolor as $k => $v) { + $textcolors .= ''.$v.' '; + $bgcolors .= ''.$v.' '; +} + +// output the HTML content +$pdf->writeHTML($textcolors, true, false, true, false, ''); +$pdf->writeHTML($bgcolors, true, false, true, false, ''); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// Test word-wrap + +// create some HTML content +$html = '
+

Various tests

+link to page 2
+thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword thisisanotherverylongword thisisaverylongword'; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + +// Test fonts nesting +$html1 = 'Default Courier Helvetica Times dejavusans Times Helvetica Courier Default'; +$html2 = 'small text normal small text normal subscript normal superscript normal'; +$html3 = 'The quick brown fox jumps over the lazy dog.'; + +$html = $html1.'
'.$html2.'
'.$html3.'
'.$html3.'
'.$html2; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// test pre tag + +// add a page +$pdf->AddPage(); + +$html = << +Hello World!
+Hello + +
+int main() {
+    printf("HelloWorld");
+    return 0;
+}
+
+Monospace font, normal font, monospace font, normal font. +
+
DIV LEVEL 1
DIV LEVEL 2
DIV LEVEL 1
+
+SPAN LEVEL 1 SPAN LEVEL 2 SPAN LEVEL 1 +EOF; + +// output the HTML content +$pdf->writeHTML($html, true, false, true, false, ''); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +// test custom bullet points for list + +// add a page +$pdf->AddPage(); + +$html = <<Test custom bullet image for list items +