Development

Changeset 17131

You must first sign up to be able to contribute.

Changeset 17131

Show
Ignore:
Timestamp:
04/08/09 12:32:51 (4 years ago)
Author:
COil
Message:

[sfTCPDFPlugin]

  • updated for symfony 1.2 with its specific config handler
  • updated demos
  • update for new 4.5.036 TCPDF version
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfTCPDFPlugin/branches/1.2/README

    r17104 r17131  
    1 = sfTCPDFPlugin = 
     1sfTCPDFPlugin 
     2------------- 
    23 
    3 `sfTCPDFPlugin` class provides abstraction for the [http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf TCPDF library]
     4**sfTCPDFPlugin** class provides abstraction for the [TCPDF library](http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf)
    45The main interest of this FPDF extension resides in the fact that it handles any UTF8 strings. 
    56 
    6 == Installation == 
     7Installation 
     8============ 
    79 
    8   * Install the plugin 
     10 * Install the plugin 
    911 
    10   {{{ 
    11     symfony plugin-install http://plugins.symfony-project.com/sfTCPDFPlugin 
    12   }}} 
     12        $ symfony plugin:install sfTCPDFPlugin 
    1313 
    14   or download it and unzip in your /plugins directory 
     14  (or download it and unzip in your /plugins directory) 
    1515 
    16   * Download the [http://sourceforge.net/project/showfiles.php?group_id=128076 TCPDF library] 
     16 * Download the [TCPDF library](http://sourceforge.net/project/showfiles.php?group_id=128076&package_id=140403) 
    1717 
    18   * Unzip it inside the '''/plugins/sfTCPDFplugin/lib''' folder 
     18 * Unzip it inside the `/plugins/sfTCPDFplugin/lib` folder, at this point, you  
     19   should have a `tcpdf` folder in `/plugins/sfTCPDFPlugin/lib` 
    1920 
    20 At this point, you should have a '''tcpdf''' folder in '''/plugins/sfTCPDFPlugin/lib''' 
     21 * Publish the assets of the plugin (this is only usefull if you want to test the demos included in the plugin) 
     22   
     23        $ symfony plugin:publish-assets    
     24       
     25 * Clear you cache 
    2126 
    22   * Copy the files in '''/web/sfTCPDFPlugin''' directly to your application '''/web''' directory 
     27        $ symfony cc 
    2328 
    24   * Clear you cache 
     29Configuration 
     30============= 
    2531 
    26   {{{ 
    27     symfony cc 
    28   }}} 
     32 * Set '''sf_tcpdf_dir''' in your '''config.php''' application if TCPDF library 
     33   is not inside the '''/plugins/sfTCPDFplugin/lib''' folder  
     34  (check '''/plugins/sfTCPDFPlugin/config/config.php''') 
    2935 
    30 == Configuration == 
     36 * If you want to have custom settings for each generated PDF  
     37   check '''/plugins/sfTCPDFPlugin/config/config.php''' and '''tcpdf/config/tcpdf_config.php'''). 
    3138 
    32   * Set '''sf_tcpdf_dir''' in your '''config.php''' application if TCPDF library is not inside the '''/plugins/sfTCPDFplugin/lib''' folder (check '''/plugins/sfTCPDFPlugin/config/config.php''') 
     39 * If you want to run the tests, enable the '''sfTCPDF''' module in your  
     40   `settings.yml` file, then call `sfTCPDF/test` or `sfTCPDF/test2` 
    3341 
    34   * If you want to have custom settings for each generated PDF check '''/plugins/sfTCPDFPlugin/config/config.php''' and '''tcpdf/config/tcpdf_config.php'''). 
     42Usage 
     43===== 
    3544 
    36   * If you want to run the tests, enable the '''sfTCPDF''' module in your '''settings.yml''' file, then call '''sfTCPDF/test''' or '''sfTCPDF/test2''' 
     45 * 1 - Hello World test (sfTCPDF/test) 
    3746 
    38 == Usage == 
     47 * 2 - Full test (sfTCPDF/test2, check '''/plugins/sfTCPDFPlugin/actions/actions.php''') 
    3948 
    40   * 1 - Hello World test (sfTCPDF/test) 
     49Demo 
     50==== 
    4151 
    42   {{{ 
    43   /** 
    44    * Hello world test 
    45    */ 
    46   public function executeTest() 
    47   { 
    48     // pdf object 
    49     $pdf = new sfTCPDF(); 
     52 * You can find the [http://snippets.coilblog.com/sfTCPDF/test hello world] and the [http://snippets.coilblog.com/sfTCPDF/test2 full test] on my blog. 
    5053 
    51     // settings 
    52     $pdf->SetFont("FreeSerif", "", 12); 
    53     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); 
    54     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); 
    55     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); 
    56     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); 
    57     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); 
    58     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); 
     54Notes 
     55===== 
    5956 
    60     // init pdf doc 
    61     $pdf->AliasNbPages(); 
    62     $pdf->AddPage(); 
    63     $pdf->Cell(80, 10, "Hello World !!! & é € U û いろは"); 
     57 * I seems there are problems with the TCPDF class when using PHP 5.1.x 
    6458 
    65     // output 
    66     $pdf->Output(); 
    67     return sfView::NONE; 
    68   } 
    69   }}} 
     59TODO 
     60==== 
    7061 
    71   * 2 - Full test (sfTCPDF/test2, check '''/plugins/sfTCPDFPlugin/actions/actions.php''') 
     62 * symfony 1.2 version of plugin 
    7263 
    73 == Changelog == 
     64Support 
     65======= 
    7466 
    75 === 1.5.3 === 
     67 * Please report bugs on the symfony TRAC 
     68 * Feeback on the symfony users mailing list  
    7669 
     70See you. COil :) 
     71 
     72Changelog 
     73========= 
     74 
     75    [note] 
     76    Check the changelog TAB to see changelogs of >= 1.6.0 versions  
     77 
     78 * 1.5.3 
    7779  * Initial version for TCPDF 1.53 TC030 
    7880 
    79 === 2007-06-04 | 1.5.4 Stable === 
    80  
     81 * 2007-06-04 | 1.5.4 Stable 
    8182  * Fix Full test (sfTCPDF/test2) 
    8283  * Customize Plugin is now possible 
    8384 
    84 === 2008-01-21 | 1.5.5 Stable === 
     85 * 2008-01-21 | 1.5.5 Stable 
    8586  * Change the constant FPDF_FONTPATH to K_PATH_FONTS for work with the last version of TCPDF (Garfield-fr) 
    86    
    87 == Demo == 
    88  
    89   * You can find the [http://snippets.coilblog.com/sfTCPDF/test hello world] and the [http://snippets.coilblog.com/sfTCPDF/test2 full test] on my blog. 
    90  
    91 == Notes == 
    92  
    93   * I seems there are problems with the TCPDF class when using PHP 5.1.x 
    94   * I am searching beta testers to get some feeback. (C0il on IRC on, comment on my blog or whatever you want !) 
    95  
    96 === TODO === 
    97  
    98 === Plugin support === 
    99  
    100   * Please report bugs/feeback in the [http://www.symfony-project.com/forum/index.php/f/12/ plugin section] of the forum 
    101   * You can find also contact me on IRC or by email (check README file) 
    102  
    103 COil :) 
  • plugins/sfTCPDFPlugin/branches/1.2/config/pdf_configs.yml

    r17108 r17131  
    1 config1: 
    2   K_PATH_MAIN: kiokoko 
    3   K_PATH_URL: dff 
    4   K_PATH_FONTS: fdsf 
    5   K_PATH_CACHE: sdfsd 
    6   K_PATH_URL_CACHE: fsdfsd 
    7   K_PATH_IMAGES: gdfg 
    8   K_BLANK_IMAGE: dgdfgdf 
     1# Main config 
     2default: 
     3  # Be carefull the order of these configuration keys should not be modified. 
     4  # More more informations about these parameters check the TCPDF documentation 
    95 
    10 # Other configs 
     6  # Disable default TCPDF default config 
     7  K_TCPDF_EXTERNAL_CONFIG: true 
     8   
     9  # Auto-detected parameters (leave empty for auto-detection) ################## 
     10  # Installation path (/var/www/tcpdf/)  
     11  K_PATH_MAIN:  
     12  K_PATH_URL:  
     13  K_PATH_FONTS:  
     14  K_PATH_CACHE:  
     15  K_PATH_URL_CACHE:  
     16  K_PATH_IMAGES:  
     17  K_BLANK_IMAGE: 
    1118 
    12 config2: 
    13 # ... 
     19  # Other parameters  ########################################################## 
     20  # page format 
     21  PDF_PAGE_FORMAT: "A4" 
     22  # page orientation (P=portrait, L=landscape) 
     23  PDF_PAGE_ORIENTATION: "P" 
     24  # document creator 
     25  PDF_CREATOR: "TCPDF" 
     26  # document author 
     27  PDF_AUTHOR: "TCPDF" 
     28  # header title 
     29  PDF_HEADER_TITLE: "TCPDF Example" 
     30  # header description string 
     31  PDF_HEADER_STRING: "by Nicola Asuni - Tecnick.com\nwww.tcpdf.org - symfony plugin by Vernet Loïc (Aka COil) - http://www.symfony-project.org/plugins/sfTCPDFPlugin" 
     32  # image logo 
     33  PDF_HEADER_LOGO: "tcpdf_logo.jpg" 
     34  # header logo image width [mm] 
     35  PDF_HEADER_LOGO_WIDTH: 30 
     36  # document unit of measure [pt=point, mm=millimeter, cm=centimeter, in=inch] 
     37  PDF_UNIT: "mm" 
     38  # header margin 
     39  PDF_MARGIN_HEADER: "5" 
     40  # footer margin 
     41  PDF_MARGIN_FOOTER: "10" 
     42  # top margin 
     43  PDF_MARGIN_TOP: "27" 
     44  # bottom margin 
     45  PDF_MARGIN_BOTTOM: "25" 
     46  # left margin 
     47  PDF_MARGIN_LEFT: "15" 
     48  # right margin 
     49  PDF_MARGIN_RIGHT: "15" 
     50  # default main font name 
     51  PDF_FONT_NAME_MAIN: "helvetica" 
     52  # default main font size 
     53  PDF_FONT_SIZE_MAIN: "10" 
     54  # default data font name 
     55  PDF_FONT_NAME_DATA: "helvetica" 
     56  # default data font size 
     57  PDF_FONT_SIZE_DATA: "8" 
     58  # default monospaced font name 
     59  PDF_FONT_MONOSPACED: "courier" 
     60  # Ratio used to scale the images 
     61  PDF_IMAGE_SCALE_RATIO: "4" 
     62  # magnification factor for titles 
     63  HEAD_MAGNIFICATION: "1.1" 
     64  # height of cell repect font height 
     65  K_CELL_HEIGHT_RATIO: "1.25" 
     66  # title magnification respect main font size 
     67  K_TITLE_MAGNIFICATION: "1.3" 
     68  # reduction factor for small font 
     69  K_SMALL_RATIO: "2/3" 
     70 
     71# Specific configs (copy this file in your application config directory to ovveride it) 
     72my_config: 
     73  K_TCPDF_EXTERNAL_CONFIG: true 
     74  K_PATH_MAIN: /var/www/my-symfony-project/plugins/sfTCPDFPlugin/tcpdf/ 
     75  K_PATH_URL: http://dev.my-symfony-project/  
     76  K_PATH_FONTS: /var/www/my-symfony-project/plugins/sfTCPDFPlugin/tcpdf/fonts 
     77  K_PATH_CACHE: /var/www/my-symfony-project/plugins/sfTCPDFPlugin/tcpdf/cache 
     78  K_PATH_URL_CACHE: http://dev.my-symfony-project/cache 
     79  K_PATH_IMAGES: /var/www/my-symfony-project/plugins/sfTCPDFPlugin/tcpdf/images 
     80  K_BLANK_IMAGE: /var/www/my-symfony-project/plugins/sfTCPDFPlugin/tcpdf/images/_blank.png 
     81 
     82  # ... copy paste from defaulf config. 
  • plugins/sfTCPDFPlugin/branches/1.2/lib

    • Property svn:ignore set to
      tcpdf
  • plugins/sfTCPDFPlugin/branches/1.2/lib/sfTCPDFPluginConfigHandler.class.php

    r17108 r17131  
    2929  public function execute($configFiles) 
    3030  { 
    31     $config = self::getConfiguration($configFiles); 
     31    $config = self::parseYamls($configFiles); 
    3232 
    3333    // compile data 
     
    4040 
    4141    $retval = sprintf($retval, __CLASS__, date('Y/m/d H:i:s'), var_export($config, true)); 
    42  
     42     
    4343    return $retval; 
    4444  } 
    45  
    46   /** 
    47    * Get the plugin configuration. 
    48    *  
    49    * @see sfConfigHandler 
    50    */ 
    51   static public function getConfiguration(array $configFiles) 
    52   { 
    53     return self::parseYamls($configFiles); 
    54   }   
    5545 
    5646  /** 
     
    6050   * @since  6 august 08 
    6151   */   
    62   public static function load(
     52  public static function load($config_key
    6353  { 
    6454    $config = sfConfig::get(self::$namespace); 
     
    6656    if (!$config) 
    6757    { 
    68       $config = self::checkAndGet(); 
     58      $config = self::checkAndGetConfig($config_key); 
    6959      sfConfig::set(self::$namespace, $config); 
    7060    } 
     61 
     62    return $config; 
     63  } 
     64 
     65  /** 
     66   * Generate the config file if not present and return a configuration for 
     67   * a given key or return the default configuration. 
     68   *  
     69   * @author COil 
     70   * @since  V1.6.0 - 7 apr 09 
     71   *  
     72   * @param $config String Config key 
     73   *  
     74   * @return Array 
     75   */ 
     76  public static function checkAndGetConfig($config = null) 
     77  { 
     78    $configs = include(sfContext::getInstance()->getConfigCache()->checkConfig(self::$config_file_pattern)); 
     79 
     80    return $config && isset($configs[$config]) ? $configs[$config] : $configs['default']; 
     81  } 
     82 
     83  /** 
     84   * Create all TCPDF specific constants. 
     85   *  
     86   * @author COil 
     87   * @since  V1.6.0 - 7 apr 09 
     88   * 
     89   * @return Array 
     90   */ 
     91  public static function applyTCPDFConfig($config) 
     92  { 
     93    if (!sfConfig::get('sfTCPDFPlugin_dir')) 
     94    { 
     95      sfConfig::set('sfTCPDFPlugin_dir', sfConfig::get('sf_root_dir'). DIRECTORY_SEPARATOR. 'plugins'. DIRECTORY_SEPARATOR. 'sfTCPDFPlugin'. DIRECTORY_SEPARATOR. 'lib'. DIRECTORY_SEPARATOR. 'tcpdf'. DIRECTORY_SEPARATOR); 
     96    } 
     97 
     98    foreach ($config as $key => $value) 
     99    { 
     100      switch ($key) 
     101      { 
     102        case 'K_TCPDF_EXTERNAL_CONFIG': 
     103          if ($value) 
     104          { 
     105            define('K_TCPDF_EXTERNAL_CONFIG', true);  
     106          } 
     107          break; 
     108           
     109        case 'K_PATH_MAIN': 
     110          if (empty($value)) 
     111          { 
     112            $value = sfConfig::get('sfTCPDFPlugin_dir'); 
     113          } 
     114 
     115          define('K_PATH_MAIN', $value); 
     116          break; 
     117           
     118        case 'K_PATH_URL': 
     119          if (empty($value) && sfContext::hasInstance()) 
     120          { 
     121            $request = sfContext::getInstance()->getRequest();  
     122            $value = $request->getUriPrefix(). '/'; 
     123          } 
     124 
     125          define('K_PATH_URL', $value); 
     126          break; 
     127           
     128        case 'K_PATH_FONTS': 
     129          if (empty($value)) 
     130          { 
     131            $value = K_PATH_MAIN.'fonts/'; 
     132          } 
     133 
     134          define ('K_PATH_FONTS', $value); 
     135          break; 
     136           
     137        case 'K_PATH_CACHE': 
     138          if (empty($value)) 
     139          { 
     140            $value = K_PATH_MAIN.'cache/'; 
     141          } 
     142 
     143          define ('K_PATH_CACHE', $value); 
     144          break; 
     145 
     146        case 'K_PATH_URL_CACHE': 
     147          if (empty($value)) 
     148          { 
     149            $value = K_PATH_URL. 'cache/'; 
     150          } 
     151 
     152          define ('K_PATH_URL_CACHE', $value); 
     153          break; 
     154           
     155        case 'K_PATH_IMAGES': 
     156          if (empty($value)) 
     157          { 
     158            $value = K_PATH_MAIN. 'images/'; 
     159          } 
     160 
     161          define ('K_PATH_IMAGES', $value); 
     162          break; 
     163           
     164        case 'K_BLANK_IMAGE': 
     165          if (empty($value)) 
     166          { 
     167            $value = K_PATH_MAIN. 'images/'; 
     168          } 
     169 
     170          define ('K_BLANK_IMAGE', K_PATH_IMAGES.'_blank.png'); 
     171          break; 
     172           
     173        default: 
     174 
     175          // Only define a constant if it's TCPDF known constant 
     176          if (in_array($key, self::getTCPDFConstantsList())) 
     177          { 
     178            define ($key, $value);  
     179          } 
     180           
     181          break; 
     182      } 
     183    } 
     184  } 
     185 
     186  /** 
     187   * Retrieve and load a TCPDF configuration. 
     188   *   
     189   * @param $config String Name of config to load ("default" by default) 
     190   */ 
     191  public static function loadConfig($config_key = null) 
     192  { 
     193    $config = self::checkAndGetConfig($config_key); 
     194    self::applyTCPDFConfig($config); 
     195    sfConfig::set(self::$namespace, $config); 
    71196     
    72197    return $config; 
    73198  } 
    74  
    75   /** 
    76    * Generate the config file if not present and return it. 
    77    *  
    78    * @author COil 
    79    * @since  V1.6.0 - 7 apr 09 
    80    *  
    81    * @return Array 
    82    */ 
    83   public static function checkAndGet() 
    84   { 
    85     $config = include(sfContext::getInstance()->getConfigCache()->checkConfig(self::$config_file_pattern)); 
    86  
    87     return $config; 
    88   } 
    89  
    90   /** 
    91    * Return all the configuration structure. 
    92    *  
    93    * @author COil 
    94    * @since  V1.6.0 - 7 apr 09  
    95    * 
    96    * @return Array 
    97    */ 
    98   public static function getAll() 
    99   { 
    100     return self::load(); 
     199   
     200  /** 
     201   * Include a TCPDF language file, if the language file the culture is not founf 
     202   * then the defaut language is included (en) 
     203   *   
     204   * @param $culture Language to inlcude  
     205   */ 
     206  public static function includeLangFile($culture) 
     207  { 
     208    // Supported langs by TCPDF 
     209    $culture_to_lang_file = array( 
     210      'en'  => 'eng', 
     211      'it'  => 'ita'  
     212    ); 
     213 
     214    $lang_file = in_array($culture, array_keys($culture_to_lang_file)) 
     215      ? $culture_to_lang_file[$culture] 
     216      : $culture_to_lang_file['en'] 
     217    ; 
     218 
     219    require_once(K_PATH_MAIN. 'config/lang/'. $lang_file. '.php');  
     220  } 
     221   
     222  /** 
     223   * Retrieve the list of know TCPDF constant. 
     224   *   
     225   * @return Array 
     226   */ 
     227  public static function getTCPDFConstantsList() 
     228  { 
     229    return array( 
     230      'K_TCPDF_EXTERNAL_CONFIG', 
     231      'K_PATH_MAIN',  
     232      'K_PATH_URL',  
     233      'K_PATH_FONTS',  
     234      'K_PATH_CACHE',  
     235      'K_PATH_URL_CACHE',  
     236      'K_PATH_IMAGES',  
     237      'K_BLANK_IMAGE',  
     238      'PDF_PAGE_FORMAT', 
     239      'PDF_PAGE_ORIENTATION', 
     240      'PDF_CREATOR', 
     241      'PDF_AUTHOR', 
     242      'PDF_HEADER_TITLE', 
     243      'PDF_HEADER_STRING', 
     244      'PDF_HEADER_LOGO', 
     245      'PDF_HEADER_LOGO_WIDTH', 
     246      'PDF_UNIT', 
     247      'PDF_MARGIN_HEADER', 
     248      'PDF_MARGIN_FOOTER', 
     249      'PDF_MARGIN_TOP', 
     250      'PDF_MARGIN_BOTTOM', 
     251      'PDF_MARGIN_LEFT', 
     252      'PDF_MARGIN_RIGHT', 
     253      'PDF_FONT_NAME_MAIN', 
     254      'PDF_FONT_SIZE_MAIN', 
     255      'PDF_FONT_NAME_DATA', 
     256      'PDF_FONT_SIZE_DATA', 
     257      'PDF_FONT_MONOSPACED', 
     258      'PDF_IMAGE_SCALE_RATIO', 
     259      'HEAD_MAGNIFICATION', 
     260      'K_CELL_HEIGHT_RATIO', 
     261      'K_TITLE_MAGNIFICATION', 
     262      'K_SMALL_RATIO' 
     263    ); 
    101264  } 
    102265} 
  • plugins/sfTCPDFPlugin/branches/1.2/modules/sfTCPDF/lib/BasesfTCPDFActions.class.php

    r17108 r17131  
    22 
    33/** 
    4  * base sfTCPDF actions. 
     4 * Base sfTCPDF actions for demos. 
    55 * 
    66 * @package    sfTCPDFPlugin 
    77 * @author     Vernet Loïc aka COil <qrf_coil@yahoo.fr> 
    8  * @since      16 march 2007 
     8 * @since      1.6.0 - 16 march 2007 
    99 */ 
    1010 
    1111class BasesfTCPDFActions extends sfActions 
    1212{ 
    13  
    1413  /** 
    15    * Hello world test 
     14   * Hello world test. 
    1615   */ 
    1716  public function executeTest() 
    1817  { 
     18    $config = sfTCPDFPluginConfigHandler::loadConfig(); 
     19     
     20    //mzTools::dump($config, '$config', true); 
     21     
    1922    // pdf object 
    2023    $pdf = new sfTCPDF(); 
     
    4043 
    4144  /** 
    42    * Full test 
     45   * Full test. 
    4346   * 
    4447   * It's the test that is bundled in /tcpdf/test_unicode.php 
     
    4649  public function executeTest2() 
    4750  { 
     51    $config = sfTCPDFPluginConfigHandler::loadConfig(); 
     52    sfTCPDFPluginConfigHandler::includeLangFile($this->getUser()->getCulture()); 
    4853 
    49     require_once(sfConfig::get('sf_tcpdf_dir').'/config/lang/eng.php'); 
    50  
    51     $doc_title = "test title"; 
    52     $doc_subject = "test description"; 
     54    $doc_title    = "test title"; 
     55    $doc_subject  = "test description"; 
    5356    $doc_keywords = "test keywords"; 
    54     $htmlcontent = "&lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt;<br /><h1>heading 1</h1><h2>heading 2</h2><h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><h6>heading 6</h6>ordered list:<br /><ol><li><b>bold text</b></li><li><i>italic text</i></li><li><u>underlined text</u></li><li><a href=\"http://www.tecnick.com\">link to http://www.tecnick.com</a></li><li>test break<br />second line<br />third line</li><li><font size=\"+3\">font + 3</font></li><li><small>small text</small></li><li>normal <sub>subscript</sub> <sup>superscript</sup></li></ul><hr />table:<br /><table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr><th>#</th><th>A</th><th>B</th></tr><tr><th>1</th><td bgcolor=\"#cccccc\">A1</td><td>B1</td></tr><tr><th>2</th><td>A2 € &euro; &#8364; &amp; è &egrave; </td><td>B2</td></tr><tr><th>3</th><td>A3</td><td><font color=\"#FF0000\">B3</font></td></tr></table><hr />image:<br /><img src=\"sfTCPDFPlugin/images/logo_example.png\" alt=\"test alt attribute\" width=\"100\" height=\"100\" border=\"0\" />"; 
     57    $htmlcontent = "&lt; € &euro; &#8364; &amp; è &egrave; &copy; &gt;<br /><h1>heading 1</h1><h2>heading 2</h2><h3>heading 3</h3><h4>heading 4</h4><h5>heading 5</h5><h6>heading 6</h6>ordered list:<br /><ol><li><b>bold text</b></li><li><i>italic text</i></li><li><u>underlined text</u></li><li><a href=\"http://www.tecnick.com\">link to http://www.tecnick.com</a></li><li>test break<br />second line<br />third line</li><li><font size=\"+3\">font + 3</font></li><li><small>small text</small></li><li>normal <sub>subscript</sub> <sup>superscript</sup></li></ul><hr />table:<br /><table border=\"1\" cellspacing=\"1\" cellpadding=\"1\"><tr><th>#</th><th>A</th><th>B</th></tr><tr><th>1</th><td bgcolor=\"#cccccc\">A1</td><td>B1</td></tr><tr><th>2</th><td>A2 € &euro; &#8364; &amp; è &egrave; </td><td>B2</td></tr><tr><th>3</th><td>A3</td><td><font color=\"#FF0000\">B3</font></td></tr></table><hr />image:<br /><img src=\"sfTCPDFPlugin/images/logo_example.png\" alt=\"test alt attribute\" width=\"100\" height=\"100\" border=\"0\" />"; 
    5558 
    5659    //create new PDF document (document units are set by default to millimeters) 
     
    6871    //set margins 
    6972    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); 
     73 
    7074    //set auto page breaks 
    7175    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); 
     
    8185    //initialize document 
    8286    $pdf->AliasNbPages(); 
    83  
    8487    $pdf->AddPage(); 
    8588 
     
    103106    $pdf->SetFont("FreeSerif", "", 12); 
    104107 
    105     $utf8text = file_get_contents(sfConfig::get('sf_tcpdf_dir'). "utf8test.txt", false); // get utf-8 text form file 
     108    $utf8text = file_get_contents(K_PATH_CACHE. "utf8test.txt", false); // get utf-8 text form file 
    106109    $pdf->SetFillColor(230, 240, 255, true); 
    107110    $pdf->Write(5,$utf8text, '', 1); 
     
    145148 
    146149    return sfView::NONE; 
    147  
    148150  } 
    149151}