File: php-html2pdf-4.03-system_tcpdf.patch - Tab length: 1 2 4 8 - Lines: on off - No wrap: on off

diff -Naurp html2pdf_v4.03.orig/_class/myPdf.class.php html2pdf_v4.03.new/_class/myPdf.class.php
--- html2pdf_v4.03.orig/_class/myPdf.class.php  2011-05-26 18:01:10.000000000 +0200
+++ html2pdf_v4.03.new/_class/myPdf.class.php   2013-06-05 12:26:37.292763024 +0200
@@ -10,7 +10,22 @@
  */
 
 require_once(dirname(__FILE__).'/tcpdfConfig.php');
-require_once(dirname(__FILE__).'/../_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/tcpdf.php');
+if (!defined('K_PATH_MAIN')) {
+    require_once(dirname(__FILE__).'/../tcpdf/tcpdf.php');
+} else if (!(K_PATH_MAIN)) {
+    require_once(dirname(__FILE__).'/../tcpdf/tcpdf.php');
+} else {
+    require_once(K_PATH_MAIN . '/tcpdf.php');
+}
+
+if (!defined('HTML2PDF_USED_TCPDF_VERSION')) {
+    if (defined('PDF_PRODUCER')) {
+        define('HTML2PDF_USED_TCPDF_VERSION', preg_replace('/^.*? (\d[0-9.]*).*$/', '\1', PDF_PRODUCER));
+    } else {
+        require_once(K_PATH_MAIN . 'include/tcpdf_static.php');
+        define('HTML2PDF_USED_TCPDF_VERSION', TCPDF_STATIC::getTCPDFVersion());
+    }
+}
 
 class HTML2PDF_myPdf extends TCPDF
 {
@@ -47,6 +62,11 @@ class HTML2PDF_myPdf extends TCPDF
         // call the parent constructor
         parent::__construct($orientation, $unit, $format, $unicode, $encoding, $diskcache);
 
+        // Avoid TCPDF site link output.
+        if (property_exists($this, 'tcpdflink')) {
+            $this->tcpdflink = false;
+        }
+
         // init the specific parameters used by HTML2PDF
         $this->SetCreator(PDF_CREATOR);
         $this->SetAutoPageBreak(false, 0);
@@ -1295,10 +1315,14 @@ class HTML2PDF_myPdf extends TCPDF
                 $strsize=$this->GetStringWidth($str);
             }
 
+            //Insert a link.
+            $link = $this->AddLink();
+            $this->SetLink($link, $this->outlines[$i]['y'], $this->outlines[$i]['p']);
+
             // if we want to display the page nmber
             if ($displayPage) {
                 // display the Bookmark Caption
-                $this->Cell($strsize+2, $this->FontSize+2, $str);
+                $this->Cell($strsize+2, $this->FontSize+2, $str, 0, 0, '', false, $link);
 
                 //Filling dots
                 $w=$this->w-$this->lMargin-$this->rMargin-$pageCellSize-($level*8)-($strsize+2);
@@ -1307,10 +1331,10 @@ class HTML2PDF_myPdf extends TCPDF
                 $this->Cell($w, $this->FontSize+2, $dots, 0, 0, 'R');
 
                 //Page number
-                $this->Cell($pageCellSize, $this->FontSize+2, 'p. '.$this->outlines[$i]['p'], 0, 1, 'R');
+                $this->Cell($pageCellSize, $this->FontSize+2, 'p. '.$this->outlines[$i]['p'], 0, 1, 'R', false, $link);
             } else {
                 // display the Bookmark Caption
-                $this->Cell($strsize+2, $this->FontSize+2, $str, 0, 1);
+                $this->Cell($strsize+2, $this->FontSize+2, $str, 0, 1, '', false, $link);
             }
         }
     }
diff -Naurp html2pdf_v4.03.orig/_class/parsingCss.class.php html2pdf_v4.03.new/_class/parsingCss.class.php
--- html2pdf_v4.03.orig/_class/parsingCss.class.php 2011-05-26 18:01:10.000000000 +0200
+++ html2pdf_v4.03.new/_class/parsingCss.class.php  2013-05-30 17:42:35.379699132 +0200
@@ -94,8 +94,13 @@ class HTML2PDF_parsingCss
     protected function _init()
     {
         // get the Web Colors from TCPDF
-        require(K_PATH_MAIN.'htmlcolors.php');
-        $this->_htmlColor = $webcolor;
+        if ((int) substr(HTML2PDF_USED_TCPDF_VERSION, 0, 1) >= 6) {
+            require_once(K_PATH_MAIN . 'include/tcpdf_colors.php');
+            $this->_htmlColor = TCPDF_COLORS::$webcolor;
+        } else {
+            require(K_PATH_MAIN.'htmlcolors.php');
+            $this->_htmlColor = $webcolor;
+        }
 
         // init the Style
         $this->table = array();
@@ -1809,4 +1814,4 @@ class HTML2PDF_parsingCss
         //analyse the css content
         $this->_analyseStyle($style);
     }
-}
\ No newline at end of file
+}
diff -Naurp html2pdf_v4.03.orig/_class/tcpdfConfig.php html2pdf_v4.03.new/_class/tcpdfConfig.php
--- html2pdf_v4.03.orig/_class/tcpdfConfig.php  2011-04-29 13:37:33.000000000 +0200
+++ html2pdf_v4.03.new/_class/tcpdfConfig.php   2013-05-30 16:34:08.267025933 +0200
@@ -2,31 +2,39 @@
 //============================================================+
 // File name   : tcpdf_config.php
 // Begin       : 2004-06-11
-// Last Update : 2009-09-30
+// Last Update : 2013-05-16
 //
 // Description : Configuration file for TCPDF.
+// Author      : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
+// License     : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
+// -------------------------------------------------------------------
+// Copyright (C) 2004-2013  Nicola Asuni - Tecnick.com LTD
 //
-// Author: Nicola Asuni
+// Extracted from version 6.0.017 and adapted for html2pdf.
 //
-// (c) Copyright:
-//               Nicola Asuni
-//               Tecnick.com s.r.l.
-//               Via Della Pace, 11
-//               09044 Quartucciu (CA)
-//               ITALY
-//               www.tecnick.com
-//               info@tecnick.com
+// This file is part of TCPDF software library.
+//
+// TCPDF is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// TCPDF is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with TCPDF.  If not, see <http://www.gnu.org/licenses/>.
+//
+// See LICENSE.TXT file for more information.
 //============================================================+
 
 /**
  * Configuration file for TCPDF.
  * @author Nicola Asuni
- * @copyright 2004-2008 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com)
- *            Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
  * @package com.tecnick.tcpdf
- * @version 4.0.014
- * @link http://tcpdf.sourceforge.net
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
+ * @version 4.9.005
  * @since 2004-10-27
  */
 
@@ -36,210 +44,181 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG'))
 
     define('K_TCPDF_EXTERNAL_CONFIG', true);
 
-    // DOCUMENT_ROOT fix for IIS Webserver
-    if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) {
-        if (isset($_SERVER['SCRIPT_FILENAME'])) {
-            $_SERVER['DOCUMENT_ROOT'] = str_replace(
-                '\\',
-                '/',
-                substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))
-            );
-        } elseif (isset($_SERVER['PATH_TRANSLATED'])) {
-            $_SERVER['DOCUMENT_ROOT'] = str_replace(
-                '\\',
-                '/',
-                substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))
-            );
-        } else {
-            // define here your DOCUMENT_ROOT path if the previous fails
-            $_SERVER['DOCUMENT_ROOT'] = '/var/www';
-        }
-    }
-
-    // Automatic calculation for the following K_PATH_MAIN constant
-    $kPathMain = str_replace('\\', '/', dirname(__FILE__));
-    $kPathMain = dirname($kPathMain).'/'; // remove the current directory
-    $kPathMain.= '_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/';
-    define('K_PATH_MAIN', $kPathMain);
-
-    // Automatic calculation for the following K_PATH_URL constant
-    if (isset($_SERVER['HTTP_HOST']) AND (!empty($_SERVER['HTTP_HOST']))) {
-        if (isset($_SERVER['HTTPS']) AND (!empty($_SERVER['HTTPS'])) AND strtolower($_SERVER['HTTPS'])!='off') {
-            $kPathUrl = 'https://';
-        } else {
-            $kPathUrl = 'http://';
-        }
-        $kPathUrl .= $_SERVER['HTTP_HOST'];
-        $kPathUrl .= str_replace('\\', '/', substr(K_PATH_MAIN, (strlen($_SERVER['DOCUMENT_ROOT']) - 1)));
-    }
-
     /**
-     * URL path to tcpdf installation folder (http://localhost/tcpdf/).
+     * Installation path (/var/www/tcpdf/).
      * By default it is automatically calculated but you can also set it as a fixed string to improve performances.
      */
-    define('K_PATH_URL', $kPathUrl);
-
+    //define ('K_PATH_MAIN', '');
+    
     /**
-     * path for PDF fonts
-     * use K_PATH_MAIN.'fonts/old/' for old non-UTF8 fonts
+     * URL path to tcpdf installation folder (http://localhost/tcpdf/).
+     * By default it is automatically set but you can also set it as a fixed string to improve performances.
      */
-    define('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
-
+    //define ('K_PATH_URL', '');
+    
     /**
-     * cache directory for temporary files (full path)
+     * Path for PDF fonts.
+     * By default it is automatically set but you can also set it as a fixed string to improve performances.
      */
-    define('K_PATH_CACHE', K_PATH_MAIN.'cache/');
-
+    //define ('K_PATH_FONTS', K_PATH_MAIN.'fonts/');
+    
     /**
-     * cache directory for temporary files (url path)
+     * Default images directory.
+     * By default it is automatically set but you can also set it as a fixed string to improve performances.
      */
-    define('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
-
+    //define ('K_PATH_IMAGES', '');
+    
     /**
-     *images directory
+     * Deafult image logo used be the default Header() method.
+     * Please set here your own logo or an empty string to disable it.
      */
-    define('K_PATH_IMAGES', K_PATH_MAIN.'images/');
-
+    define ('PDF_HEADER_LOGO', '');
+    
     /**
-     * blank image
+     * Header logo image width in user units.
      */
-    define('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png');
-
+    define ('PDF_HEADER_LOGO_WIDTH', 0);
+    
     /**
-     * page format
+     * Cache directory for temporary files (full path).
      */
-    define('PDF_PAGE_FORMAT', 'A4');
-
+    define ('K_PATH_CACHE', sys_get_temp_dir().'/');
+    
     /**
-     * page orientation (P=portrait, L=landscape)
+     * Generic name for a blank image.
      */
-    define('PDF_PAGE_ORIENTATION', 'P');
-
+    define ('K_BLANK_IMAGE', '_blank.png');
+    
     /**
-     * document creator
+     * Page format.
      */
-    define('PDF_CREATOR', 'HTML2PDF - TCPDF');
-
+    define ('PDF_PAGE_FORMAT', 'A4');
+    
     /**
-     * document author
+     * Page orientation (P=portrait, L=landscape).
      */
-    define('PDF_AUTHOR', 'HTML2PDF - TCPDF');
-
+    define ('PDF_PAGE_ORIENTATION', 'P');
+    
     /**
-     * header title
+     * Document creator.
      */
-    define('PDF_HEADER_TITLE', null);
-
+    define ('PDF_CREATOR', 'HTML2PDF - TCPDF');
+    
     /**
-     * header description string
+     * Document author.
      */
-    define('PDF_HEADER_STRING', null);
-
+    define ('PDF_AUTHOR', 'HTML2PDF - TCPDF');
+    
     /**
-     * image logo
+     * Header title.
      */
-    define('PDF_HEADER_LOGO', null);
-
+    define ('PDF_HEADER_TITLE', '');
+    
     /**
-     * header logo image width [mm]
+     * Header description string.
      */
-    define('PDF_HEADER_LOGO_WIDTH', null);
-
+    define ('PDF_HEADER_STRING', '');
+    
     /**
-     *  document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch]
+     * Document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch].
      */
-    define('PDF_UNIT', 'mm');
-
+    define ('PDF_UNIT', 'mm');
+    
     /**
-     * header margin
+     * Header margin.
      */
-    define('PDF_MARGIN_HEADER', 0);
-
+    define ('PDF_MARGIN_HEADER', 0);
+    
     /**
-     * footer margin
+     * Footer margin.
      */
-    define('PDF_MARGIN_FOOTER', 0);
-
+    define ('PDF_MARGIN_FOOTER', 0);
+    
     /**
-     * top margin
+     * Top margin.
      */
-    define('PDF_MARGIN_TOP', 0);
-
+    define ('PDF_MARGIN_TOP', 0);
+    
     /**
-     * bottom margin
+     * Bottom margin.
      */
-    define('PDF_MARGIN_BOTTOM', 0);
-
+    define ('PDF_MARGIN_BOTTOM', 0);
+    
     /**
-     * left margin
+     * Left margin.
      */
-    define('PDF_MARGIN_LEFT', 0);
-
+    define ('PDF_MARGIN_LEFT', 0);
+    
     /**
-     * right margin
+     * Right margin.
      */
-    define('PDF_MARGIN_RIGHT', 0);
-
+    define ('PDF_MARGIN_RIGHT', 0);
+    
     /**
-     * default main font name
+     * Default main font name.
      */
-    define('PDF_FONT_NAME_MAIN', 'helvetica');
-
+    define ('PDF_FONT_NAME_MAIN', 'helvetica');
+    
     /**
-     * default main font size
+     * Default main font size.
      */
-    define('PDF_FONT_SIZE_MAIN', 10);
-
+    define ('PDF_FONT_SIZE_MAIN', 10);
+    
     /**
-     * default data font name
+     * Default data font name.
      */
-    define('PDF_FONT_NAME_DATA', 'helvetica');
-
+    define ('PDF_FONT_NAME_DATA', 'helvetica');
+    
     /**
-     * default data font size
+     * Default data font size.
      */
-    define('PDF_FONT_SIZE_DATA', 8);
-
+    define ('PDF_FONT_SIZE_DATA', 8);
+    
     /**
-     * default monospaced font name
+     * Default monospaced font name.
      */
-    define('PDF_FONT_MONOSPACED', 'courier');
-
+    define ('PDF_FONT_MONOSPACED', 'courier');
+    
     /**
-     * ratio used to adjust the conversion of pixels to user units
+     * Ratio used to adjust the conversion of pixels to user units.
      */
-    define('PDF_IMAGE_SCALE_RATIO', 1);
-
+    define ('PDF_IMAGE_SCALE_RATIO', 1);
+    
     /**
-     * magnification factor for titles
+     * Magnification factor for titles.
      */
     define('HEAD_MAGNIFICATION', 1);
-
+    
     /**
-     * height of cell repect font height
+     * Height of cell respect font height.
      */
     define('K_CELL_HEIGHT_RATIO', 1);
-
+    
     /**
-     * title magnification respect main font size
+     * Title magnification respect main font size.
      */
     define('K_TITLE_MAGNIFICATION', 1);
-
+    
     /**
-     * reduction factor for small font
+     * Reduction factor for small font.
      */
     define('K_SMALL_RATIO', 2/3);
-
+    
     /**
-     * set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language
+     * Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language.
      */
     define('K_THAI_TOPCHARS', true);
-
+    
     /**
-     * if true allows to call TCPDF methods using HTML syntax
+     * If true allows to call TCPDF methods using HTML syntax
      * IMPORTANT: For security reason, disable this feature if you are printing user HTML content.
      */
     define('K_TCPDF_CALLS_IN_HTML', false);
+    
+    /**
+     * If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
+     */
+    define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
 }
 
 //============================================================+
diff -Naurp html2pdf_v4.03.orig/examples/about.php html2pdf_v4.03.new/examples/about.php
--- html2pdf_v4.03.orig/examples/about.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/about.php   2013-06-04 17:54:04.941238352 +0200
@@ -10,7 +10,7 @@
  * isset($_GET['vuehtml']) is not mandatory
  * it allow to display the result in the HTML format
  */
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
 
     // get the HTML
      ob_start();
diff -Naurp html2pdf_v4.03.orig/examples/bookmark.php html2pdf_v4.03.new/examples/bookmark.php
--- html2pdf_v4.03.orig/examples/bookmark.php   2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/bookmark.php    2013-06-04 17:54:17.440337989 +0200
@@ -97,7 +97,7 @@ ob_start();
 <?php
     $content = ob_get_clean();
 
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
diff -Naurp html2pdf_v4.03.orig/examples/exemple00.php html2pdf_v4.03.new/examples/exemple00.php
--- html2pdf_v4.03.orig/examples/exemple00.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple00.php   2013-06-04 17:54:30.268440918 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert in PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple01.php html2pdf_v4.03.new/examples/exemple01.php
--- html2pdf_v4.03.orig/examples/exemple01.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple01.php   2013-06-04 17:54:39.776515727 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert in PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple02.php html2pdf_v4.03.new/examples/exemple02.php
--- html2pdf_v4.03.orig/examples/exemple02.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple02.php   2013-06-04 17:54:49.480593528 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert in PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', array(15, 5, 15, 5));
diff -Naurp html2pdf_v4.03.orig/examples/exemple03.php html2pdf_v4.03.new/examples/exemple03.php
--- html2pdf_v4.03.orig/examples/exemple03.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple03.php   2013-06-04 17:54:59.518673394 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 3);
diff -Naurp html2pdf_v4.03.orig/examples/exemple04.php html2pdf_v4.03.new/examples/exemple04.php
--- html2pdf_v4.03.orig/examples/exemple04.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple04.php   2013-06-04 17:55:07.281735251 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple05.php html2pdf_v4.03.new/examples/exemple05.php
--- html2pdf_v4.03.orig/examples/exemple05.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple05.php   2013-06-04 17:55:15.229798832 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple06.php html2pdf_v4.03.new/examples/exemple06.php
--- html2pdf_v4.03.orig/examples/exemple06.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple06.php   2013-06-04 17:55:22.501856929 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple07.php html2pdf_v4.03.new/examples/exemple07.php
--- html2pdf_v4.03.orig/examples/exemple07.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple07.php   2013-06-04 17:55:32.817938626 +0200
@@ -18,7 +18,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple08.php html2pdf_v4.03.new/examples/exemple08.php
--- html2pdf_v4.03.orig/examples/exemple08.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple08.php   2013-06-04 17:55:40.159998079 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
diff -Naurp html2pdf_v4.03.orig/examples/exemple09.php html2pdf_v4.03.new/examples/exemple09.php
--- html2pdf_v4.03.orig/examples/exemple09.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple09.php   2013-06-04 17:55:58.225139527 +0200
@@ -51,7 +51,7 @@ Bonjour <b><?php echo $nom; ?></b>, ton
 <?php
     if ($generate) {
         $content = ob_get_clean();
-        require_once(dirname(__FILE__).'/../html2pdf.class.php');
+        require_once('html2pdf/html2pdf.class.php');
         try
         {
             $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple10.php html2pdf_v4.03.new/examples/exemple10.php
--- html2pdf_v4.03.orig/examples/exemple10.php  2011-04-05 16:43:45.000000000 +0200
+++ html2pdf_v4.03.new/examples/exemple10.php   2013-06-04 17:56:15.675280844 +0200
@@ -15,7 +15,7 @@
     include(dirname(__FILE__).'/res/exemple10.php');
     $content = ob_get_clean();
 
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple11.php html2pdf_v4.03.new/examples/exemple11.php
--- html2pdf_v4.03.orig/examples/exemple11.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple11.php   2013-06-04 17:56:25.290358057 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple12.php html2pdf_v4.03.new/examples/exemple12.php
--- html2pdf_v4.03.orig/examples/exemple12.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple12.php   2013-06-04 17:56:34.014427184 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/exemple13.php html2pdf_v4.03.new/examples/exemple13.php
--- html2pdf_v4.03.orig/examples/exemple13.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/exemple13.php   2013-06-04 17:56:41.301485329 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/forms.php html2pdf_v4.03.new/examples/forms.php
--- html2pdf_v4.03.orig/examples/forms.php  2011-05-26 18:01:10.000000000 +0200
+++ html2pdf_v4.03.new/examples/forms.php   2013-06-04 17:56:50.126555710 +0200
@@ -25,7 +25,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/groups.php html2pdf_v4.03.new/examples/groups.php
--- html2pdf_v4.03.orig/examples/groups.php 2011-04-07 09:47:13.000000000 +0200
+++ html2pdf_v4.03.new/examples/groups.php  2013-06-04 17:56:56.995610544 +0200
@@ -57,7 +57,7 @@ ob_start();
 <?php
     $content = ob_get_clean();
 
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
diff -Naurp html2pdf_v4.03.orig/examples/js1.php html2pdf_v4.03.new/examples/js1.php
--- html2pdf_v4.03.orig/examples/js1.php    2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/js1.php 2013-06-04 17:57:06.131683356 +0200
@@ -23,7 +23,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/js2.php html2pdf_v4.03.new/examples/js2.php
--- html2pdf_v4.03.orig/examples/js2.php    2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/js2.php 2013-06-04 17:57:13.168739511 +0200
@@ -23,7 +23,7 @@
     $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/js3.php html2pdf_v4.03.new/examples/js3.php
--- html2pdf_v4.03.orig/examples/js3.php    2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/js3.php 2013-06-04 17:57:21.685807370 +0200
@@ -29,7 +29,7 @@ app.alert('Vous vous appelez '+rep);
 ";
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/qrcode.php html2pdf_v4.03.new/examples/qrcode.php
--- html2pdf_v4.03.orig/examples/qrcode.php 2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/qrcode.php  2013-06-04 17:57:29.539870020 +0200
@@ -51,7 +51,7 @@
      $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/radius.php html2pdf_v4.03.new/examples/radius.php
--- html2pdf_v4.03.orig/examples/radius.php 2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/radius.php  2013-06-04 17:57:35.923920864 +0200
@@ -40,7 +40,7 @@
      $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/regle.php html2pdf_v4.03.new/examples/regle.php
--- html2pdf_v4.03.orig/examples/regle.php  2011-02-12 12:58:10.000000000 +0100
+++ html2pdf_v4.03.new/examples/regle.php   2013-06-04 17:57:41.953969022 +0200
@@ -45,7 +45,7 @@
      $content = ob_get_clean();
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('L', 'A4', 'fr', true, 'UTF-8', 10);
diff -Naurp html2pdf_v4.03.orig/examples/res/about.php html2pdf_v4.03.new/examples/res/about.php
--- html2pdf_v4.03.orig/examples/res/about.php  2011-03-14 21:52:38.000000000 +0100
+++ html2pdf_v4.03.new/examples/res/about.php   2013-06-04 17:51:47.650143574 +0200
@@ -17,7 +17,7 @@
                     A propos de ...
                 </td>
                 <td style="width: 50%; text-align: right">
-                    HTML2PDF v<?php echo __CLASS_HTML2PDF__; ?>
+                    HTML2PDF <?php echo defined('__CLASS_HTML2PDF__')? 'v' . __CLASS_HTML2PDF__: 'non-charg��'; ?>
                 </td>
             </tr>
         </table>
@@ -40,7 +40,7 @@
     <bookmark title="Pr��sentation" level="0" ></bookmark>
     <br><br><br><br><br><br><br><br>
     <h1>HTML2PDF</h1>
-    <h3>v<?php echo __CLASS_HTML2PDF__; ?></h3><br>
+    <h3><?php echo defined('__CLASS_HTML2PDF__')? 'v' . __CLASS_HTML2PDF__: 'non-charg��'; ?></h3><br>
     <br><br><br><br><br>
     <div style="text-align: center; width: 100%;">
         <br>
diff -Naurp html2pdf_v4.03.orig/examples/res/exemple01.php html2pdf_v4.03.new/examples/res/exemple01.php
--- html2pdf_v4.03.orig/examples/res/exemple01.php  2011-02-12 12:58:46.000000000 +0100
+++ html2pdf_v4.03.new/examples/res/exemple01.php   2013-05-31 14:26:00.818920032 +0200
@@ -93,4 +93,4 @@ table.morpion td.j2 { color: #A00; }
             </td>
         </tr>
     </table>
-</page>
\ No newline at end of file
+</page>
diff -Naurp html2pdf_v4.03.orig/examples/res/utf8test.txt html2pdf_v4.03.new/examples/res/utf8test.txt
--- html2pdf_v4.03.orig/examples/res/utf8test.txt   1970-01-01 01:00:00.000000000 +0100
+++ html2pdf_v4.03.new/examples/res/utf8test.txt    2011-02-11 22:45:55.000000000 +0100
@@ -0,0 +1,120 @@
+Sentences that contain all letters commonly used in a language
+--------------------------------------------------------------
+
+Markus Kuhn <http://www.cl.cam.ac.uk/~mgk25/> -- 2001-09-02
+
+This file is UTF-8 encoded.
+
+
+Danish (da)
+---------
+
+  Quizdeltagerne spiste jordb��r med fl��de, mens cirkusklovnen
+  Wolther spillede p�� xylofon.
+  (= Quiz contestants were eating strawbery with cream while Wolther
+  the circus clown played on xylophone.)
+
+German (de)
+-----------
+
+  Falsches ��ben von Xylophonmusik qu��lt jeden gr����eren Zwerg
+  (= Wrongful practicing of xylophone music tortures every larger dwarf)
+
+  Zw��lf Boxk��mpfer jagten Eva quer ��ber den Sylter Deich
+  (= Twelve boxing fighters hunted Eva across the dike of Sylt)
+
+  Heiz��lr��cksto��abd��mpfung
+  (= fuel oil recoil absorber)
+  (jqvwxy missing, but all non-ASCII letters in one word)
+
+English (en)
+------------
+
+  The quick brown fox jumps over the lazy dog
+
+Spanish (es)
+------------
+
+  El ping��ino Wenceslao hizo kil��metros bajo exhaustiva lluvia y
+  fr��o, a��oraba a su querido cachorro.
+  (Contains every letter and every accent, but not every combination
+  of vowel + acute.)
+
+French (fr)
+-----------
+
+  Portez ce vieux whisky au juge blond qui fume sur son ��le int��rieure, ��
+  c��t�� de l'alc��ve ovo��de, o�� les b��ches se consument dans l'��tre, ce
+  qui lui permet de penser �� la c��nogen��se de l'��tre dont il est question
+  dans la cause ambigu�� entendue �� Mo��, dans un capharna��m qui,
+  pense-t-il, diminue ���� et l�� la qualit�� de son ��uvre.
+
+  l'��le exigu��
+  O�� l'ob��se jury m��r
+  F��te l'ha�� volap��k,
+  ï¿½ï¿½ne ex a��quo au whist,
+  ï¿½ï¿½tez ce v��u d����u.
+
+  Le c��ur d����u mais l'��me plut��t na��ve, Lou��s r��va de crapa��ter en
+  cano�� au del�� des ��les, pr��s du m��lstr��m o�� br��lent les nov��.
+
+Irish Gaelic (ga)
+-----------------
+
+  D'fhuascail ��osa, ��rmhac na h��ighe Beannaithe, p��r ��ava agus ��dhaimh
+
+Hungarian (hu)
+--------------
+
+  ï¿½ï¿½rv��zt��r�� t��k��rf��r��g��p
+  (= flood-proof mirror-drilling machine, only all non-ASCII letters)
+
+Icelandic (is)
+--------------
+
+  K��mi n�� ��xi h��r ykist ��j��fum n�� b����i v��l og ��drepa
+
+  S��v��r gr��t ����an ��v�� ��lpan var ��n��t
+  (some ASCII letters missing)
+
+Greek (el)
+-------------
+
+  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ������� ��������������� ������� ����� ������� ������� ������� ��������������� ������������
+  (= No more shall I see acacias or myrtles in the golden clearing)
+
+  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ������� ������������������ ������������������
+  (= I uncover the soul-destroying abhorrence)
+
+Hebrew (iw)
+-----------
+
+  ? ���� �������� ���� ������ ������������ ���������� ������ ���� �������� ������ ������������
+
+Polish (pl)
+-----------
+
+  Pchn���� w t�� ����d�� je��a lub o��m skrzy�� fig
+  (= To push a hedgehog or eight bins of figs in this boat)
+
+Russian (ru)
+------------
+
+  ï¿½ï¿½ ���������� ������ ������ ���� ������������? ����, ���� ������������������ ������������������!
+  (= Would a citrus live in the bushes of south? Yes, but only a fake one!)
+
+Thai (th)
+---------
+
+  [--------------------------|------------------------]
+  ï¿½ï¿½ï¿½ ���������������������������������������������������������������������������������������������  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½
+  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½           ������������������������������������������������������������������������������������
+  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½     ���������������������������������������������������������������������������
+  ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½        ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ ������������ ��������������������������� ���
+
+  [The copyright for the Thai example is owned by The Computer
+  Association of Thailand under the Royal Patronage of His Majesty the
+  King.]
+
+Please let me know if you find others! Special thanks to the people
+from all over the world who contributed these sentences.
diff -Naurp html2pdf_v4.03.orig/examples/svg.php html2pdf_v4.03.new/examples/svg.php
--- html2pdf_v4.03.orig/examples/svg.php    2011-04-29 13:36:14.000000000 +0200
+++ html2pdf_v4.03.new/examples/svg.php 2013-06-04 17:57:51.344043929 +0200
@@ -17,7 +17,7 @@
     $content = ob_get_clean();
 
     // convert into PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/svg_tiger.php html2pdf_v4.03.new/examples/svg_tiger.php
--- html2pdf_v4.03.orig/examples/svg_tiger.php  2011-04-29 13:36:14.000000000 +0200
+++ html2pdf_v4.03.new/examples/svg_tiger.php   2013-06-04 17:58:00.031113220 +0200
@@ -260,7 +260,7 @@ $content = '
 </page>';
 
     // convert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('L', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/svg_tree.php html2pdf_v4.03.new/examples/svg_tree.php
--- html2pdf_v4.03.orig/examples/svg_tree.php   2011-04-29 13:36:14.000000000 +0200
+++ html2pdf_v4.03.new/examples/svg_tree.php    2013-06-04 17:58:07.038169049 +0200
@@ -126,7 +126,7 @@ $content = '
 </page>';
 
     // onvert to PDF
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr');
diff -Naurp html2pdf_v4.03.orig/examples/ticket.php html2pdf_v4.03.new/examples/ticket.php
--- html2pdf_v4.03.orig/examples/ticket.php 2011-04-29 13:36:14.000000000 +0200
+++ html2pdf_v4.03.new/examples/ticket.php  2013-06-04 17:58:14.707230464 +0200
@@ -83,7 +83,7 @@
      $content = ob_get_clean();
 
     // convert
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
     try
     {
         $html2pdf = new HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', 0);
diff -Naurp html2pdf_v4.03.orig/examples/utf8.php html2pdf_v4.03.new/examples/utf8.php
--- html2pdf_v4.03.orig/examples/utf8.php   2011-04-07 22:37:52.000000000 +0200
+++ html2pdf_v4.03.new/examples/utf8.php    2013-06-04 17:58:51.998527717 +0200
@@ -11,10 +11,10 @@
  * it allow to display the result in the HTML format
  */
 
-    require_once(dirname(__FILE__).'/../html2pdf.class.php');
+    require_once('html2pdf/html2pdf.class.php');
 
     // get the HTML
-    $content = file_get_contents(dirname(__FILE__).'/../_tcpdf_'.HTML2PDF_USED_TCPDF_VERSION.'/cache/utf8test.txt');
+    $content = file_get_contents(dirname(__FILE__).'/res/utf8test.txt');
     $content = '<page style="font-family: freeserif"><br />'.nl2br($content).'</page>';
 
     // convert to PDF
diff -Naurp html2pdf_v4.03.orig/html2pdf.class.php html2pdf_v4.03.new/html2pdf.class.php
--- html2pdf_v4.03.orig/html2pdf.class.php  2011-05-27 13:23:06.000000000 +0200
+++ html2pdf_v4.03.new/html2pdf.class.php   2013-06-05 11:26:48.891070375 +0200
@@ -12,7 +12,6 @@
 if (!defined('__CLASS_HTML2PDF__')) {
 
     define('__CLASS_HTML2PDF__', '4.03');
-    define('HTML2PDF_USED_TCPDF_VERSION', '5.0.002');
 
     require_once(dirname(__FILE__).'/_class/exception.class.php');
     require_once(dirname(__FILE__).'/_class/locale.class.php');
@@ -109,8 +108,8 @@ if (!defined('__CLASS_HTML2PDF__')) {
         protected $_debugStartTime   = 0;           // debug start time
         protected $_debugLastTime    = 0;           // debug stop time
 
-        static protected $_subobj    = null;        // object html2pdf prepared in order to accelerate the creation of sub html2pdf
-        static protected $_tables    = array();     // static table to prepare the nested html tables
+        protected $_subobj           = null;        // object html2pdf prepared in order to accelerate the creation of sub html2pdf
+        protected $_tables;                         // table to prepare the nested html tables
 
         /**
          * class constructor
@@ -126,6 +125,10 @@ if (!defined('__CLASS_HTML2PDF__')) {
          */
         public function __construct($orientation = 'P', $format = 'A4', $langue='fr', $unicode=true, $encoding='UTF-8', $marges = array(5, 5, 5, 8))
         {
+            // Be sure we have a reference.
+            $tables = array();
+            $this->_tables = &$tables;
+
             // init the page number
             $this->_page         = 0;
             $this->_firstPage    = true;
@@ -185,15 +188,20 @@ if (!defined('__CLASS_HTML2PDF__')) {
         }
 
         /**
-         * Clone to create a sub HTML2PDF from HTML2PDF::$_subobj
+         * Clone to create a sub HTML2PDF from $this->_subobj
          *
          * @access public
          */
         public function __clone()
         {
-            $this->pdf = clone $this->pdf;
-            $this->parsingHtml = clone $this->parsingHtml;
-            $this->parsingCss = clone $this->parsingCss;
+            // TCPDF lacks a good deep cloning support, thus do it here lazily.
+            foreach ($this as $key => $val) {
+                if (is_object($val) || is_array($val)) {
+                    if ($key != '_tables') {
+                        $this->$key = unserialize(serialize($val));
+                    }
+                }
+            }
             $this->parsingCss->setPdfParent($this->pdf);
         }
 
@@ -320,8 +328,9 @@ if (!defined('__CLASS_HTML2PDF__')) {
          */
         protected function _cleanUp()
         {
-            HTML2PDF::$_subobj = null;
-            HTML2PDF::$_tables = array();
+            $this->_subobj = null;
+            $tables = array();
+            $this->_tables = &$tables;
         }
 
         /**
@@ -934,7 +943,7 @@ if (!defined('__CLASS_HTML2PDF__')) {
             $pdf = null;
 
             // create the sub object
-            HTML2PDF::$_subobj = new HTML2PDF(
+            $this->_subobj = new HTML2PDF(
                                         $this->_orientation,
                                         $this->_format,
                                         $this->_langue,
@@ -944,18 +953,19 @@ if (!defined('__CLASS_HTML2PDF__')) {
                                     );
 
             // init
-            HTML2PDF::$_subobj->setTestTdInOnePage($this->_testTdInOnepage);
-            HTML2PDF::$_subobj->setTestIsImage($this->_testIsImage);
-            HTML2PDF::$_subobj->setTestIsDeprecated($this->_testIsDeprecated);
-            HTML2PDF::$_subobj->setDefaultFont($this->_defaultFont);
-            HTML2PDF::$_subobj->parsingCss->css            = &$this->parsingCss->css;
-            HTML2PDF::$_subobj->parsingCss->cssKeys        = &$this->parsingCss->cssKeys;
+            $this->_subobj->_tables = &$this->_tables;
+            $this->_subobj->setTestTdInOnePage($this->_testTdInOnepage);
+            $this->_subobj->setTestIsImage($this->_testIsImage);
+            $this->_subobj->setTestIsDeprecated($this->_testIsDeprecated);
+            $this->_subobj->setDefaultFont($this->_defaultFont);
+            $this->_subobj->parsingCss->css            = &$this->parsingCss->css;
+            $this->_subobj->parsingCss->cssKeys        = &$this->parsingCss->cssKeys;
 
             // clone font from the original PDF
-            HTML2PDF::$_subobj->pdf->cloneFontFrom($this->pdf);
+            $this->_subobj->pdf->cloneFontFrom($this->pdf);
 
             // remove the link to the parent
-            HTML2PDF::$_subobj->parsingCss->setPdfParent($pdf);
+            $this->_subobj->parsingCss->setPdfParent($pdf);
         }
 
         /**
@@ -968,7 +978,7 @@ if (!defined('__CLASS_HTML2PDF__')) {
         protected function _createSubHTML(&$subHtml, $cellmargin=0)
         {
             // prepare the subObject, if never prepare before
-            if (HTML2PDF::$_subobj===null) {
+            if ($this->_subobj===null) {
                 $this->_prepareSubObj();
             }
 
@@ -983,10 +993,11 @@ if (!defined('__CLASS_HTML2PDF__')) {
             }
 
             // BUGFIX : we have to call the method, because of a bug in php 5.1.6
-            HTML2PDF::$_subobj->pdf->getPage();
+            $this->_subobj->pdf->getPage();
 
             // clone the sub oject
-            $subHtml = clone HTML2PDF::$_subobj;
+            $subHtml = clone $this->_subobj;
+            $subHtml->_tables = &$this->_tables;
             $subHtml->parsingCss->table = $this->parsingCss->table;
             $subHtml->parsingCss->value = $this->parsingCss->value;
             $subHtml->initSubHtml(
@@ -1007,7 +1018,6 @@ if (!defined('__CLASS_HTML2PDF__')) {
          */
         protected function _destroySubHTML(&$subHtml)
         {
-            unset($subHtml);
             $subHtml = null;
         }
 
@@ -3488,6 +3498,9 @@ if (!defined('__CLASS_HTML2PDF__')) {
             $this->parsingCss->value['font-size']=$fontSize*0.5; $this->_tag_open_BR($param);
             $this->parsingCss->value['font-size']=$fontSize;
 
+            // Restore font size in producer.
+            $this->pdf->SetFontSize(720 * $fontSize / 254);
+
             $this->parsingCss->value['text-align'] = $oldAlign;
             $this->_setNewPositionForNewLine();
 
@@ -4603,18 +4616,18 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // if we are in a sub part, save the number of the first TR in the thead
             if ($this->_subPart) {
-                HTML2PDF::$_tables[$param['num']]['thead']['tr'][0] = HTML2PDF::$_tables[$param['num']]['tr_curr'];
-                HTML2PDF::$_tables[$param['num']]['thead']['code'] = array();
+                $this->_tables[$param['num']]['thead']['tr'][0] = $this->_tables[$param['num']]['tr_curr'];
+                $this->_tables[$param['num']]['thead']['code'] = array();
                 for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) {
                     $action = $this->parsingHtml->code[$pos];
                     if (strtolower($action['name'])=='thead') $action['name'] = 'thead_sub';
-                    HTML2PDF::$_tables[$param['num']]['thead']['code'][] = $action;
+                    $this->_tables[$param['num']]['thead']['code'][] = $action;
                     if (strtolower($action['name'])=='thead_sub' && $action['close']) break;
                 }
             } else {
                 $level = $this->parsingHtml->getLevel($this->_parsePos);
                 $this->_parsePos+= count($level);
-                HTML2PDF::$_tables[$param['num']]['tr_curr']+= count(HTML2PDF::$_tables[$param['num']]['thead']['tr']);
+                $this->_tables[$param['num']]['tr_curr']+= count($this->_tables[$param['num']]['thead']['tr']);
             }
 
             return true;
@@ -4636,9 +4649,9 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // if we are in a sub HTM, construct the list of the TR in the thead
             if ($this->_subPart) {
-                $min = HTML2PDF::$_tables[$param['num']]['thead']['tr'][0];
-                $max = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
-                HTML2PDF::$_tables[$param['num']]['thead']['tr'] = range($min, $max);
+                $min = $this->_tables[$param['num']]['thead']['tr'][0];
+                $max = $this->_tables[$param['num']]['tr_curr']-1;
+                $this->_tables[$param['num']]['thead']['tr'] = range($min, $max);
             }
 
             return true;
@@ -4662,18 +4675,18 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // if we are in a sub part, save the number of the first TR in the tfoot
             if ($this->_subPart) {
-                HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0] = HTML2PDF::$_tables[$param['num']]['tr_curr'];
-                HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array();
+                $this->_tables[$param['num']]['tfoot']['tr'][0] = $this->_tables[$param['num']]['tr_curr'];
+                $this->_tables[$param['num']]['tfoot']['code'] = array();
                 for ($pos=$this->_tempPos; $pos<count($this->parsingHtml->code); $pos++) {
                     $action = $this->parsingHtml->code[$pos];
                     if (strtolower($action['name'])=='tfoot') $action['name'] = 'tfoot_sub';
-                    HTML2PDF::$_tables[$param['num']]['tfoot']['code'][] = $action;
+                    $this->_tables[$param['num']]['tfoot']['code'][] = $action;
                     if (strtolower($action['name'])=='tfoot_sub' && $action['close']) break;
                 }
             } else {
                 $level = $this->parsingHtml->getLevel($this->_parsePos);
                 $this->_parsePos+= count($level);
-                HTML2PDF::$_tables[$param['num']]['tr_curr']+= count(HTML2PDF::$_tables[$param['num']]['tfoot']['tr']);
+                $this->_tables[$param['num']]['tr_curr']+= count($this->_tables[$param['num']]['tfoot']['tr']);
             }
 
             return true;
@@ -4695,9 +4708,9 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // if we are in a sub HTM, construct the list of the TR in the tfoot
             if ($this->_subPart) {
-                $min = HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0];
-                $max = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
-                HTML2PDF::$_tables[$param['num']]['tfoot']['tr'] = range($min, $max);
+                $min = $this->_tables[$param['num']]['tfoot']['tr'][0];
+                $max = $this->_tables[$param['num']]['tr_curr']-1;
+                $this->_tables[$param['num']]['tfoot']['tr'] = range($min, $max);
             }
 
             return true;
@@ -4867,63 +4880,63 @@ if (!defined('__CLASS_HTML2PDF__')) {
             // if we are in a SUB html => prepare the properties of the table
             if ($this->_subPart) {
                 if ($this->_debugActif) $this->_DEBUG_add('Table n'.$param['num'], true);
-                HTML2PDF::$_tables[$param['num']] = array();
-                HTML2PDF::$_tables[$param['num']]['border']          = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null;
-                HTML2PDF::$_tables[$param['num']]['cellpadding']     = $this->parsingCss->ConvertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px');
-                HTML2PDF::$_tables[$param['num']]['cellspacing']     = $this->parsingCss->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
-                HTML2PDF::$_tables[$param['num']]['cases']           = array();          // properties of each TR/TD
-                HTML2PDF::$_tables[$param['num']]['corr']            = array();          // link between TR/TD and colspan/rowspan
-                HTML2PDF::$_tables[$param['num']]['corr_x']          = 0;                // position in 'cases'
-                HTML2PDF::$_tables[$param['num']]['corr_y']          = 0;                // position in 'cases'
-                HTML2PDF::$_tables[$param['num']]['td_curr']         = 0;                // current column
-                HTML2PDF::$_tables[$param['num']]['tr_curr']         = 0;                // current row
-                HTML2PDF::$_tables[$param['num']]['curr_x']          = $this->pdf->getX();
-                HTML2PDF::$_tables[$param['num']]['curr_y']          = $this->pdf->getY();
-                HTML2PDF::$_tables[$param['num']]['width']           = 0;                // global width
-                HTML2PDF::$_tables[$param['num']]['height']          = 0;                // global height
-                HTML2PDF::$_tables[$param['num']]['align']           = $alignObject;
-                HTML2PDF::$_tables[$param['num']]['marge']           = array();
-                HTML2PDF::$_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t']+$this->parsingCss->value['border']['t']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
-                HTML2PDF::$_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r']+$this->parsingCss->value['border']['r']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
-                HTML2PDF::$_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b']+$this->parsingCss->value['border']['b']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
-                HTML2PDF::$_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l']+$this->parsingCss->value['border']['l']['width']+HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5;
-                HTML2PDF::$_tables[$param['num']]['page']            = 0;                // number of pages
-                HTML2PDF::$_tables[$param['num']]['new_page']        = true;             // flag : new page for the current TR
-                HTML2PDF::$_tables[$param['num']]['style_value']     = null;             // CSS style of the table
-                HTML2PDF::$_tables[$param['num']]['thead']           = array();          // properties on the thead
-                HTML2PDF::$_tables[$param['num']]['tfoot']           = array();          // properties on the tfoot
-                HTML2PDF::$_tables[$param['num']]['thead']['tr']     = array();          // list of the TRs in the thead
-                HTML2PDF::$_tables[$param['num']]['tfoot']['tr']     = array();          // list of the TRs in the tfoot
-                HTML2PDF::$_tables[$param['num']]['thead']['height']    = 0;             // thead height
-                HTML2PDF::$_tables[$param['num']]['tfoot']['height']    = 0;             // tfoot height
-                HTML2PDF::$_tables[$param['num']]['thead']['code'] = array();            // HTML content of the thead
-                HTML2PDF::$_tables[$param['num']]['tfoot']['code'] = array();            // HTML content of the tfoot
-                HTML2PDF::$_tables[$param['num']]['cols']        = array();              // properties of the COLs
+                $this->_tables[$param['num']] = array();
+                $this->_tables[$param['num']]['border']          = isset($param['border']) ? $this->parsingCss->readBorder($param['border']) : null;
+                $this->_tables[$param['num']]['cellpadding']     = $this->parsingCss->ConvertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px');
+                $this->_tables[$param['num']]['cellspacing']     = $this->parsingCss->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px');
+                $this->_tables[$param['num']]['cases']           = array();          // properties of each TR/TD
+                $this->_tables[$param['num']]['corr']            = array();          // link between TR/TD and colspan/rowspan
+                $this->_tables[$param['num']]['corr_x']          = 0;                // position in 'cases'
+                $this->_tables[$param['num']]['corr_y']          = 0;                // position in 'cases'
+                $this->_tables[$param['num']]['td_curr']         = 0;                // current column
+                $this->_tables[$param['num']]['tr_curr']         = 0;                // current row
+                $this->_tables[$param['num']]['curr_x']          = $this->pdf->getX();
+                $this->_tables[$param['num']]['curr_y']          = $this->pdf->getY();
+                $this->_tables[$param['num']]['width']           = 0;                // global width
+                $this->_tables[$param['num']]['height']          = 0;                // global height
+                $this->_tables[$param['num']]['align']           = $alignObject;
+                $this->_tables[$param['num']]['marge']           = array();
+                $this->_tables[$param['num']]['marge']['t']      = $this->parsingCss->value['padding']['t']+$this->parsingCss->value['border']['t']['width']+$this->_tables[$param['num']]['cellspacing']*0.5;
+                $this->_tables[$param['num']]['marge']['r']      = $this->parsingCss->value['padding']['r']+$this->parsingCss->value['border']['r']['width']+$this->_tables[$param['num']]['cellspacing']*0.5;
+                $this->_tables[$param['num']]['marge']['b']      = $this->parsingCss->value['padding']['b']+$this->parsingCss->value['border']['b']['width']+$this->_tables[$param['num']]['cellspacing']*0.5;
+                $this->_tables[$param['num']]['marge']['l']      = $this->parsingCss->value['padding']['l']+$this->parsingCss->value['border']['l']['width']+$this->_tables[$param['num']]['cellspacing']*0.5;
+                $this->_tables[$param['num']]['page']            = 0;                // number of pages
+                $this->_tables[$param['num']]['new_page']        = true;             // flag : new page for the current TR
+                $this->_tables[$param['num']]['style_value']     = null;             // CSS style of the table
+                $this->_tables[$param['num']]['thead']           = array();          // properties on the thead
+                $this->_tables[$param['num']]['tfoot']           = array();          // properties on the tfoot
+                $this->_tables[$param['num']]['thead']['tr']     = array();          // list of the TRs in the thead
+                $this->_tables[$param['num']]['tfoot']['tr']     = array();          // list of the TRs in the tfoot
+                $this->_tables[$param['num']]['thead']['height']    = 0;             // thead height
+                $this->_tables[$param['num']]['tfoot']['height']    = 0;             // tfoot height
+                $this->_tables[$param['num']]['thead']['code'] = array();            // HTML content of the thead
+                $this->_tables[$param['num']]['tfoot']['code'] = array();            // HTML content of the tfoot
+                $this->_tables[$param['num']]['cols']        = array();              // properties of the COLs
 
                 $this->_saveMargin($this->pdf->getlMargin(), $this->pdf->gettMargin(), $this->pdf->getrMargin());
 
-                $this->parsingCss->value['width']-= HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['marge']['r'];
+                $this->parsingCss->value['width']-= $this->_tables[$param['num']]['marge']['l'] + $this->_tables[$param['num']]['marge']['r'];
             } else {
                 // we start from the first page and the first page of the table
-                HTML2PDF::$_tables[$param['num']]['page'] = 0;
-                HTML2PDF::$_tables[$param['num']]['td_curr']    = 0;
-                HTML2PDF::$_tables[$param['num']]['tr_curr']    = 0;
-                HTML2PDF::$_tables[$param['num']]['td_x']        = HTML2PDF::$_tables[$param['num']]['marge']['l']+HTML2PDF::$_tables[$param['num']]['curr_x'];
-                HTML2PDF::$_tables[$param['num']]['td_y']        = HTML2PDF::$_tables[$param['num']]['marge']['t']+HTML2PDF::$_tables[$param['num']]['curr_y'];
+                $this->_tables[$param['num']]['page'] = 0;
+                $this->_tables[$param['num']]['td_curr']    = 0;
+                $this->_tables[$param['num']]['tr_curr']    = 0;
+                $this->_tables[$param['num']]['td_x']        = $this->_tables[$param['num']]['marge']['l']+$this->_tables[$param['num']]['curr_x'];
+                $this->_tables[$param['num']]['td_y']        = $this->_tables[$param['num']]['marge']['t']+$this->_tables[$param['num']]['curr_y'];
 
                 // draw the borders/background of the first page/part of the table
                 $this->_drawRectangle(
-                    HTML2PDF::$_tables[$param['num']]['curr_x'],
-                    HTML2PDF::$_tables[$param['num']]['curr_y'],
-                    HTML2PDF::$_tables[$param['num']]['width'],
-                    isset(HTML2PDF::$_tables[$param['num']]['height'][0]) ? HTML2PDF::$_tables[$param['num']]['height'][0] : null,
+                    $this->_tables[$param['num']]['curr_x'],
+                    $this->_tables[$param['num']]['curr_y'],
+                    $this->_tables[$param['num']]['width'],
+                    isset($this->_tables[$param['num']]['height'][0]) ? $this->_tables[$param['num']]['height'][0] : null,
                     $this->parsingCss->value['border'],
                     $this->parsingCss->value['padding'],
                     0,
                     $this->parsingCss->value['background']
                 );
 
-                HTML2PDF::$_tables[$param['num']]['style_value'] = $this->parsingCss->value;
+                $this->_tables[$param['num']]['style_value'] = $this->parsingCss->value;
             }
 
             return true;
@@ -4945,79 +4958,79 @@ if (!defined('__CLASS_HTML2PDF__')) {
             // if we are in a sub HTML
             if ($this->_subPart) {
                 // calculate the size of each case
-                $this->_calculateTableCellSize(HTML2PDF::$_tables[$param['num']]['cases'], HTML2PDF::$_tables[$param['num']]['corr']);
+                $this->_calculateTableCellSize($this->_tables[$param['num']]['cases'], $this->_tables[$param['num']]['corr']);
 
                 // calculate the height of the thead and the tfoot
                 $lst = array('thead', 'tfoot');
                 foreach ($lst as $mode) {
-                    HTML2PDF::$_tables[$param['num']][$mode]['height'] = 0;
-                    foreach (HTML2PDF::$_tables[$param['num']][$mode]['tr'] as $tr) {
+                    $this->_tables[$param['num']][$mode]['height'] = 0;
+                    foreach ($this->_tables[$param['num']][$mode]['tr'] as $tr) {
                         // hauteur de la ligne tr
                         $h = 0;
-                        for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$tr]); $i++)
-                            if (HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['rowspan']==1)
-                                $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$tr][$i]['h']);
-                        HTML2PDF::$_tables[$param['num']][$mode]['height']+= $h;
+                        for ($i=0; $i<count($this->_tables[$param['num']]['cases'][$tr]); $i++)
+                            if ($this->_tables[$param['num']]['cases'][$tr][$i]['rowspan']==1)
+                                $h = max($h, $this->_tables[$param['num']]['cases'][$tr][$i]['h']);
+                        $this->_tables[$param['num']][$mode]['height']+= $h;
                     }
                 }
 
                 // calculate the width of the table
-                HTML2PDF::$_tables[$param['num']]['width'] = HTML2PDF::$_tables[$param['num']]['marge']['l'] + HTML2PDF::$_tables[$param['num']]['marge']['r'];
-                if (isset(HTML2PDF::$_tables[$param['num']]['cases'][0])) {
-                    foreach (HTML2PDF::$_tables[$param['num']]['cases'][0] as $case) {
-                        HTML2PDF::$_tables[$param['num']]['width']+= $case['w'];
+                $this->_tables[$param['num']]['width'] = $this->_tables[$param['num']]['marge']['l'] + $this->_tables[$param['num']]['marge']['r'];
+                if (isset($this->_tables[$param['num']]['cases'][0])) {
+                    foreach ($this->_tables[$param['num']]['cases'][0] as $case) {
+                        $this->_tables[$param['num']]['width']+= $case['w'];
                     }
                 }
 
                 // X position of the table
                 $old = $this->parsingCss->getOldValues();
                 $parentWidth = $old['width'] ? $old['width'] : $this->pdf->getW() - $this->pdf->getlMargin() - $this->pdf->getrMargin();
-                $x = HTML2PDF::$_tables[$param['num']]['curr_x'];
-                $w = HTML2PDF::$_tables[$param['num']]['width'];
+                $x = $this->_tables[$param['num']]['curr_x'];
+                $w = $this->_tables[$param['num']]['width'];
                 if ($parentWidth>$w) {
-                    if (HTML2PDF::$_tables[$param['num']]['align']=='center')
+                    if ($this->_tables[$param['num']]['align']=='center')
                         $x = $x + ($parentWidth-$w)*0.5;
-                    else if (HTML2PDF::$_tables[$param['num']]['align']=='right')
+                    else if ($this->_tables[$param['num']]['align']=='right')
                         $x = $x + $parentWidth-$w;
 
-                    HTML2PDF::$_tables[$param['num']]['curr_x'] = $x;
+                    $this->_tables[$param['num']]['curr_x'] = $x;
                 }
 
                 // calculate the height of the table
-                HTML2PDF::$_tables[$param['num']]['height'] = array();
+                $this->_tables[$param['num']]['height'] = array();
 
                 // minimum of the height because of margins, and of the thead and tfoot height
-                $h0 = HTML2PDF::$_tables[$param['num']]['marge']['t'] + HTML2PDF::$_tables[$param['num']]['marge']['b'];
-                $h0+= HTML2PDF::$_tables[$param['num']]['thead']['height'] + HTML2PDF::$_tables[$param['num']]['tfoot']['height'];
+                $h0 = $this->_tables[$param['num']]['marge']['t'] + $this->_tables[$param['num']]['marge']['b'];
+                $h0+= $this->_tables[$param['num']]['thead']['height'] + $this->_tables[$param['num']]['tfoot']['height'];
 
                 // max height of the page
                 $max = $this->pdf->getH() - $this->pdf->getbMargin();
 
                 // current position on the page
-                $y = HTML2PDF::$_tables[$param['num']]['curr_y'];
+                $y = $this->_tables[$param['num']]['curr_y'];
                 $height = $h0;
 
                 // we get the height of each line
-                for ($k=0; $k<count(HTML2PDF::$_tables[$param['num']]['cases']); $k++) {
+                for ($k=0; $k<count($this->_tables[$param['num']]['cases']); $k++) {
 
                     // if it is a TR of the thead or of the tfoot => skip
-                    if (in_array($k, HTML2PDF::$_tables[$param['num']]['thead']['tr'])) continue;
-                    if (in_array($k, HTML2PDF::$_tables[$param['num']]['tfoot']['tr'])) continue;
+                    if (in_array($k, $this->_tables[$param['num']]['thead']['tr'])) continue;
+                    if (in_array($k, $this->_tables[$param['num']]['tfoot']['tr'])) continue;
 
                     // height of the line
                     $th = 0;
                     $h = 0;
-                    for ($i=0; $i<count(HTML2PDF::$_tables[$param['num']]['cases'][$k]); $i++) {
-                        $h = max($h, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']);
+                    for ($i=0; $i<count($this->_tables[$param['num']]['cases'][$k]); $i++) {
+                        $h = max($h, $this->_tables[$param['num']]['cases'][$k][$i]['h']);
 
-                        if (HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['rowspan']==1)
-                            $th = max($th, HTML2PDF::$_tables[$param['num']]['cases'][$k][$i]['h']);
+                        if ($this->_tables[$param['num']]['cases'][$k][$i]['rowspan']==1)
+                            $th = max($th, $this->_tables[$param['num']]['cases'][$k][$i]['h']);
                     }
 
                     // if the row does not fit on the page => new page
                     if ($y+$h+$height>$max) {
                         if ($height==$h0) $height = null;
-                        HTML2PDF::$_tables[$param['num']]['height'][] = $height;
+                        $this->_tables[$param['num']]['height'][] = $height;
                         $height = $h0;
                         $y = $this->_margeTop;
                     }
@@ -5025,37 +5038,37 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 }
 
                 // if ther is a height at the end, add it
-                if ($height!=$h0 || $k==0) HTML2PDF::$_tables[$param['num']]['height'][] = $height;
+                if ($height!=$h0 || $k==0) $this->_tables[$param['num']]['height'][] = $height;
             } else {
                 // if we have tfoor, draw it
-                if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) {
-                    $tmpTR = HTML2PDF::$_tables[$param['num']]['tr_curr'];
-                    $tmpTD = HTML2PDF::$_tables[$param['num']]['td_curr'];
+                if (count($this->_tables[$param['num']]['tfoot']['code'])) {
+                    $tmpTR = $this->_tables[$param['num']]['tr_curr'];
+                    $tmpTD = $this->_tables[$param['num']]['td_curr'];
                     $oldParsePos = $this->_parsePos;
                     $oldParseCode = $this->parsingHtml->code;
 
-                    HTML2PDF::$_tables[$param['num']]['tr_curr'] = HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0];
-                    HTML2PDF::$_tables[$param['num']]['td_curr'] = 0;
+                    $this->_tables[$param['num']]['tr_curr'] = $this->_tables[$param['num']]['tfoot']['tr'][0];
+                    $this->_tables[$param['num']]['td_curr'] = 0;
                     $this->_parsePos = 0;
-                    $this->parsingHtml->code = HTML2PDF::$_tables[$param['num']]['tfoot']['code'];
+                    $this->parsingHtml->code = $this->_tables[$param['num']]['tfoot']['code'];
                     $this->_isInTfoot = true;
                     $this->_makeHTMLcode();
                     $this->_isInTfoot = false;
 
                     $this->_parsePos =     $oldParsePos;
                     $this->parsingHtml->code = $oldParseCode;
-                    HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
-                    HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
+                    $this->_tables[$param['num']]['tr_curr'] = $tmpTR;
+                    $this->_tables[$param['num']]['td_curr'] = $tmpTD;
                 }
 
                 // get the positions of the end of the table
-                $x = HTML2PDF::$_tables[$param['num']]['curr_x'] + HTML2PDF::$_tables[$param['num']]['width'];
-                if (count(HTML2PDF::$_tables[$param['num']]['height'])>1)
-                    $y = $this->_margeTop+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1];
-                else if (count(HTML2PDF::$_tables[$param['num']]['height'])==1)
-                    $y = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['height'][count(HTML2PDF::$_tables[$param['num']]['height'])-1];
+                $x = $this->_tables[$param['num']]['curr_x'] + $this->_tables[$param['num']]['width'];
+                if (count($this->_tables[$param['num']]['height'])>1)
+                    $y = $this->_margeTop+$this->_tables[$param['num']]['height'][count($this->_tables[$param['num']]['height'])-1];
+                else if (count($this->_tables[$param['num']]['height'])==1)
+                    $y = $this->_tables[$param['num']]['curr_y']+$this->_tables[$param['num']]['height'][count($this->_tables[$param['num']]['height'])-1];
                 else
-                    $y = HTML2PDF::$_tables[$param['num']]['curr_y'];
+                    $y = $this->_tables[$param['num']]['curr_y'];
 
                 $this->_maxX = max($this->_maxX, $x);
                 $this->_maxY = max($this->_maxY, $y);
@@ -5085,7 +5098,7 @@ if (!defined('__CLASS_HTML2PDF__')) {
         {
             $span = isset($param['span']) ? $param['span'] : 1;
             for ($k=0; $k<$span; $k++)
-                HTML2PDF::$_tables[$param['num']]['cols'][] = $param;
+                $this->_tables[$param['num']]['cols'][] = $param;
         }
 
         /**
@@ -5121,67 +5134,67 @@ if (!defined('__CLASS_HTML2PDF__')) {
             $this->parsingCss->fontSet();
 
             // position in the table
-            HTML2PDF::$_tables[$param['num']]['tr_curr']++;
-            HTML2PDF::$_tables[$param['num']]['td_curr']= 0;
+            $this->_tables[$param['num']]['tr_curr']++;
+            $this->_tables[$param['num']]['td_curr']= 0;
 
             // if we are not in a sub html
             if (!$this->_subPart) {
 
                 // Y after the row
                 $ty=null;
-                for ($ii=0; $ii<count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1]); $ii++) {
-                    $ty = max($ty, HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['h']);
+                for ($ii=0; $ii<count($this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1]); $ii++) {
+                    $ty = max($ty, $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$ii]['h']);
                 }
 
                 // height of the tfoot
-                $hfoot = HTML2PDF::$_tables[$param['num']]['tfoot']['height'];
+                $hfoot = $this->_tables[$param['num']]['tfoot']['height'];
 
                 // if the line does not fit on the page => new page
-                if (!$this->_isInTfoot && HTML2PDF::$_tables[$param['num']]['td_y'] + HTML2PDF::$_tables[$param['num']]['marge']['b'] + $ty +$hfoot> $this->pdf->getH() - $this->pdf->getbMargin()) {
+                if (!$this->_isInTfoot && $this->_tables[$param['num']]['td_y'] + $this->_tables[$param['num']]['marge']['b'] + $ty +$hfoot> $this->pdf->getH() - $this->pdf->getbMargin()) {
 
                     // fi ther is a tfoot => draw it
-                    if (count(HTML2PDF::$_tables[$param['num']]['tfoot']['code'])) {
-                        $tmpTR = HTML2PDF::$_tables[$param['num']]['tr_curr'];
-                        $tmpTD = HTML2PDF::$_tables[$param['num']]['td_curr'];
+                    if (count($this->_tables[$param['num']]['tfoot']['code'])) {
+                        $tmpTR = $this->_tables[$param['num']]['tr_curr'];
+                        $tmpTD = $this->_tables[$param['num']]['td_curr'];
                         $oldParsePos = $this->_parsePos;
                         $oldParseCode = $this->parsingHtml->code;
 
-                        HTML2PDF::$_tables[$param['num']]['tr_curr'] = HTML2PDF::$_tables[$param['num']]['tfoot']['tr'][0];
-                        HTML2PDF::$_tables[$param['num']]['td_curr'] = 0;
+                        $this->_tables[$param['num']]['tr_curr'] = $this->_tables[$param['num']]['tfoot']['tr'][0];
+                        $this->_tables[$param['num']]['td_curr'] = 0;
                         $this->_parsePos = 0;
-                        $this->parsingHtml->code = HTML2PDF::$_tables[$param['num']]['tfoot']['code'];
+                        $this->parsingHtml->code = $this->_tables[$param['num']]['tfoot']['code'];
                         $this->_isInTfoot = true;
                         $this->_makeHTMLcode();
                         $this->_isInTfoot = false;
 
                         $this->_parsePos =     $oldParsePos;
                         $this->parsingHtml->code = $oldParseCode;
-                        HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
-                        HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
+                        $this->_tables[$param['num']]['tr_curr'] = $tmpTR;
+                        $this->_tables[$param['num']]['td_curr'] = $tmpTD;
                     }
 
                     // new page
-                    HTML2PDF::$_tables[$param['num']]['new_page'] = true;
+                    $this->_tables[$param['num']]['new_page'] = true;
                     $this->_setNewPage();
 
                     // new position
-                    HTML2PDF::$_tables[$param['num']]['page']++;
-                    HTML2PDF::$_tables[$param['num']]['curr_y'] = $this->pdf->getY();
-                    HTML2PDF::$_tables[$param['num']]['td_y'] = HTML2PDF::$_tables[$param['num']]['curr_y']+HTML2PDF::$_tables[$param['num']]['marge']['t'];
+                    $this->_tables[$param['num']]['page']++;
+                    $this->_tables[$param['num']]['curr_y'] = $this->pdf->getY();
+                    $this->_tables[$param['num']]['td_y'] = $this->_tables[$param['num']]['curr_y']+$this->_tables[$param['num']]['marge']['t'];
 
                     // if we have the height of the tbale on the page => draw borders and background
-                    if (isset(HTML2PDF::$_tables[$param['num']]['height'][HTML2PDF::$_tables[$param['num']]['page']])) {
+                    if (isset($this->_tables[$param['num']]['height'][$this->_tables[$param['num']]['page']])) {
                         $old = $this->parsingCss->value;
-                        $this->parsingCss->value = HTML2PDF::$_tables[$param['num']]['style_value'];
+                        $this->parsingCss->value = $this->_tables[$param['num']]['style_value'];
 
                         $this->_drawRectangle(
-                            HTML2PDF::$_tables[$param['num']]['curr_x'],
-                            HTML2PDF::$_tables[$param['num']]['curr_y'],
-                            HTML2PDF::$_tables[$param['num']]['width'],
-                            HTML2PDF::$_tables[$param['num']]['height'][HTML2PDF::$_tables[$param['num']]['page']],
+                            $this->_tables[$param['num']]['curr_x'],
+                            $this->_tables[$param['num']]['curr_y'],
+                            $this->_tables[$param['num']]['width'],
+                            $this->_tables[$param['num']]['height'][$this->_tables[$param['num']]['page']],
                             $this->parsingCss->value['border'],
                             $this->parsingCss->value['padding'],
-                            HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5,
+                            $this->_tables[$param['num']]['cellspacing']*0.5,
                             $this->parsingCss->value['background']
                         );
 
@@ -5190,37 +5203,37 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 }
 
                 // if we are in a new page, and if we have a thead => draw it
-                if (HTML2PDF::$_tables[$param['num']]['new_page'] && count(HTML2PDF::$_tables[$param['num']]['thead']['code'])) {
-                    HTML2PDF::$_tables[$param['num']]['new_page'] = false;
-                    $tmpTR = HTML2PDF::$_tables[$param['num']]['tr_curr'];
-                    $tmpTD = HTML2PDF::$_tables[$param['num']]['td_curr'];
+                if ($this->_tables[$param['num']]['new_page'] && count($this->_tables[$param['num']]['thead']['code'])) {
+                    $this->_tables[$param['num']]['new_page'] = false;
+                    $tmpTR = $this->_tables[$param['num']]['tr_curr'];
+                    $tmpTD = $this->_tables[$param['num']]['td_curr'];
                     $oldParsePos = $this->_parsePos;
                     $oldParseCode = $this->parsingHtml->code;
 
-                    HTML2PDF::$_tables[$param['num']]['tr_curr'] = HTML2PDF::$_tables[$param['num']]['thead']['tr'][0];
-                    HTML2PDF::$_tables[$param['num']]['td_curr'] = 0;
+                    $this->_tables[$param['num']]['tr_curr'] = $this->_tables[$param['num']]['thead']['tr'][0];
+                    $this->_tables[$param['num']]['td_curr'] = 0;
                     $this->_parsePos = 0;
-                    $this->parsingHtml->code = HTML2PDF::$_tables[$param['num']]['thead']['code'];
+                    $this->parsingHtml->code = $this->_tables[$param['num']]['thead']['code'];
                     $this->_isInThead = true;
                     $this->_makeHTMLcode();
                     $this->_isInThead = false;
 
                     $this->_parsePos =     $oldParsePos;
                     $this->parsingHtml->code = $oldParseCode;
-                    HTML2PDF::$_tables[$param['num']]['tr_curr'] = $tmpTR;
-                    HTML2PDF::$_tables[$param['num']]['td_curr'] = $tmpTD;
-                    HTML2PDF::$_tables[$param['num']]['new_page'] = true;
+                    $this->_tables[$param['num']]['tr_curr'] = $tmpTR;
+                    $this->_tables[$param['num']]['td_curr'] = $tmpTD;
+                    $this->_tables[$param['num']]['new_page'] = true;
                 }
             // else (in a sub HTML)
             } else {
                 // prepare it
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1] = array();
-                if (!isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']]))
-                    HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']] = array();
-
-                HTML2PDF::$_tables[$param['num']]['corr_x']=0;
-                while(isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']]))
-                    HTML2PDF::$_tables[$param['num']]['corr_x']++;
+                $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1] = array();
+                if (!isset($this->_tables[$param['num']]['corr'][$this->_tables[$param['num']]['corr_y']]))
+                    $this->_tables[$param['num']]['corr'][$this->_tables[$param['num']]['corr_y']] = array();
+
+                $this->_tables[$param['num']]['corr_x']=0;
+                while(isset($this->_tables[$param['num']]['corr'][$this->_tables[$param['num']]['corr_y']][$this->_tables[$param['num']]['corr_x']]))
+                    $this->_tables[$param['num']]['corr_x']++;
             }
 
             return true;
@@ -5247,18 +5260,18 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
                 // Y of the current line
                 $ty=null;
-                for ($ii=0; $ii<count(HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1]); $ii++) {
-                    if (HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['rowspan']==1) {
-                        $ty = HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][$ii]['h'];
+                for ($ii=0; $ii<count($this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1]); $ii++) {
+                    if ($this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$ii]['rowspan']==1) {
+                        $ty = $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$ii]['h'];
                     }
                 }
 
                 // new position
-                HTML2PDF::$_tables[$param['num']]['td_x'] = HTML2PDF::$_tables[$param['num']]['curr_x']+HTML2PDF::$_tables[$param['num']]['marge']['l'];
-                HTML2PDF::$_tables[$param['num']]['td_y']+= $ty;
-                HTML2PDF::$_tables[$param['num']]['new_page'] = false;
+                $this->_tables[$param['num']]['td_x'] = $this->_tables[$param['num']]['curr_x']+$this->_tables[$param['num']]['marge']['l'];
+                $this->_tables[$param['num']]['td_y']+= $ty;
+                $this->_tables[$param['num']]['new_page'] = false;
             } else {
-                HTML2PDF::$_tables[$param['num']]['corr_y']++;
+                $this->_tables[$param['num']]['corr_y']++;
             }
 
             return true;
@@ -5277,8 +5290,8 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             $this->_maxH = 0;
 
-            $param['cellpadding'] = HTML2PDF::$_tables[$param['num']]['cellpadding'].'mm';
-            $param['cellspacing'] = HTML2PDF::$_tables[$param['num']]['cellspacing'].'mm';
+            $param['cellpadding'] = $this->_tables[$param['num']]['cellpadding'].'mm';
+            $param['cellspacing'] = $this->_tables[$param['num']]['cellspacing'].'mm';
 
             // specific style for LI
             if ($other=='li') {
@@ -5296,8 +5309,8 @@ if (!defined('__CLASS_HTML2PDF__')) {
             }
 
             // get the properties of the TD
-            $x = HTML2PDF::$_tables[$param['num']]['td_curr'];
-            $y = HTML2PDF::$_tables[$param['num']]['tr_curr']-1;
+            $x = $this->_tables[$param['num']]['td_curr'];
+            $y = $this->_tables[$param['num']]['tr_curr']-1;
             $colspan = isset($param['colspan']) ? $param['colspan'] : 1;
             $rowspan = isset($param['rowspan']) ? $param['rowspan'] : 1;
 
@@ -5307,18 +5320,18 @@ if (!defined('__CLASS_HTML2PDF__')) {
             // specific traitment for TD and TH
             if (in_array($other, array('td', 'th'))) {
                 // id of the column
-                $numCol = isset(HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['Xr']) ? HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['Xr'] : HTML2PDF::$_tables[$param['num']]['corr_x'];
+                $numCol = isset($this->_tables[$param['num']]['cases'][$y][$x]['Xr']) ? $this->_tables[$param['num']]['cases'][$y][$x]['Xr'] : $this->_tables[$param['num']]['corr_x'];
 
                 // we get the properties of the COL tag, if exist
-                if (isset(HTML2PDF::$_tables[$param['num']]['cols'][$numCol])) {
+                if (isset($this->_tables[$param['num']]['cols'][$numCol])) {
 
-                    $colParam = HTML2PDF::$_tables[$param['num']]['cols'][$numCol];
+                    $colParam = $this->_tables[$param['num']]['cols'][$numCol];
 
                     // for colspans => we get all the neede widths
                     $colParam['style']['width'] = array();
                     for ($k=0; $k<$colspan; $k++) {
-                        if (isset(HTML2PDF::$_tables[$param['num']]['cols'][$numCol+$k]['style']['width'])) {
-                            $colParam['style']['width'][] = HTML2PDF::$_tables[$param['num']]['cols'][$numCol+$k]['style']['width'];
+                        if (isset($this->_tables[$param['num']]['cols'][$numCol+$k]['style']['width'])) {
+                            $colParam['style']['width'][] = $this->_tables[$param['num']]['cols'][$numCol+$k]['style']['width'];
                         }
                     }
 
@@ -5366,12 +5379,12 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 if ($old && ($old['color'] || $old['image']))
                     $legacy['background'] = $old;
 
-                if (HTML2PDF::$_tables[$param['num']]['border']) {
+                if ($this->_tables[$param['num']]['border']) {
                     $legacy['border'] = array();
-                    $legacy['border']['l'] = HTML2PDF::$_tables[$param['num']]['border'];
-                    $legacy['border']['t'] = HTML2PDF::$_tables[$param['num']]['border'];
-                    $legacy['border']['r'] = HTML2PDF::$_tables[$param['num']]['border'];
-                    $legacy['border']['b'] = HTML2PDF::$_tables[$param['num']]['border'];
+                    $legacy['border']['l'] = $this->_tables[$param['num']]['border'];
+                    $legacy['border']['t'] = $this->_tables[$param['num']]['border'];
+                    $legacy['border']['r'] = $this->_tables[$param['num']]['border'];
+                    $legacy['border']['b'] = $this->_tables[$param['num']]['border'];
                 }
             }
             $return = $this->parsingCss->analyse($other, $param, $legacy);
@@ -5387,14 +5400,14 @@ if (!defined('__CLASS_HTML2PDF__')) {
             if ($collapse) {
                 if (!$this->_subPart) {
                     if (
-                        (HTML2PDF::$_tables[$param['num']]['tr_curr']>1 && !HTML2PDF::$_tables[$param['num']]['new_page']) ||
-                        (!$this->_isInThead && count(HTML2PDF::$_tables[$param['num']]['thead']['code']))
+                        ($this->_tables[$param['num']]['tr_curr']>1 && !$this->_tables[$param['num']]['new_page']) ||
+                        (!$this->_isInThead && count($this->_tables[$param['num']]['thead']['code']))
                     ) {
                         $this->parsingCss->value['border']['t'] = $this->parsingCss->readBorder('none');
                     }
                 }
 
-                if (HTML2PDF::$_tables[$param['num']]['td_curr']>0) {
+                if ($this->_tables[$param['num']]['td_curr']>0) {
                     if (!$return) $this->parsingCss->value['width']+= $this->parsingCss->value['border']['l']['width'];
                     $this->parsingCss->value['border']['l'] = $this->parsingCss->readBorder('none');
                 }
@@ -5402,35 +5415,35 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // margins of the table
             $marge = array();
-            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
-            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
-            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
-            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
+            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
+            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
+            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
+            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
 
             // if we are in a sub HTML
             if ($this->_subPart) {
                 // new position in the table
-                HTML2PDF::$_tables[$param['num']]['td_curr']++;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x] = array();
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['w'] = 0;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['h'] = 0;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['dw'] = 0;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['colspan'] = $colspan;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['rowspan'] = $rowspan;
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['Xr'] = HTML2PDF::$_tables[$param['num']]['corr_x'];
-                HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['Yr'] = HTML2PDF::$_tables[$param['num']]['corr_y'];
+                $this->_tables[$param['num']]['td_curr']++;
+                $this->_tables[$param['num']]['cases'][$y][$x] = array();
+                $this->_tables[$param['num']]['cases'][$y][$x]['w'] = 0;
+                $this->_tables[$param['num']]['cases'][$y][$x]['h'] = 0;
+                $this->_tables[$param['num']]['cases'][$y][$x]['dw'] = 0;
+                $this->_tables[$param['num']]['cases'][$y][$x]['colspan'] = $colspan;
+                $this->_tables[$param['num']]['cases'][$y][$x]['rowspan'] = $rowspan;
+                $this->_tables[$param['num']]['cases'][$y][$x]['Xr'] = $this->_tables[$param['num']]['corr_x'];
+                $this->_tables[$param['num']]['cases'][$y][$x]['Yr'] = $this->_tables[$param['num']]['corr_y'];
 
                 // prepare the mapping for rowspan and colspan
                 for ($j=0; $j<$rowspan; $j++) {
                     for ($i=0; $i<$colspan; $i++) {
-                        HTML2PDF::$_tables[$param['num']]['corr']
-                            [HTML2PDF::$_tables[$param['num']]['corr_y']+$j]
-                            [HTML2PDF::$_tables[$param['num']]['corr_x']+$i] = ($i+$j>0) ? '' : array($x,$y,$colspan,$rowspan);
+                        $this->_tables[$param['num']]['corr']
+                            [$this->_tables[$param['num']]['corr_y']+$j]
+                            [$this->_tables[$param['num']]['corr_x']+$i] = ($i+$j>0) ? '' : array($x,$y,$colspan,$rowspan);
                     }
                 }
-                HTML2PDF::$_tables[$param['num']]['corr_x']+= $colspan;
-                while (isset(HTML2PDF::$_tables[$param['num']]['corr'][HTML2PDF::$_tables[$param['num']]['corr_y']][HTML2PDF::$_tables[$param['num']]['corr_x']])) {
-                    HTML2PDF::$_tables[$param['num']]['corr_x']++;
+                $this->_tables[$param['num']]['corr_x']+= $colspan;
+                while (isset($this->_tables[$param['num']]['corr'][$this->_tables[$param['num']]['corr_y']][$this->_tables[$param['num']]['corr_x']])) {
+                    $this->_tables[$param['num']]['corr_x']++;
                 }
 
                 // extract the content of the TD, and calculate his size
@@ -5441,31 +5454,31 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 $this->_tempPos+= count($level);
             } else {
                 // new position in the table
-                HTML2PDF::$_tables[$param['num']]['td_curr']++;
-                HTML2PDF::$_tables[$param['num']]['td_x']+= HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['dw'];
+                $this->_tables[$param['num']]['td_curr']++;
+                $this->_tables[$param['num']]['td_x']+= $this->_tables[$param['num']]['cases'][$y][$x]['dw'];
 
                 // borders and background of the TD
                 $this->_drawRectangle(
-                    HTML2PDF::$_tables[$param['num']]['td_x'],
-                    HTML2PDF::$_tables[$param['num']]['td_y'],
-                    HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['w'],
-                    HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['h'],
+                    $this->_tables[$param['num']]['td_x'],
+                    $this->_tables[$param['num']]['td_y'],
+                    $this->_tables[$param['num']]['cases'][$y][$x]['w'],
+                    $this->_tables[$param['num']]['cases'][$y][$x]['h'],
                     $this->parsingCss->value['border'],
                     $this->parsingCss->value['padding'],
-                    HTML2PDF::$_tables[$param['num']]['cellspacing']*0.5,
+                    $this->_tables[$param['num']]['cellspacing']*0.5,
                     $this->parsingCss->value['background']
                 );
 
-                $this->parsingCss->value['width'] = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['w'] - $marge['l'] - $marge['r'];
+                $this->parsingCss->value['width'] = $this->_tables[$param['num']]['cases'][$y][$x]['w'] - $marge['l'] - $marge['r'];
 
                 // marges = size of the TD
-                $mL = HTML2PDF::$_tables[$param['num']]['td_x']+$marge['l'];
+                $mL = $this->_tables[$param['num']]['td_x']+$marge['l'];
                 $mR = $this->pdf->getW() - $mL - $this->parsingCss->value['width'];
                 $this->_saveMargin($mL, 0, $mR);
 
                 // position of the content, from vertical-align
-                $hCorr = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['h'];
-                $hReel = HTML2PDF::$_tables[$param['num']]['cases'][$y][$x]['real_h'];
+                $hCorr = $this->_tables[$param['num']]['cases'][$y][$x]['h'];
+                $hReel = $this->_tables[$param['num']]['cases'][$y][$x]['real_h'];
                 switch($this->parsingCss->value['vertical-align'])
                 {
                     case 'bottom':
@@ -5483,8 +5496,8 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 }
 
                 //  position of the content
-                $x = HTML2PDF::$_tables[$param['num']]['td_x']+$marge['l'];
-                $y = HTML2PDF::$_tables[$param['num']]['td_y']+$marge['t']+$yCorr;
+                $x = $this->_tables[$param['num']]['td_x']+$marge['l'];
+                $y = $this->_tables[$param['num']]['td_y']+$marge['t']+$yCorr;
                 $this->pdf->setXY($x, $y);
                 $this->_setNewPositionForNewLine();
             }
@@ -5507,10 +5520,10 @@ if (!defined('__CLASS_HTML2PDF__')) {
 
             // get the margins
             $marge = array();
-            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
-            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
-            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
-            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*HTML2PDF::$_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
+            $marge['t'] = $this->parsingCss->value['padding']['t']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['t']['width'];
+            $marge['r'] = $this->parsingCss->value['padding']['r']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['r']['width'];
+            $marge['b'] = $this->parsingCss->value['padding']['b']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['b']['width'];
+            $marge['l'] = $this->parsingCss->value['padding']['l']+0.5*$this->_tables[$param['num']]['cellspacing']+$this->parsingCss->value['border']['l']['width'];
             $marge['t']+= 0.001;
             $marge['r']+= 0.001;
             $marge['b']+= 0.001;
@@ -5533,19 +5546,19 @@ if (!defined('__CLASS_HTML2PDF__')) {
                 $h2 = $this->parsingCss->value['height'] + $marge['t'] + $marge['b'];
 
                 // final size of the TD
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['w'] = max(array($w0, $w2));
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['h'] = max(array($h0, $h2));
+                $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$this->_tables[$param['num']]['td_curr']-1]['w'] = max(array($w0, $w2));
+                $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$this->_tables[$param['num']]['td_curr']-1]['h'] = max(array($h0, $h2));
 
                 // real position of the content
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['real_w'] = $w0;
-                HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['real_h'] = $h0;
+                $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$this->_tables[$param['num']]['td_curr']-1]['real_w'] = $w0;
+                $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$this->_tables[$param['num']]['td_curr']-1]['real_h'] = $h0;
 
                 // destroy the sub HTML
                 $this->_destroySubHTML($this->_subHtml);
             } else {
                 $this->_loadMargin();
 
-                HTML2PDF::$_tables[$param['num']]['td_x']+= HTML2PDF::$_tables[$param['num']]['cases'][HTML2PDF::$_tables[$param['num']]['tr_curr']-1][HTML2PDF::$_tables[$param['num']]['td_curr']-1]['w'];
+                $this->_tables[$param['num']]['td_x']+= $this->_tables[$param['num']]['cases'][$this->_tables[$param['num']]['tr_curr']-1][$this->_tables[$param['num']]['td_curr']-1]['w'];
             }
 
             $this->parsingCss->load();
@@ -6485,4 +6498,4 @@ if (!defined('__CLASS_HTML2PDF__')) {
         }
 
     }
-}
\ No newline at end of file
+}