]> git.mjollnir.org Git - moodle.git/commitdiff
Added scripts
authorcrbusch <crbusch>
Fri, 2 Feb 2007 18:38:05 +0000 (18:38 +0000)
committercrbusch <crbusch>
Fri, 2 Feb 2007 18:38:05 +0000 (18:38 +0000)
lib/tcpdf/barcode/barcode.php [deleted file]
lib/tcpdf/barcode/c128aobject.php [deleted file]
lib/tcpdf/barcode/c128bobject.php [deleted file]
lib/tcpdf/barcode/c128cobject.php [deleted file]
lib/tcpdf/barcode/c39object.php [deleted file]
lib/tcpdf/barcode/i25object.php [deleted file]
lib/tcpdf/barcode/image.php [deleted file]
lib/tcpdf/html2pdf.php [new file with mode: 0644]
lib/tcpdf/tcpdfprotection.php [new file with mode: 0644]

diff --git a/lib/tcpdf/barcode/barcode.php b/lib/tcpdf/barcode/barcode.php
deleted file mode 100755 (executable)
index 133d8ce..0000000
+++ /dev/null
@@ -1,441 +0,0 @@
-<?php
-//============================================================+
-// File name   : barcode.php
-// Begin       : 2002-07-31
-// Last Update : 2005-01-02
-// Author      : Karim Mribti [barcode@mribti.com]
-// Version     : 1.1 [0.0.8a (original code)]
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Generic Barcode Render Class for PHP using
-//               the GD graphics library.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//  - $mCharSet and $mChars variables were added here
-//============================================================+
-
-/**
- * Barcode Render Class for PHP using the GD graphics library.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a 2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-// Styles
-// Global
-
-/**
- * option: generate barcode border
- */
-define("BCS_BORDER", 1);
-
-/**
- * option: use transparent background
- */
-define("BCS_TRANSPARENT", 2);
-
-/**
- * option: center barcode
- */
-define("BCS_ALIGN_CENTER", 4);
-
-/**
- * option: align left
- */
-define("BCS_ALIGN_LEFT", 8);
-
-/**
- * option: align right
- */
-define("BCS_ALIGN_RIGHT", 16);
-
-/**
- * option: generate JPEG image
- */
-define("BCS_IMAGE_JPEG", 32);
-
-/**
- * option: generate PNG image
- */
-define("BCS_IMAGE_PNG", 64);
-
-/**
- * option: draw text
- */
-define("BCS_DRAW_TEXT", 128);
-
-/**
- * option: stretch text
- */
-define("BCS_STRETCH_TEXT", 256);
-
-/**
- * option: reverse color
- */
-define("BCS_REVERSE_COLOR", 512);
-
-/**
- * option: draw check
- * (only for I25 code)
- */
-define("BCS_I25_DRAW_CHECK", 2048);
-
-/**
- * set default background color
- */
-define("BCD_DEFAULT_BACKGROUND_COLOR", 0xFFFFFF);
-
-/**
- * set default foreground color
- */
-define("BCD_DEFAULT_FOREGROUND_COLOR", 0x000000);
-
-/**
- * set default style options
- */
-define("BCD_DEFAULT_STYLE", BCS_BORDER | BCS_ALIGN_CENTER | BCS_IMAGE_PNG);
-
-/**
- * set default width
- */
-define("BCD_DEFAULT_WIDTH", 460);
-
-/**
- * set default height
- */
-define("BCD_DEFAULT_HEIGHT", 120);
-
-/**
- * set default font
- */
-define("BCD_DEFAULT_FONT", 5);
-
-/**
- * st default horizontal resolution
- */
-define("BCD_DEFAULT_XRES", 2);
-
-// Margins
-
-/**
- * set default margin
- */
-define("BCD_DEFAULT_MAR_Y1", 0);
-
-/**
- * set default margin
- */
-define("BCD_DEFAULT_MAR_Y2", 0);
-
-/**
- * set default text offset
- */
-define("BCD_DEFAULT_TEXT_OFFSET", 2);
-
-// For the I25 Only
-
-/**
- * narrow bar option
- * (only for I25 code)
- */
-define("BCD_I25_NARROW_BAR", 1);
-
-/**
- * wide bar option
- * (only for I25 code)
- */
-define("BCD_I25_WIDE_BAR", 2);
-
-// For the C39 Only
-
-/**
- * narrow bar option
- * (only for c39 code)
- */
-define("BCD_C39_NARROW_BAR", 1);
-
-/**
- * wide bar option
- * (only for c39 code)
- */
-define("BCD_C39_WIDE_BAR", 2);
-
-// For Code 128
-
-/**
- * set type 1 bar
- * (only for c128 code)
- */
-define("BCD_C128_BAR_1", 1);
-
-/**
- * set type 2 bar
- * (only for c128 code)
- */
-define("BCD_C128_BAR_2", 2);
-
-/**
- * set type 3 bar
- * (only for c128 code)
- */
-define("BCD_C128_BAR_3", 3);
-
-/**
- * set type 4 bar
- * (only for c128 code)
- */
-define("BCD_C128_BAR_4", 4);
-
-/**
- * Barcode Render Class for PHP using the GD graphics library.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a 2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-class BarcodeObject {
-    /**
-     * @var Image width in pixels.
-     * @access protected
-     */
-    var $mWidth;
-    
-    /**
-     * @var Image height in pixels.
-     * @access protected
-     */
-    var $mHeight;
-    
-    /**
-     * @var Numeric code for Barcode style.
-     * @access protected
-     */
-    var $mStyle;
-    
-    /**
-     * @var Background color.
-     * @access protected
-     */
-    var $mBgcolor;
-    
-    /**
-     * @var Brush color.
-     * @access protected
-     */
-    var $mBrush;
-    
-    /**
-     * @var Image object.
-     * @access protected
-     */
-    var $mImg;
-    
-    /**
-     * @var Numeric code for character font.
-     * @access protected
-     */
-    var $mFont;
-    
-    /**
-     * @var Error message.
-     * @access protected
-     */
-    var $mError;
-    
-    /**
-     * @var Character Set.
-     * @access protected
-     */
-    var $mCharSet;
-    
-    /**
-     * @var Allowed symbols.
-     * @access protected
-     */
-    var $mChars;
-
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     */
-    function BarcodeObject($Width=BCD_DEFAULT_WIDTH, $Height=BCD_DEFAULT_HEIGHT, $Style=BCD_DEFAULT_STYLE) {
-        $this->mWidth = $Width;
-        $this->mHeight = $Height;
-        $this->mStyle = $Style;
-        $this->mFont = BCD_DEFAULT_FONT;
-        $this->mImg = ImageCreate($this->mWidth, $this->mHeight);
-        $dbColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_FOREGROUND_COLOR : BCD_DEFAULT_BACKGROUND_COLOR;
-        $dfColor = $this->mStyle & BCS_REVERSE_COLOR ? BCD_DEFAULT_BACKGROUND_COLOR : BCD_DEFAULT_FOREGROUND_COLOR;
-        $this->mBgcolor = ImageColorAllocate($this->mImg, ($dbColor & 0xFF0000) >> 16,
-        ($dbColor & 0x00FF00) >> 8, $dbColor & 0x0000FF);
-        $this->mBrush = ImageColorAllocate($this->mImg, ($dfColor & 0xFF0000) >> 16,
-        ($dfColor & 0x00FF00) >> 8, $dfColor & 0x0000FF);
-        if (!($this->mStyle & BCS_TRANSPARENT)) {
-            ImageFill($this->mImg, $this->mWidth, $this->mHeight, $this->mBgcolor);
-        }
-    }
-
-    /**
-     * Returns the image object.
-     * @return object image.
-     * @author Nicola Asuni
-     * @since 1.5.2
-     */
-    function getImage() {
-        return $this->mImg;
-    }
-    
-    /**
-     * Abstract method used to draw the barcode image.
-     * @param int $xres Horizontal resolution.
-     */
-    function DrawObject($xres)  {
-        /* there is not implementation neded, is simply the asbsract function. */
-        return false;
-    }
-    
-    /**
-     * Draws the barcode border.
-     * @access protected
-     */
-    function DrawBorder() {
-        ImageRectangle($this->mImg, 0, 0, $this->mWidth-1, $this->mHeight-1, $this->mBrush);
-    }
-    
-    /**
-     * Draws the alphanumeric code.
-     * @param int $Font Font type.
-     * @param int $xPos Horiziontal position.
-     * @param int $yPos Vertical position.
-     * @param int $Char Alphanumeric code to write.
-     * @access protected
-     */
-    function DrawChar($Font, $xPos, $yPos, $Char) {
-        ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
-    }
-    
-    /**
-     * Draws a character string.
-     * @param int $Font Font type.
-     * @param int $xPos Horiziontal position.
-     * @param int $yPos Vertical position.
-     * @param int $Char string to write.
-     * @access protected
-     */
-    function DrawText($Font, $xPos, $yPos, $Char) {
-        ImageString($this->mImg,$Font,$xPos,$yPos,$Char,$this->mBrush);
-    }
-
-    /**
-     * Draws a single barcode bar.
-     * @param int $xPos Horiziontal position.
-     * @param int $yPos Vertical position.
-     * @param int $xSize Horizontal size.
-     * @param int $xSize Vertical size.
-     * @return bool trur in case of success, false otherwise.
-     * @access protected
-     */
-    function DrawSingleBar($xPos, $yPos, $xSize, $ySize) {
-        if ($xPos>=0 && $xPos<=$this->mWidth && ($xPos+$xSize)<=$this->mWidth &&
-        $yPos>=0 && $yPos<=$this->mHeight && ($yPos+$ySize)<=$this->mHeight) {
-            for ($i=0;$i<$xSize;$i++) {
-                ImageLine($this->mImg, $xPos+$i, $yPos, $xPos+$i, $yPos+$ySize, $this->mBrush);
-            }
-            return true;
-        }
-        return false;
-    }
-    
-    /**
-     * Returns the current error message.
-     * @return string error message.
-     */
-    function GetError() {
-        return $this->mError;
-    }
-    
-    /**
-     * Returns the font height.
-     * @param int $font font type.
-     * @return int font height.
-     */
-    function GetFontHeight($font) {
-        return ImageFontHeight($font);
-    }
-    
-    /**
-     * Returns the font width.
-     * @param int $font font type.
-     * @return int font width.
-     */
-    function GetFontWidth($font) {
-        return ImageFontWidth($font);
-    }
-    
-    /**
-     * Set font type.
-     * @param int $font font type.
-     */
-    function SetFont($font) {
-        $this->mFont = $font;
-    }
-    
-    /**
-     * Returns barcode style.
-     * @return int barcode style.
-     */
-    function GetStyle() {
-        return $this->mStyle;
-    }
-
-    /**
-     * Set barcode style.
-     * @param int $Style barcode style.
-     */
-    function SetStyle ($Style) {
-        $this->mStyle = $Style;
-    }
-
-    /**
-     * Flush the barcode image.
-     */
-    function FlushObject() {
-        if (($this->mStyle & BCS_BORDER)) {
-            $this->DrawBorder();
-        }
-        if ($this->mStyle & BCS_IMAGE_PNG) {
-            Header("Content-Type: image/png");
-            ImagePng($this->mImg);
-        } else if ($this->mStyle & BCS_IMAGE_JPEG) {
-            Header("Content-Type: image/jpeg");
-            ImageJpeg($this->mImg);
-        }
-    }
-    
-    /**
-     * Destroy the barcode image.
-     */
-    function DestroyObject() {
-        ImageDestroy($this->mImg);
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/barcode/c128aobject.php b/lib/tcpdf/barcode/c128aobject.php
deleted file mode 100755 (executable)
index 15cbbfa..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-<?php
-//============================================================+
-// File name   : c128aobject.php
-// Begin       : 2002-07-31
-// Last Update : 2004-12-29
-// Author      : Karim Mribti [barcode@mribti.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Code 128-A Barcode Render Class for PHP using
-//               the GD graphics library.
-//               Code 128-A is a continuous, multilevel and
-//               include all upper case alphanumeric characters
-//               and ASCII control characters.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
- * Code 128-A Barcode Render Class for PHP using the GD graphics library.<br>
- * Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Code 128-A Barcode Render Class for PHP using the GD graphics library.<br>
- * Code 128-A is a continuous, multilevel and include all upper case alphanumeric characters and ASCII control characters.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-class C128AObject extends BarcodeObject {
-    
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     * @param int $Value value to print on barcode.
-     */
-    function C128AObject($Width, $Height, $Style, $Value) {
-        $this->BarcodeObject($Width, $Height, $Style);
-        $this->mValue   = $Value;
-        $this->mChars   = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_";
-        $this->mCharSet = array (
-        "212222",   /*   00 */
-        "222122",   /*   01 */
-        "222221",   /*   02 */
-        "121223",   /*   03 */
-        "121322",   /*   04 */
-        "131222",   /*   05 */
-        "122213",   /*   06 */
-        "122312",   /*   07 */
-        "132212",   /*   08 */
-        "221213",   /*   09 */
-        "221312",   /*   10 */
-        "231212",   /*   11 */
-        "112232",   /*   12 */
-        "122132",   /*   13 */
-        "122231",   /*   14 */
-        "113222",   /*   15 */
-        "123122",   /*   16 */
-        "123221",   /*   17 */
-        "223211",   /*   18 */
-        "221132",   /*   19 */
-        "221231",   /*   20 */
-        "213212",   /*   21 */
-        "223112",   /*   22 */
-        "312131",   /*   23 */
-        "311222",   /*   24 */
-        "321122",   /*   25 */
-        "321221",   /*   26 */
-        "312212",   /*   27 */
-        "322112",   /*   28 */
-        "322211",   /*   29 */
-        "212123",   /*   30 */
-        "212321",   /*   31 */
-        "232121",   /*   32 */
-        "111323",   /*   33 */
-        "131123",   /*   34 */
-        "131321",   /*   35 */
-        "112313",   /*   36 */
-        "132113",   /*   37 */
-        "132311",   /*   38 */
-        "211313",   /*   39 */
-        "231113",   /*   40 */
-        "231311",   /*   41 */
-        "112133",   /*   42 */
-        "112331",   /*   43 */
-        "132131",   /*   44 */
-        "113123",   /*   45 */
-        "113321",   /*   46 */
-        "133121",   /*   47 */
-        "313121",   /*   48 */
-        "211331",   /*   49 */
-        "231131",   /*   50 */
-        "213113",   /*   51 */
-        "213311",   /*   52 */
-        "213131",   /*   53 */
-        "311123",   /*   54 */
-        "311321",   /*   55 */
-        "331121",   /*   56 */
-        "312113",   /*   57 */
-        "312311",   /*   58 */
-        "332111",   /*   59 */
-        "314111",   /*   60 */
-        "221411",   /*   61 */
-        "431111",   /*   62 */
-        "111224",   /*   63 */
-        "111422",   /*   64 */
-        "121124",   /*   65 */
-        "121421",   /*   66 */
-        "141122",   /*   67 */
-        "141221",   /*   68 */
-        "112214",   /*   69 */
-        "112412",   /*   70 */
-        "122114",   /*   71 */
-        "122411",   /*   72 */
-        "142112",   /*   73 */
-        "142211",   /*   74 */
-        "241211",   /*   75 */
-        "221114",   /*   76 */
-        "413111",   /*   77 */
-        "241112",   /*   78 */
-        "134111",   /*   79 */
-        "111242",   /*   80 */
-        "121142",   /*   81 */
-        "121241",   /*   82 */
-        "114212",   /*   83 */
-        "124112",   /*   84 */
-        "124211",   /*   85 */
-        "411212",   /*   86 */
-        "421112",   /*   87 */
-        "421211",   /*   88 */
-        "212141",   /*   89 */
-        "214121",   /*   90 */
-        "412121",   /*   91 */
-        "111143",   /*   92 */
-        "111341",   /*   93 */
-        "131141",   /*   94 */
-        "114113",   /*   95 */
-        "114311",   /*   96 */
-        "411113",   /*   97 */
-        "411311",   /*   98 */
-        "113141",   /*   99 */
-        "114131",   /*  100 */
-        "311141",   /*  101 */
-        "411131"    /*  102 */
-        );
-    }
-
-    /**
-     * Returns the character index.
-     * @param char $char character.
-     * @return int character index or -1 in case of error.
-     * @access private
-     */
-    function GetCharIndex($char) {
-        for ($i=0;$i<64;$i++) {
-            if ($this->mChars[$i] == $char) {
-                return $i;
-            }
-        }
-        return -1;
-    }
-    
-    /**
-     * Returns the bar size.
-     * @param int $xres Horizontal resolution.
-     * @param char $char Character.
-     * @return int barcode size.
-     * @access private
-     */
-    function GetBarSize($xres, $char) {
-        switch ($char) {
-            case '1': {
-                $cVal = BCD_C128_BAR_1;
-                break;
-            }
-            case '2': {
-                $cVal = BCD_C128_BAR_2;
-                break;
-            }
-            case '3': {
-                $cVal = BCD_C128_BAR_3;
-                break;
-            }
-            case '4': {
-                $cVal = BCD_C128_BAR_4;
-                break;
-            }
-            default: {
-                $cVal = 0;
-            }
-        }
-        return  $cVal * $xres;
-    }
-    
-    /**
-     * Returns barcode size.
-     * @param int $xres Horizontal resolution.
-     * @return barcode size.
-     * @access private
-     */
-    function GetSize($xres) {
-        $len = strlen($this->mValue);
-
-        if ($len == 0)  {
-            $this->mError = "Null value";
-            return false;
-        }
-        $ret = 0;
-        for ($i=0;$i<$len;$i++) {
-            if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) {
-                $this->mError = "C128A not include the char '".$this->mValue[$i]."'";
-                return false;
-            } else {
-                $cset = $this->mCharSet[$id];
-                $ret += $this->GetBarSize($xres, $cset[0]);
-                $ret += $this->GetBarSize($xres, $cset[1]);
-                $ret += $this->GetBarSize($xres, $cset[2]);
-                $ret += $this->GetBarSize($xres, $cset[3]);
-                $ret += $this->GetBarSize($xres, $cset[4]);
-                $ret += $this->GetBarSize($xres, $cset[5]);
-            }
-        }
-
-        /* length of Check character */
-        $cset = $this->GetCheckCharValue();
-        $CheckSize = 0;
-        for ($i=0;$i<6;$i++) {
-            $CheckSize += $this->GetBarSize($cset[$i], $xres);
-        }
-        $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
-        $StopSize  = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
-        return $StartSize + $ret + $CheckSize + $StopSize;
-    }
-    
-    /**
-     * Returns the check-char value.
-     * @return string.
-     * @access private
-     */
-    function GetCheckCharValue() {
-        $len = strlen($this->mValue);
-        $sum = 103; // 'A' type;
-        for ($i=0;$i<$len;$i++) {
-            $sum +=  $this->GetCharIndex($this->mValue[$i]) * ($i+1);
-        }
-        $check  = $sum % 103;
-        return $this->mCharSet[$check];
-    }
-
-    /**
-     * Draws the start code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStart($DrawPos, $yPos, $ySize, $xres) {
-        /* Start code is '211412' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('4', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the stop code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStop($DrawPos, $yPos, $ySize, $xres) {
-        /* Stop code is '2331112' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the check-char code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
-        $cset = $this->GetCheckCharValue();
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[0], $xres);
-        $DrawPos += $this->GetBarSize($cset[1], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[2], $xres);
-        $DrawPos += $this->GetBarSize($cset[3], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[4], $xres);
-        $DrawPos += $this->GetBarSize($cset[5], $xres);
-        return $DrawPos;
-    }
-
-    /**
-     * Draws the barcode object.
-     * @param int $xres Horizontal resolution.
-     * @return bool true in case of success.
-     */
-    function DrawObject($xres) {
-        $len = strlen($this->mValue);
-        if (($size = $this->GetSize($xres))==0) {
-            return false;
-        }
-
-        if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
-        else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
-        else $sPos = 0;
-
-        /* Total height of bar code -Bars only- */
-        if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
-        else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
-
-        /* Draw text */
-        if ($this->mStyle & BCS_DRAW_TEXT) {
-            if ($this->mStyle & BCS_STRETCH_TEXT) {
-                for ($i=0;$i<$len;$i++) {
-                    $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
-                    $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
-                }
-            } else {/* Center */
-            $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
-            $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
-            $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
-            }
-        }
-
-        $cPos = 0;
-        $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        do {
-            $c     = $this->GetCharIndex($this->mValue[$cPos]);
-            $cset  = $this->mCharSet[$c];
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[0], $xres);
-            $DrawPos += $this->GetBarSize($cset[1], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[2], $xres);
-            $DrawPos += $this->GetBarSize($cset[3], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[4], $xres);
-            $DrawPos += $this->GetBarSize($cset[5], $xres);
-            $cPos++;
-        } while ($cPos<$len);
-        $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        $DrawPos =  $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        return true;
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/barcode/c128bobject.php b/lib/tcpdf/barcode/c128bobject.php
deleted file mode 100755 (executable)
index f3d5540..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-<?php
-//============================================================+
-// File name   : c128bobject.php
-// Begin       : 2002-07-31
-// Last Update : 2004-12-29
-// Author      : Karim Mribti [barcode@mribti.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Code 128-B Barcode Render Class for PHP using
-//               the GD graphics library.
-//               Code 128-B is a continuous, multilevel and full
-//               ASCII code.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
-* Code 128-B Barcode Render Class for PHP using the GD graphics library.<br>
-* Code 128-B is a continuous, multilevel and full ASCII code.
-* @author Karim Mribti, Nicola Asuni
-* @name BarcodeObject
-* @package com.tecnick.tcpdf
-* @version 0.0.8a  2001-04-01 (original code)
-* @since 2001-03-25
-* @license http://www.gnu.org/copyleft/lesser.html LGPL
-*/
-
-/**
-* Code 128-B Barcode Render Class for PHP using the GD graphics library.<br>
-* Code 128-B is a continuous, multilevel and full ASCII code.
-* @author Karim Mribti, Nicola Asuni
-* @name BarcodeObject
-* @package com.tecnick.tcpdf
-* @version 0.0.8a  2001-04-01 (original code)
-* @since 2001-03-25
-* @license http://www.gnu.org/copyleft/lesser.html LGPL
-*/
-class C128BObject extends BarcodeObject {
-    
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     * @param int $Value value to print on barcode.
-     */
-    function C128BObject($Width, $Height, $Style, $Value) {
-        $this->BarcodeObject($Width, $Height, $Style);
-        $this->mValue = $Value;
-        $this->mChars = " !\"#$%&'()*+�-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{ }~";
-        $this->mCharSet = array (
-        "212222",   /*   00 */
-        "222122",   /*   01 */
-        "222221",   /*   02 */
-        "121223",   /*   03 */
-        "121322",   /*   04 */
-        "131222",   /*   05 */
-        "122213",   /*   06 */
-        "122312",   /*   07 */
-        "132212",   /*   08 */
-        "221213",   /*   09 */
-        "221312",   /*   10 */
-        "231212",   /*   11 */
-        "112232",   /*   12 */
-        "122132",   /*   13 */
-        "122231",   /*   14 */
-        "113222",   /*   15 */
-        "123122",   /*   16 */
-        "123221",   /*   17 */
-        "223211",   /*   18 */
-        "221132",   /*   19 */
-        "221231",   /*   20 */
-        "213212",   /*   21 */
-        "223112",   /*   22 */
-        "312131",   /*   23 */
-        "311222",   /*   24 */
-        "321122",   /*   25 */
-        "321221",   /*   26 */
-        "312212",   /*   27 */
-        "322112",   /*   28 */
-        "322211",   /*   29 */
-        "212123",   /*   30 */
-        "212321",   /*   31 */
-        "232121",   /*   32 */
-        "111323",   /*   33 */
-        "131123",   /*   34 */
-        "131321",   /*   35 */
-        "112313",   /*   36 */
-        "132113",   /*   37 */
-        "132311",   /*   38 */
-        "211313",   /*   39 */
-        "231113",   /*   40 */
-        "231311",   /*   41 */
-        "112133",   /*   42 */
-        "112331",   /*   43 */
-        "132131",   /*   44 */
-        "113123",   /*   45 */
-        "113321",   /*   46 */
-        "133121",   /*   47 */
-        "313121",   /*   48 */
-        "211331",   /*   49 */
-        "231131",   /*   50 */
-        "213113",   /*   51 */
-        "213311",   /*   52 */
-        "213131",   /*   53 */
-        "311123",   /*   54 */
-        "311321",   /*   55 */
-        "331121",   /*   56 */
-        "312113",   /*   57 */
-        "312311",   /*   58 */
-        "332111",   /*   59 */
-        "314111",   /*   60 */
-        "221411",   /*   61 */
-        "431111",   /*   62 */
-        "111224",   /*   63 */
-        "111422",   /*   64 */
-        "121124",   /*   65 */
-        "121421",   /*   66 */
-        "141122",   /*   67 */
-        "141221",   /*   68 */
-        "112214",   /*   69 */
-        "112412",   /*   70 */
-        "122114",   /*   71 */
-        "122411",   /*   72 */
-        "142112",   /*   73 */
-        "142211",   /*   74 */
-        "241211",   /*   75 */
-        "221114",   /*   76 */
-        "413111",   /*   77 */
-        "241112",   /*   78 */
-        "134111",   /*   79 */
-        "111242",   /*   80 */
-        "121142",   /*   81 */
-        "121241",   /*   82 */
-        "114212",   /*   83 */
-        "124112",   /*   84 */
-        "124211",   /*   85 */
-        "411212",   /*   86 */
-        "421112",   /*   87 */
-        "421211",   /*   88 */
-        "212141",   /*   89 */
-        "214121",   /*   90 */
-        "412121",   /*   91 */
-        "111143",   /*   92 */
-        "111341",   /*   93 */
-        "131141",   /*   94 */
-        "114113",   /*   95 */
-        "114311",   /*   96 */
-        "411113",   /*   97 */
-        "411311",   /*   98 */
-        "113141",   /*   99 */
-        "114131",   /*  100 */
-        "311141",   /*  101 */
-        "411131"    /*  102 */
-        );
-    }
-
-    /**
-     * Returns the character index.
-     * @param char $char character.
-     * @return int character index or -1 in case of error.
-     * @access private
-     */
-    function GetCharIndex($char) {
-        for ($i=0;$i<95;$i++) {
-            if ($this->mChars[$i] == $char) {
-                return $i;
-            }
-        }
-        return -1;
-    }
-    
-    /**
-     * Returns the bar size.
-     * @param int $xres Horizontal resolution.
-     * @param char $char Character.
-     * @return int barcode size.
-     * @access private
-     */
-    function GetBarSize($xres, $char) {
-        switch ($char) {
-            case '1': {
-                $cVal = BCD_C128_BAR_1;
-                break;
-            }
-            case '2': {
-                $cVal = BCD_C128_BAR_2;
-                break;
-            }
-            case '3': {
-                $cVal = BCD_C128_BAR_3;
-                break;
-            }
-            case '4': {
-                $cVal = BCD_C128_BAR_4;
-                break;
-            }
-            default: {
-                $cVal = 0;
-            }
-        }
-        return  $cVal * $xres;
-    }
-    
-    /**
-     * Returns barcode size.
-     * @param int $xres Horizontal resolution.
-     * @return barcode size.
-     * @access private
-     */
-    function GetSize($xres) {
-        $len = strlen($this->mValue);
-
-        if ($len == 0)  {
-            $this->mError = "Null value";
-            return false;
-        }
-        $ret = 0;
-        for ($i=0;$i<$len;$i++) {
-            if (($id = $this->GetCharIndex($this->mValue[$i])) == -1) {
-                $this->mError = "C128B not include the char '".$this->mValue[$i]."'";
-                return false;
-            } else {
-                $cset = $this->mCharSet[$id];
-                $ret += $this->GetBarSize($xres, $cset[0]);
-                $ret += $this->GetBarSize($xres, $cset[1]);
-                $ret += $this->GetBarSize($xres, $cset[2]);
-                $ret += $this->GetBarSize($xres, $cset[3]);
-                $ret += $this->GetBarSize($xres, $cset[4]);
-                $ret += $this->GetBarSize($xres, $cset[5]);
-            }
-        }
-        /* length of Check character */
-        $cset = $this->GetCheckCharValue();
-        $CheckSize = 0;
-        for ($i=0;$i<6;$i++) {
-            $CheckSize += $this->GetBarSize($cset[$i], $xres);
-        }
-
-        $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
-        $StopSize  = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
-
-        return $StartSize + $ret + $CheckSize + $StopSize;
-    }
-    
-    /**
-     * Returns the check-char value.
-     * @return string.
-     * @access private
-     */
-    function GetCheckCharValue() {
-        $len = strlen($this->mValue);
-        $sum = 104; // 'B' type;
-        for ($i=0;$i<$len;$i++) {
-            $sum += $this->GetCharIndex($this->mValue[$i]) * ($i+1);
-        }
-        $check  = $sum % 103;
-        return $this->mCharSet[$check];
-    }
-
-    /**
-     * Draws the start code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStart($DrawPos, $yPos, $ySize, $xres) {
-        /* Start code is '211214' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres), $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres), $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('4', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the stop code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStop($DrawPos, $yPos, $ySize, $xres) {
-        /* Stop code is '2331112' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the check-char code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
-        $cset = $this->GetCheckCharValue();
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[0], $xres);
-        $DrawPos += $this->GetBarSize($cset[1], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[2], $xres);
-        $DrawPos += $this->GetBarSize($cset[3], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[4], $xres);
-        $DrawPos += $this->GetBarSize($cset[5], $xres);
-        return $DrawPos;
-    }
-
-    /**
-     * Draws the barcode object.
-     * @param int $xres Horizontal resolution.
-     * @return bool true in case of success.
-     */
-    function DrawObject($xres) {
-        $len = strlen($this->mValue);
-        if (($size = $this->GetSize($xres))==0) {
-            return false;
-        }
-
-        if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
-        else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
-        else $sPos = 0;
-
-        /* Total height of bar code -Bars only- */
-        if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
-        else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
-
-        /* Draw text */
-        if ($this->mStyle & BCS_DRAW_TEXT) {
-            if ($this->mStyle & BCS_STRETCH_TEXT) {
-                for ($i=0;$i<$len;$i++) {
-                    $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
-                    $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
-                }
-            } else {/* Center */
-            $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
-            $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
-            $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
-            }
-        }
-
-        $cPos = 0;
-        $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        do {
-            $c     = $this->GetCharIndex($this->mValue[$cPos]);
-            $cset  = $this->mCharSet[$c];
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[0], $xres);
-            $DrawPos += $this->GetBarSize($cset[1], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[2], $xres);
-            $DrawPos += $this->GetBarSize($cset[3], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[4], $xres);
-            $DrawPos += $this->GetBarSize($cset[5], $xres);
-            $cPos++;
-        } while ($cPos<$len);
-        $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        $DrawPos =  $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        return true;
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/barcode/c128cobject.php b/lib/tcpdf/barcode/c128cobject.php
deleted file mode 100755 (executable)
index cb4923c..0000000
+++ /dev/null
@@ -1,419 +0,0 @@
-<?php
-//============================================================+
-// File name   : c128cobject.php
-// Begin       : 2002-07-31
-// Last Update : 2004-12-29
-// Author      : Karim Mribti [barcode@mribti.com]
-//             : Sam Michaels [swampgas@swampgas.org]
-//             : Nicola Asuni [info@tecnick.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Code 128-C Barcode Render Class for PHP using
-//               the GD graphics library.
-//               Code 128-C is numeric only and provides the
-//               most efficiency.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
- * Code 128-C Barcode Render Class for PHP using the GD graphics library.<br>
- * Code 128-C is numeric only and provides the most efficiency.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Code 128-C Barcode Render Class for PHP using the GD graphics library.<br>
- * Code 128-C is numeric only and provides the most efficiency.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-class C128CObject extends BarcodeObject {
-    
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     * @param int $Value value to print on barcode.
-     */
-    function C128CObject($Width, $Height, $Style, $Value) {
-        $this->BarcodeObject($Width, $Height, $Style);
-        $this->mValue = $Value;
-        $this->mChars = array (
-        "00", "01", "02", "03", "04", "05", "06", "07", "08", "09",
-        "10", "11", "12", "13", "14", "15", "16", "17", "18", "19",
-        "20", "21", "22", "23", "24", "25", "26", "27", "28", "29",
-        "30", "31", "32", "33", "34", "35", "36", "37", "38", "39",
-        "40", "41", "42", "43", "44", "45", "46", "47", "48", "49",
-        "50", "51", "52", "53", "54", "55", "56", "57", "58", "59",
-        "60", "61", "62", "63", "64", "65", "66", "67", "68", "69",
-        "70", "71", "72", "73", "74", "75", "76", "77", "78", "79",
-        "80", "81", "82", "83", "84", "85", "86", "87", "88", "89",
-        "90", "91", "92", "93", "94", "95", "96", "97", "98", "99",
-        );
-        $this->mCharSet = array (
-        "212222",   /*   00 */
-        "222122",   /*   01 */
-        "222221",   /*   02 */
-        "121223",   /*   03 */
-        "121322",   /*   04 */
-        "131222",   /*   05 */
-        "122213",   /*   06 */
-        "122312",   /*   07 */
-        "132212",   /*   08 */
-        "221213",   /*   09 */
-        "221312",   /*   10 */
-        "231212",   /*   11 */
-        "112232",   /*   12 */
-        "122132",   /*   13 */
-        "122231",   /*   14 */
-        "113222",   /*   15 */
-        "123122",   /*   16 */
-        "123221",   /*   17 */
-        "223211",   /*   18 */
-        "221132",   /*   19 */
-        "221231",   /*   20 */
-        "213212",   /*   21 */
-        "223112",   /*   22 */
-        "312131",   /*   23 */
-        "311222",   /*   24 */
-        "321122",   /*   25 */
-        "321221",   /*   26 */
-        "312212",   /*   27 */
-        "322112",   /*   28 */
-        "322211",   /*   29 */
-        "212123",   /*   30 */
-        "212321",   /*   31 */
-        "232121",   /*   32 */
-        "111323",   /*   33 */
-        "131123",   /*   34 */
-        "131321",   /*   35 */
-        "112313",   /*   36 */
-        "132113",   /*   37 */
-        "132311",   /*   38 */
-        "211313",   /*   39 */
-        "231113",   /*   40 */
-        "231311",   /*   41 */
-        "112133",   /*   42 */
-        "112331",   /*   43 */
-        "132131",   /*   44 */
-        "113123",   /*   45 */
-        "113321",   /*   46 */
-        "133121",   /*   47 */
-        "313121",   /*   48 */
-        "211331",   /*   49 */
-        "231131",   /*   50 */
-        "213113",   /*   51 */
-        "213311",   /*   52 */
-        "213131",   /*   53 */
-        "311123",   /*   54 */
-        "311321",   /*   55 */
-        "331121",   /*   56 */
-        "312113",   /*   57 */
-        "312311",   /*   58 */
-        "332111",   /*   59 */
-        "314111",   /*   60 */
-        "221411",   /*   61 */
-        "431111",   /*   62 */
-        "111224",   /*   63 */
-        "111422",   /*   64 */
-        "121124",   /*   65 */
-        "121421",   /*   66 */
-        "141122",   /*   67 */
-        "141221",   /*   68 */
-        "112214",   /*   69 */
-        "112412",   /*   70 */
-        "122114",   /*   71 */
-        "122411",   /*   72 */
-        "142112",   /*   73 */
-        "142211",   /*   74 */
-        "241211",   /*   75 */
-        "221114",   /*   76 */
-        "413111",   /*   77 */
-        "241112",   /*   78 */
-        "134111",   /*   79 */
-        "111242",   /*   80 */
-        "121142",   /*   81 */
-        "121241",   /*   82 */
-        "114212",   /*   83 */
-        "124112",   /*   84 */
-        "124211",   /*   85 */
-        "411212",   /*   86 */
-        "421112",   /*   87 */
-        "421211",   /*   88 */
-        "212141",   /*   89 */
-        "214121",   /*   90 */
-        "412121",   /*   91 */
-        "111143",   /*   92 */
-        "111341",   /*   93 */
-        "131141",   /*   94 */
-        "114113",   /*   95 */
-        "114311",   /*   96 */
-        "411113",   /*   97 */
-        "411311",   /*   98 */
-        "113141",   /*   99 */
-        );
-    }
-
-    /**
-     * Returns the character index.
-     * @param char $char character.
-     * @return int character index or -1 in case of error.
-     * @access private
-     */
-    function GetCharIndex($char) {
-        for ($i=0;$i<100;$i++) {
-            if ($this->mChars[$i] == $char) {
-                return $i;
-            }
-        }
-        return -1;
-    }
-    
-    /**
-     * Returns the bar size.
-     * @param int $xres Horizontal resolution.
-     * @param char $char Character.
-     * @return int barcode size.
-     * @access private
-     */
-    function GetBarSize($xres, $char) {
-        switch ($char) {
-            case '1': {
-                $cVal = BCD_C128_BAR_1;
-                break;
-            }
-            case '2': {
-                $cVal = BCD_C128_BAR_2;
-                break;
-            }
-            case '3': {
-                $cVal = BCD_C128_BAR_3;
-                break;
-            }
-            case '4': {
-                $cVal = BCD_C128_BAR_4;
-                break;
-            }
-            default: {
-                $cVal = 0;
-            }
-        }
-        return  $cVal * $xres;
-    }
-
-    /**
-     * Returns barcode size.
-     * @param int $xres Horizontal resolution.
-     * @return barcode size.
-     * @access private
-     */
-    function GetSize($xres) {
-        $len = strlen($this->mValue);
-
-        if ($len == 0)  {
-            $this->mError = "Null value";
-            return false;
-        }
-        $ret = 0;
-
-        for ($i=0;$i<$len;$i++) {
-            if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) {
-                $this->mError = "Code-128C is numeric only";
-                return false;
-            }
-        }
-
-        if (($len%2) != 0) {
-            $this->mError = "The length of barcode value must be even.  You must pad the number with zeros.";
-            return false;
-        }
-
-        for ($i=0;$i<$len;$i+=2) {
-            $id = $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]);
-            $cset = $this->mCharSet[$id];
-            $ret += $this->GetBarSize($xres, $cset[0]);
-            $ret += $this->GetBarSize($xres, $cset[1]);
-            $ret += $this->GetBarSize($xres, $cset[2]);
-            $ret += $this->GetBarSize($xres, $cset[3]);
-            $ret += $this->GetBarSize($xres, $cset[4]);
-            $ret += $this->GetBarSize($xres, $cset[5]);
-        }
-        /* length of Check character */
-        $cset = $this->GetCheckCharValue();
-        $CheckSize = 0;
-        for ($i=0;$i<6;$i++) {
-            $CheckSize += $this->GetBarSize($cset[$i], $xres);
-        }
-
-        $StartSize = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres;
-        $StopSize  = 2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + 2*BCD_C128_BAR_3*$xres;
-        return $StartSize + $ret + $CheckSize + $StopSize;
-    }
-    
-    /**
-     * Returns the check-char value.
-     * @return string.
-     * @access private
-     */
-    function GetCheckCharValue() {
-        $len = strlen($this->mValue);
-        $sum = 105; // 'C' type;
-        $m = 0;
-        for ($i=0;$i<$len;$i+=2) {
-            $m++;
-            $sum +=  $this->GetCharIndex($this->mValue[$i].$this->mValue[$i+1]) * $m;
-        }
-        $check  = $sum % 103;
-        return $this->mCharSet[$check];
-    }
-
-    /**
-     * Draws the start code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStart($DrawPos, $yPos, $ySize, $xres) {
-        /* Start code is '211232' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the stop code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStop($DrawPos, $yPos, $ySize, $xres) {
-        /* Stop code is '2331112' */
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('3', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('3', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('1', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $DrawPos += $this->GetBarSize('1', $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize('2', $xres) , $ySize);
-        $DrawPos += $this->GetBarSize('2', $xres);
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the check-char code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawCheckChar($DrawPos, $yPos, $ySize, $xres) {
-        $cset = $this->GetCheckCharValue();
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[0], $xres);
-        $DrawPos += $this->GetBarSize($cset[1], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[2], $xres);
-        $DrawPos += $this->GetBarSize($cset[3], $xres);
-        $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ySize);
-        $DrawPos += $this->GetBarSize($cset[4], $xres);
-        $DrawPos += $this->GetBarSize($cset[5], $xres);
-        return $DrawPos;
-    }
-
-    /**
-     * Draws the barcode object.
-     * @param int $xres Horizontal resolution.
-     * @return bool true in case of success.
-     */
-    function DrawObject($xres) {
-        $len = strlen($this->mValue);
-        if (($size = $this->GetSize($xres))==0) {
-            return false;
-        }
-
-        if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
-        else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
-        else $sPos = 0;
-
-        /* Total height of bar code -Bars only- */
-        if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
-        else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
-
-        /* Draw text */
-        if ($this->mStyle & BCS_DRAW_TEXT) {
-            if ($this->mStyle & BCS_STRETCH_TEXT) {
-                for ($i=0;$i<$len;$i++) {
-                    $this->DrawChar($this->mFont, $sPos+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres)+($size/$len)*$i,
-                    $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
-                }
-            } else {/* Center */
-            $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
-            $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(2*BCD_C128_BAR_2*$xres + 3*BCD_C128_BAR_1*$xres + BCD_C128_BAR_4*$xres),
-            $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
-            }
-        }
-
-        $cPos = 0;
-        $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        do {
-            $c     = $this->GetCharIndex($this->mValue[$cPos].$this->mValue[$cPos+1]);
-            $cset  = $this->mCharSet[$c];
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[0], $xres);
-            $DrawPos += $this->GetBarSize($cset[1], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[2], $xres);
-            $DrawPos += $this->GetBarSize($cset[3], $xres);
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres) , $ysize);
-            $DrawPos += $this->GetBarSize($cset[4], $xres);
-            $DrawPos += $this->GetBarSize($cset[5], $xres);
-            $cPos += 2;
-        } while ($cPos<$len);
-        $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        $DrawPos =  $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        return true;
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
diff --git a/lib/tcpdf/barcode/c39object.php b/lib/tcpdf/barcode/c39object.php
deleted file mode 100755 (executable)
index bb253cb..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-<?php
-//============================================================+
-// File name   : c39object.php
-// Begin       : 2002-07-31
-// Last Update : 2004-12-29
-// Author      : Karim Mribti [barcode@mribti.com]
-//             : Nicola Asuni [info@tecnick.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Code 39 Barcode Render Class for PHP using
-//               the GD graphics library.
-//               Code 39 is an alphanumeric bar code that can
-//               encode decimal number, case alphabet and some
-//               special symbols.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
- * Code 39 Barcode Render Class.<br>
- * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * Code 39 Barcode Render Class.<br>
- * Code 39 is an alphanumeric bar code that can encode decimal number, case alphabet and some special symbols.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-class C39Object extends BarcodeObject {
-    
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     * @param int $Value value to print on barcode.
-     */
-    function C39Object($Width, $Height, $Style, $Value) {
-        $this->BarcodeObject($Width, $Height, $Style);
-        $this->mValue = $Value;
-        $this->mChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
-        $this->mCharSet = array (
-        /* 0  */ "000110100",
-        /* 1  */ "100100001",
-        /* 2  */ "001100001",
-        /* 3  */ "101100000",
-        /* 4  */ "000110001",
-        /* 5  */ "100110000",
-        /* 6  */ "001110000",
-        /* 7  */ "000100101",
-        /* 8  */ "100100100",
-        /* 9  */ "001100100",
-        /* A  */ "100001001",
-        /* B  */ "001001001",
-        /* C  */ "101001000",
-        /* D  */ "000011001",
-        /* E  */ "100011000",
-        /* F  */ "001011000",
-        /* G  */ "000001101",
-        /* H  */ "100001100",
-        /* I  */ "001001100",
-        /* J  */ "000011100",
-        /* K  */ "100000011",
-        /* L  */ "001000011",
-        /* M  */ "101000010",
-        /* N  */ "000010011",
-        /* O  */ "100010010",
-        /* P  */ "001010010",
-        /* Q  */ "000000111",
-        /* R  */ "100000110",
-        /* S  */ "001000110",
-        /* T  */ "000010110",
-        /* U  */ "110000001",
-        /* V  */ "011000001",
-        /* W  */ "111000000",
-        /* X  */ "010010001",
-        /* Y  */ "110010000",
-        /* Z  */ "011010000",
-        /* -  */ "010000101",
-        /* .  */ "110000100",
-        /* SP */ "011000100",
-        /* *  */ "010010100",
-        /* $  */ "010101000",
-        /* /  */ "010100010",
-        /* +  */ "010001010",
-        /* %  */ "000101010"
-        );
-    }
-
-    /**
-     * Returns the character index.
-     * @param char $char character.
-     * @return int character index or -1 in case of error.
-     * @access private
-     */
-    function GetCharIndex($char) {
-        for ($i=0;$i<44;$i++) {
-            if ($this->mChars[$i] == $char) {
-                return $i;
-            }
-        }
-        return -1;
-    }
-    
-    /**
-     * Returns barcode size.
-     * @param int $xres Horizontal resolution.
-     * @return barcode size.
-     * @access private
-     */
-    function GetSize($xres) {
-        $len = strlen($this->mValue);
-
-        if ($len == 0)  {
-            $this->mError = "Null value";
-            return false;
-        }
-
-        for ($i=0;$i<$len;$i++) {
-            if ($this->GetCharIndex($this->mValue[$i]) == -1 || $this->mValue[$i] == '*') {
-                /* The asterisk is only used as a start and stop code */
-                $this->mError = "C39 not include the char '".$this->mValue[$i]."'";
-                return false;
-            }
-        }
-
-        /* Start, Stop is 010010100 == '*'  */
-        $StartSize = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3;
-        $StopSize  = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3;
-        $CharSize  = BCD_C39_NARROW_BAR * $xres * 6 + BCD_C39_WIDE_BAR * $xres * 3; /* Same for all chars */
-
-        return $CharSize * $len + $StartSize + $StopSize + /* Space between chars */ BCD_C39_NARROW_BAR * $xres * ($len-1);
-    }
-
-    /**
-     * Draws the start code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStart($DrawPos, $yPos, $ySize, $xres) {
-        /* Start code is '*' */
-        $narrow = BCD_C39_NARROW_BAR * $xres;
-        $wide   = BCD_C39_WIDE_BAR * $xres;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
-        $DrawPos += $narrow;
-        $DrawPos += $wide;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
-        $DrawPos += $narrow;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
-        $DrawPos += $wide;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
-        $DrawPos += $wide;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize);
-        $DrawPos += $narrow;
-        $DrawPos += $narrow; /* Space between chars */
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the stop code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStop($DrawPos, $yPos, $ySize, $xres) {
-        /* Stop code is '*' */
-        $narrow = BCD_C39_NARROW_BAR * $xres;
-        $wide   = BCD_C39_WIDE_BAR * $xres;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
-        $DrawPos += $narrow;
-        $DrawPos += $wide;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow , $ySize);
-        $DrawPos += $narrow;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
-        $DrawPos += $wide;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $wide , $ySize);
-        $DrawPos += $wide;
-        $DrawPos += $narrow;
-        $this->DrawSingleBar($DrawPos, $yPos, $narrow, $ySize);
-        $DrawPos += $narrow;
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the barcode object.
-     * @param int $xres Horizontal resolution.
-     * @return bool true in case of success.
-     */
-    function DrawObject($xres) {
-        $len = strlen($this->mValue);
-
-        $narrow = BCD_C39_NARROW_BAR * $xres;
-        $wide   = BCD_C39_WIDE_BAR * $xres;
-
-        if (($size = $this->GetSize($xres))==0) {
-            return false;
-        }
-
-        $cPos = 0;
-        if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
-        else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
-        else $sPos = 0;
-
-        /* Total height of bar code -Bars only- */
-        if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
-        else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
-
-        /* Draw text */
-        if ($this->mStyle & BCS_DRAW_TEXT) {
-            if ($this->mStyle & BCS_STRETCH_TEXT) {
-                for ($i=0;$i<$len;$i++) {
-                    $this->DrawChar($this->mFont, $sPos+($narrow*6+$wide*3)+($size/$len)*$i,
-                    $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
-                }
-            } else {/* Center */
-            $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
-            $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+($narrow*6+$wide*3),
-            $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
-            }
-        }
-
-        $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        do {
-            $c     = $this->GetCharIndex($this->mValue[$cPos]);
-            $cset  = $this->mCharSet[$c];
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[0] == '0') ? $narrow : $wide , $ysize);
-            $DrawPos += ($cset[0] == '0') ? $narrow : $wide;
-            $DrawPos += ($cset[1] == '0') ? $narrow : $wide;
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[2] == '0') ? $narrow : $wide , $ysize);
-            $DrawPos += ($cset[2] == '0') ? $narrow : $wide;
-            $DrawPos += ($cset[3] == '0') ? $narrow : $wide;
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[4] == '0') ? $narrow : $wide , $ysize);
-            $DrawPos += ($cset[4] == '0') ? $narrow : $wide;
-            $DrawPos += ($cset[5] == '0') ? $narrow : $wide;
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[6] == '0') ? $narrow : $wide , $ysize);
-            $DrawPos += ($cset[6] == '0') ? $narrow : $wide;
-            $DrawPos += ($cset[7] == '0') ? $narrow : $wide;
-            $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, ($cset[8] == '0') ? $narrow : $wide , $ysize);
-            $DrawPos += ($cset[8] == '0') ? $narrow : $wide;
-            $DrawPos += $narrow; /* Space between chars */
-            $cPos++;
-        } while ($cPos<$len);
-        $DrawPos =  $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1 , $ysize, $xres);
-        return true;
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/barcode/i25object.php b/lib/tcpdf/barcode/i25object.php
deleted file mode 100755 (executable)
index 3e58959..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-<?php
-//============================================================+
-// File name   : i25aobject.php
-// Begin       : 2002-07-31
-// Last Update : 2004-12-29
-// Author      : Karim Mribti [barcode@mribti.com]
-//             : Nicola Asuni [info@tecnick.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : I25 Barcode Render Class for PHP using
-//               the GD graphics library.
-//               Interleaved 2 of 5 is a numeric only bar code
-//               with a optional check number.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP4
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
- * I25 Barcode Render Class for PHP using the GD graphics library.<br<
- * Interleaved 2 of 5 is a numeric only bar code with a optional check number.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * I25 Barcode Render Class for PHP using the GD graphics library.<br<
- * Interleaved 2 of 5 is a numeric only bar code with a optional check number.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-class I25Object extends BarcodeObject {
-    
-    /**
-     * Class Constructor.
-     * @param int $Width Image width in pixels.
-     * @param int $Height Image height in pixels. 
-     * @param int $Style Barcode style.
-     * @param int $Value value to print on barcode.
-     */
-    function I25Object($Width, $Height, $Style, $Value) {
-        $this->BarcodeObject($Width, $Height, $Style);
-        $this->mValue = $Value;
-        $this->mCharSet = array (
-        /* 0 */ "00110",
-        /* 1 */ "10001",
-        /* 2 */ "01001",
-        /* 3 */ "11000",
-        /* 4 */ "00101",
-        /* 5 */ "10100",
-        /* 6 */ "01100",
-        /* 7 */ "00011",
-        /* 8 */ "10010",
-        /* 9 */ "01010"
-        );
-    }
-    
-    /**
-     * Returns barcode size.
-     * @param int $xres Horizontal resolution.
-     * @return barcode size.
-     * @access private
-     */
-    function GetSize($xres) {
-        $len = strlen($this->mValue);
-
-        if ($len == 0)  {
-            $this->mError = "Null value";
-            return false;
-        }
-
-        for ($i=0;$i<$len;$i++) {
-            if ((ord($this->mValue[$i])<48) || (ord($this->mValue[$i])>57)) {
-                $this->mError = "I25 is numeric only";
-                return false;
-            }
-        }
-
-        if (($len%2) != 0) {
-            $this->mError = "The length of barcode value must be even";
-            return false;
-        }
-        $StartSize = BCD_I25_NARROW_BAR * 4  * $xres;
-        $StopSize  = BCD_I25_WIDE_BAR * $xres + 2 * BCD_I25_NARROW_BAR * $xres;
-        $cPos = 0;
-        $sPos = 0;
-        do {
-            $c1    = $this->mValue[$cPos];
-            $c2    = $this->mValue[$cPos+1];
-            $cset1 = $this->mCharSet[$c1];
-            $cset2 = $this->mCharSet[$c2];
-
-            for ($i=0;$i<5;$i++) {
-                $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR  * $xres) : (BCD_I25_WIDE_BAR * $xres);
-                $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR  * $xres) : (BCD_I25_WIDE_BAR * $xres);
-                $sPos += ($type1 + $type2);
-            }
-            $cPos+=2;
-        } while ($cPos<$len);
-
-        return $sPos + $StartSize + $StopSize;
-    }
-
-    /**
-     * Draws the start code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStart($DrawPos, $yPos, $ySize, $xres) {
-        /* Start code is "0000" */
-        $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR  * $xres , $ySize);
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR  * $xres , $ySize);
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        return $DrawPos;
-    }
-    
-    /**
-     * Draws the stop code.
-     * @param int $DrawPos Drawing position.
-     * @param int $yPos Vertical position.
-     * @param int $ySize Vertical size.
-     * @param int $xres Horizontal resolution.
-     * @return int drawing position.
-     * @access private
-     */
-    function DrawStop($DrawPos, $yPos, $ySize, $xres) {
-        /* Stop code is "100" */
-        $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_WIDE_BAR * $xres , $ySize);
-        $DrawPos += BCD_I25_WIDE_BAR  * $xres;
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        $this->DrawSingleBar($DrawPos, $yPos, BCD_I25_NARROW_BAR  * $xres , $ySize);
-        $DrawPos += BCD_I25_NARROW_BAR  * $xres;
-        return $DrawPos;
-    }
-
-    /**
-     * Draws the barcode object.
-     * @param int $xres Horizontal resolution.
-     * @return bool true in case of success.
-     */
-    function DrawObject($xres) {
-        $len = strlen($this->mValue);
-
-        if (($size = $this->GetSize($xres))==0) {
-            return false;
-        }
-
-        $cPos  = 0;
-
-        if ($this->mStyle & BCS_DRAW_TEXT) $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
-        else $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
-
-        if ($this->mStyle & BCS_ALIGN_CENTER) $sPos = (integer)(($this->mWidth - $size ) / 2);
-        else if ($this->mStyle & BCS_ALIGN_RIGHT) $sPos = $this->mWidth - $size;
-        else $sPos = 0;
-
-        if ($this->mStyle & BCS_DRAW_TEXT) {
-            if ($this->mStyle & BCS_STRETCH_TEXT) {
-                /* Stretch */
-                for ($i=0;$i<$len;$i++) {
-                    $this->DrawChar($this->mFont, $sPos+BCD_I25_NARROW_BAR*4*$xres+($size/$len)*$i,
-                    $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET , $this->mValue[$i]);
-                }
-            }else {/* Center */
-            $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
-            $this->DrawText($this->mFont, $sPos+(($size-$text_width)/2)+(BCD_I25_NARROW_BAR*4*$xres),
-            $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
-            }
-        }
-
-        $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
-        do {
-            $c1 = $this->mValue[$cPos];
-            $c2 = $this->mValue[$cPos+1];
-            $cset1 = $this->mCharSet[$c1];
-            $cset2 = $this->mCharSet[$c2];
-
-            for ($i=0;$i<5;$i++) {
-                $type1 = ($cset1[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
-                $type2 = ($cset2[$i]==0) ? (BCD_I25_NARROW_BAR * $xres) : (BCD_I25_WIDE_BAR * $xres);
-                $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1 , $ysize);
-                $sPos += ($type1 + $type2);
-            }
-            $cPos+=2;
-        } while ($cPos<$len);
-        $sPos =  $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
-        return true;
-    }
-}
-
-//============================================================+
-// END OF FILE
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/barcode/image.php b/lib/tcpdf/barcode/image.php
deleted file mode 100755 (executable)
index 056eace..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-//============================================================+
-// File name   : image.php
-// Begin       : 2002-07-31
-// Last Update : 2005-01-08
-// Author      : Karim Mribti [barcode@mribti.com]
-//             : Nicola Asuni [info@tecnick.com]
-// Version     : 0.0.8a  2001-04-01 (original code)
-// License     : GNU LGPL (Lesser General Public License) 2.1
-//               http://www.gnu.org/copyleft/lesser.txt
-// Source Code : http://www.mribti.com/barcode/
-//
-// Description : Barcode Image Rendering.
-//
-// NOTE:
-// This version contains changes by Nicola Asuni:
-//  - porting to PHP5
-//  - code style and formatting
-//  - automatic php documentation in PhpDocumentor Style
-//    (www.phpdoc.org)
-//  - minor bug fixing
-//============================================================+
-
-/**
- * Barcode Image Rendering.
- * @author Karim Mribti, Nicola Asuni
- * @name BarcodeObject
- * @package com.tecnick.tcpdf
- * @version 0.0.8a  2001-04-01 (original code)
- * @since 2001-03-25
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
-
-/**
- * 
- */
-
-require("../../shared/barcode/barcode.php");
-require("../../shared/barcode/i25object.php");
-require("../../shared/barcode/c39object.php");
-require("../../shared/barcode/c128aobject.php");
-require("../../shared/barcode/c128bobject.php");
-require("../../shared/barcode/c128cobject.php");
-
-if (!isset($_REQUEST['style'])) $_REQUEST['style'] = BCD_DEFAULT_STYLE;
-if (!isset($_REQUEST['width'])) $_REQUEST['width'] = BCD_DEFAULT_WIDTH;
-if (!isset($_REQUEST['height'])) $_REQUEST['height'] = BCD_DEFAULT_HEIGHT;
-if (!isset($_REQUEST['xres'])) $_REQUEST['xres'] = BCD_DEFAULT_XRES;
-if (!isset($_REQUEST['font'])) $_REQUEST['font'] = BCD_DEFAULT_FONT;
-if (!isset($_REQUEST['type'])) $_REQUEST['type'] = "C39";
-if (!isset($_REQUEST['code'])) $_REQUEST['code'] = "";
-
-switch (strtoupper($_REQUEST['type'])) {
-    case "I25": {
-        $obj = new I25Object($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
-        break;
-    }
-    case "C128A": {
-        $obj = new C128AObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
-        break;
-    }
-    case "C128B": {
-        $obj = new C128BObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
-        break;
-    }
-    case "C128C": {
-        $obj = new C128CObject($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
-        break;
-    }
-    case "C39":
-    default: {
-        $obj = new C39Object($_REQUEST['width'], $_REQUEST['height'], $_REQUEST['style'], $_REQUEST['code']);
-        break;
-    }
-}
-
-if ($obj) {
-    $obj->SetFont($_REQUEST['font']);   
-    $obj->DrawObject($_REQUEST['xres']);
-    $obj->FlushObject();
-    $obj->DestroyObject();
-    unset($obj);  /* clean */
-}
-
-//============================================================+
-// END OF FILE                                                 
-//============================================================+
-?>
\ No newline at end of file
diff --git a/lib/tcpdf/html2pdf.php b/lib/tcpdf/html2pdf.php
new file mode 100644 (file)
index 0000000..acfecb1
--- /dev/null
@@ -0,0 +1,195 @@
+<?php
+//HTML2PDF by Clément Lavoillotte
+//ac.lavoillotte@noos.fr
+//webmaster@streetpc.tk
+//http://www.streetpc.tk
+
+define('TCPDF_FONTPATH','fonts/');
+require('tcpdf.php');
+
+//function hex2dec
+//returns an associative array (keys: R,G,B) from
+//a hex html code (e.g. #3FE5AA)
+function hex2dec($couleur = "#000000"){
+       $R = substr($couleur, 1, 2);
+       $rouge = hexdec($R);
+       $V = substr($couleur, 3, 2);
+       $vert = hexdec($V);
+       $B = substr($couleur, 5, 2);
+       $bleu = hexdec($B);
+       $tbl_couleur = array();
+       $tbl_couleur['R']=$rouge;
+       $tbl_couleur['G']=$vert;
+       $tbl_couleur['B']=$bleu;
+       return $tbl_couleur;
+}
+
+//conversion pixel -> millimeter in 72 dpi
+function px2mm($px){
+       return $px*25.4/72;
+}
+
+function txtentities($html){
+       $trans = get_html_translation_table(HTML_ENTITIES);
+       $trans = array_flip($trans);
+       return strtr($html, $trans);
+}
+////////////////////////////////////
+
+class PDF extends TCPDF_Protection
+{
+//variables of html parser
+var $B;
+var $I;
+var $U;
+var $HREF;
+var $fontList;
+var $issetfont;
+var $issetcolor;
+
+function PDF($orientation='P',$unit='mm',$format='A4')
+{
+       //Call parent constructor
+       $this->TCPDF_Protection($orientation,$unit,$format);
+       //Initialization
+       $this->B=0;
+       $this->I=0;
+       $this->U=0;
+       $this->HREF='';
+       $this->fontlist=array("arial","times","courier","helvetica","symbol");
+       $this->issetfont=false;
+       $this->issetcolor=false;
+}
+
+//////////////////////////////////////
+//html parser
+
+function WriteHTML($html)
+{
+       $html=strip_tags($html,"<b><u><i><a><img><p><br><strong><em><font><tr><blockquote>"); //remove all unsupported tags
+       $html=str_replace("\n",' ',$html); //replace carriage returns by spaces
+       $a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE); //explodes the string
+       foreach($a as $i=>$e)
+       {
+               if($i%2==0)
+               {
+                       //Text
+                       if($this->HREF)
+                               $this->PutLink($this->HREF,$e);
+                       else
+                               $this->Write(5,stripslashes(txtentities($e)));
+               }
+               else
+               {
+                       //Tag
+                       if($e{0}=='/')
+                               $this->CloseTag(strtoupper(substr($e,1)));
+                       else
+                       {
+                               //Extract attributes
+                               $a2=explode(' ',$e);
+                               $tag=strtoupper(array_shift($a2));
+                               $attr=array();
+                               foreach($a2 as $v)
+                                       if(ereg('^([^=]*)=["\']?([^"\']*)["\']?$',$v,$a3))
+                                               $attr[strtoupper($a3[1])]=$a3[2];
+                               $this->OpenTag($tag,$attr);
+                       }
+               }
+       }
+}
+
+function OpenTag($tag,$attr)
+{
+       //Opening tag
+       switch($tag){
+               case 'STRONG':
+                       $this->SetStyle('B',true);
+                       break;
+               case 'EM':
+                       $this->SetStyle('I',true);
+                       break;
+               case 'B':
+               case 'I':
+               case 'U':
+                       $this->SetStyle($tag,true);
+                       break;
+               case 'A':
+                       $this->HREF=$attr['HREF'];
+                       break;
+               case 'IMG':
+                       if(isset($attr['SRC']) and (isset($attr['WIDTH']) or isset($attr['HEIGHT']))) {
+                               if(!isset($attr['WIDTH']))
+                                       $attr['WIDTH'] = 0;
+                               if(!isset($attr['HEIGHT']))
+                                       $attr['HEIGHT'] = 0;
+                               $this->Image($attr['SRC'], $this->GetX(), $this->GetY(), px2mm($attr['WIDTH']), px2mm($attr['HEIGHT']));
+                       }
+                       break;
+               case 'TR':
+               case 'BLOCKQUOTE':
+               case 'BR':
+                       $this->Ln(5);
+                       break;
+               case 'P':
+                       $this->Ln(10);
+                       break;
+               case 'FONT':
+                       if (isset($attr['COLOR']) and $attr['COLOR']!='') {
+                               $coul=hex2dec($attr['COLOR']);
+                               $this->SetTextColor($coul['R'],$coul['G'],$coul['B']);
+                               $this->issetcolor=true;
+                       }
+                       if (isset($attr['FACE']) and in_array(strtolower($attr['FACE']), $this->fontlist)) {
+                               $this->SetFont(strtolower($attr['FACE']));
+                               $this->issetfont=true;
+                       }
+                       break;
+       }
+}
+
+function CloseTag($tag)
+{
+       //Closing tag
+       if($tag=='STRONG')
+               $tag='B';
+       if($tag=='EM')
+               $tag='I';
+       if($tag=='B' or $tag=='I' or $tag=='U')
+               $this->SetStyle($tag,false);
+       if($tag=='A')
+               $this->HREF='';
+       if($tag=='FONT'){
+               if ($this->issetcolor==true) {
+                       $this->SetTextColor(0);
+               }
+               if ($this->issetfont) {
+                       $this->SetFont('arial');
+                       $this->issetfont=false;
+               }
+       }
+}
+
+function SetStyle($tag,$enable)
+{
+       //Modify style and select corresponding font
+       $this->$tag+=($enable ? 1 : -1);
+       $style='';
+       foreach(array('B','I','U') as $s)
+               if($this->$s>0)
+                       $style.=$s;
+       $this->SetFont('',$style);
+}
+
+function PutLink($URL,$txt)
+{
+       //Put a hyperlink
+       $this->SetTextColor(0,0,255);
+       $this->SetStyle('U',true);
+       $this->Write(5,$txt,$URL);
+       $this->SetStyle('U',false);
+       $this->SetTextColor(0);
+}
+
+}//end of class
+?>
\ No newline at end of file
diff --git a/lib/tcpdf/tcpdfprotection.php b/lib/tcpdf/tcpdfprotection.php
new file mode 100644 (file)
index 0000000..a432029
--- /dev/null
@@ -0,0 +1,207 @@
+<?php
+/****************************************************************************
+* Software: FPDF_Protection                                                 *
+* Version:  1.02                                                            *
+* Date:     2005/05/08                                                      *
+* Author:   Klemen VODOPIVEC                                                *
+* License:  Freeware                                                        *
+*                                                                           *
+* You may use and modify this software as you wish as stated in original    *
+* FPDF package.                                                             *
+*                                                                           *
+* Thanks: Cpdf (http://www.ros.co.nz/pdf) was my working sample of how to   *
+* implement protection in pdf.                                              *
+****************************************************************************/
+
+require_once('tcpdf.php');
+
+class TCPDF_Protection extends TCPDF
+{
+    var $encrypted;          //whether document is protected
+    var $Uvalue;             //U entry in pdf document
+    var $Ovalue;             //O entry in pdf document
+    var $Pvalue;             //P entry in pdf document
+    var $enc_obj_id;         //encryption object id
+    var $last_rc4_key;       //last RC4 key encrypted (cached for optimisation)
+    var $last_rc4_key_c;     //last RC4 computed key
+
+    function TCPDF_Protection($orientation='P',$unit='mm',$format='A4') {
+        parent::TCPDF($orientation,$unit,$format);
+
+        $this->encrypted=false;
+        $this->last_rc4_key='';
+        $this->padding="\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08".
+                        "\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
+    }
+
+    /**
+    * Function to set permissions as well as user and owner passwords
+    *
+    * - permissions is an array with values taken from the following list:
+    *   copy, print, modify, annot-forms
+    *   If a value is present it means that the permission is granted
+    * - If a user password is set, user will be prompted before document is opened
+    * - If an owner password is set, document can be opened in privilege mode with no
+    *   restriction if that password is entered
+    */
+    function SetProtection($permissions=array(),$user_pass='',$owner_pass=null) {
+        $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 );
+        $protection = 192;
+        foreach($permissions as $permission){
+            if (!isset($options[$permission]))
+                $this->Error('Incorrect permission: '.$permission);
+            $protection += $options[$permission];
+        }
+        if ($owner_pass === null)
+            $owner_pass = uniqid(rand());
+        $this->encrypted = true;
+        $this->_generateencryptionkey($user_pass, $owner_pass, $protection);
+    }
+
+/****************************************************************************
+*                                                                           *
+*                              Private methods                              *
+*                                                                           *
+****************************************************************************/
+
+    function _putstream($s) {
+        if ($this->encrypted) {
+            $s = $this->_RC4($this->_objectkey($this->n), $s);
+        }
+        parent::_putstream($s);
+    }
+
+    function _textstring($s) {
+        if ($this->encrypted) {
+            $s = $this->_RC4($this->_objectkey($this->n), $s);
+        }
+        return parent::_textstring($s);
+    }
+
+    /**
+    * Compute key depending on object number where the encrypted data is stored
+    */
+    function _objectkey($n) {
+        return substr($this->_md5_16($this->encryption_key.pack('VXxx',$n)),0,10);
+    }
+
+    /**
+    * Escape special characters
+    */
+    function _escape($s) {
+        $s=str_replace('\\','\\\\',$s);
+        $s=str_replace(')','\\)',$s);
+        $s=str_replace('(','\\(',$s);
+        $s=str_replace("\r",'\\r',$s);
+        return $s;
+    }
+
+    function _putresources() {
+        parent::_putresources();
+        if ($this->encrypted) {
+            $this->_newobj();
+            $this->enc_obj_id = $this->n;
+            $this->_out('<<');
+            $this->_putencryption();
+            $this->_out('>>');
+            $this->_out('endobj');
+        }
+    }
+
+    function _putencryption() {
+        $this->_out('/Filter /Standard');
+        $this->_out('/V 1');
+        $this->_out('/R 2');
+        $this->_out('/O ('.$this->_escape($this->Ovalue).')');
+        $this->_out('/U ('.$this->_escape($this->Uvalue).')');
+        $this->_out('/P '.$this->Pvalue);
+    }
+
+    function _puttrailer() {
+        parent::_puttrailer();
+        if ($this->encrypted) {
+            $this->_out('/Encrypt '.$this->enc_obj_id.' 0 R');
+            $this->_out('/ID [()()]');
+        }
+    }
+
+    /**
+    * RC4 is the standard encryption algorithm used in PDF format
+    */
+    function _RC4($key, $text) {
+        if ($this->last_rc4_key != $key) {
+            $k = str_repeat($key, 256/strlen($key)+1);
+            $rc4 = range(0,255);
+            $j = 0;
+            for ($i=0; $i<256; $i++){
+                $t = $rc4[$i];
+                $j = ($j + $t + ord($k{$i})) % 256;
+                $rc4[$i] = $rc4[$j];
+                $rc4[$j] = $t;
+            }
+            $this->last_rc4_key = $key;
+            $this->last_rc4_key_c = $rc4;
+        } else {
+            $rc4 = $this->last_rc4_key_c;
+        }
+
+        $len = strlen($text);
+        $a = 0;
+        $b = 0;
+        $out = '';
+        for ($i=0; $i<$len; $i++){
+            $a = ($a+1)%256;
+            $t= $rc4[$a];
+            $b = ($b+$t)%256;
+            $rc4[$a] = $rc4[$b];
+            $rc4[$b] = $t;
+            $k = $rc4[($rc4[$a]+$rc4[$b])%256];
+            $out.=chr(ord($text{$i}) ^ $k);
+        }
+
+        return $out;
+    }
+
+    /**
+    * Get MD5 as binary string
+    */
+    function _md5_16($string) {
+        return pack('H*',md5($string));
+    }
+
+    /**
+    * Compute O value
+    */
+    function _Ovalue($user_pass, $owner_pass) {
+        $tmp = $this->_md5_16($owner_pass);
+        $owner_RC4_key = substr($tmp,0,5);
+        return $this->_RC4($owner_RC4_key, $user_pass);
+    }
+
+    /**
+    * Compute U value
+    */
+    function _Uvalue() {
+        return $this->_RC4($this->encryption_key, $this->padding);
+    }
+
+    /**
+    * Compute encryption key
+    */
+    function _generateencryptionkey($user_pass, $owner_pass, $protection) {
+        // Pad passwords
+        $user_pass = substr($user_pass.$this->padding,0,32);
+        $owner_pass = substr($owner_pass.$this->padding,0,32);
+        // Compute O value
+        $this->Ovalue = $this->_Ovalue($user_pass,$owner_pass);
+        // Compute encyption key
+        $tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF");
+        $this->encryption_key = substr($tmp,0,5);
+        // Compute U value
+        $this->Uvalue = $this->_Uvalue();
+        // Compute P value
+        $this->Pvalue = -(($protection^255)+1);
+    }
+}
+
+?>
\ No newline at end of file