diff --git a/main/admin/legal_add.php b/main/admin/legal_add.php index fb033fffd6..b0fd4652ab 100755 --- a/main/admin/legal_add.php +++ b/main/admin/legal_add.php @@ -122,7 +122,7 @@ if (isset($_POST['language'])) { //$form->addElement('html_editor', 'content', null, null, array('ToolbarSet' => 'Basic', 'Width' => '100%', 'Height' => '250')); $form->addElement('static', $_POST['language']); $form->addElement('hidden', 'language',$_POST['language']); - $form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'simple', 'Width' => '100%', 'Height' => '250')); + $form->add_html_editor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); //$form->addElement('textarea', 'content', get_lang('Content'),array('cols'=>'120','rows'=>'10')); $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); diff --git a/main/admin/settings.php b/main/admin/settings.php index 9ca8b291e2..d8ea29e497 100755 --- a/main/admin/settings.php +++ b/main/admin/settings.php @@ -374,7 +374,7 @@ $action_images['plugins'] = 'plugin.gif'; $action_images['stylesheets'] = 'theme.gif'; $action_images['templates'] = 'template.gif'; $action_images['search'] = 'search.gif'; - +$action_images['editor'] = 'html.png'; // grabbing the categories //$selectcategories = "SELECT DISTINCT category FROM ".$table_settings_current." WHERE category NOT IN ('stylesheets','Plugins')"; diff --git a/main/document/document.inc.php b/main/document/document.inc.php index 01479f5167..24b08a8578 100755 --- a/main/document/document.inc.php +++ b/main/document/document.inc.php @@ -165,6 +165,7 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility if (!$show_as_icon) { //build download link (icon) + $forcedownload_link=($filetype=='folder')?api_get_self().'?'.api_get_cidreq().'&action=downloadfolder&path='.$url_path.$req_gid:api_get_self().'?'.api_get_cidreq().'&action=download&id='.$url_path.$req_gid; //folder download or file download? $forcedownload_icon=($filetype=='folder')?'folder_zip.gif':'filesave.gif'; @@ -220,7 +221,18 @@ function create_document_link($www, $title, $path, $filetype, $size, $visibility if (!$show_as_icon) { - $force_download_html = ($size==0)?'':''.Display::return_icon($forcedownload_icon, get_lang('Download'),array('height'=>'16', 'width' => '16')).''; + if($filetype=="folder") + { + if(api_is_allowed_to_edit() || api_is_platform_admin() || api_get_setting('students_download_folders') == 'true') + { + $force_download_html = ($size==0)?'':''.Display::return_icon($forcedownload_icon, get_lang('Download'),array('height'=>'16', 'width' => '16')).''; + } + } + else + { + $force_download_html = ($size==0)?'':''.Display::return_icon($forcedownload_icon, get_lang('Download'),array('height'=>'16', 'width' => '16')).''; + } + return ''.$title.''.$force_download_html; } else diff --git a/main/document/document.php b/main/document/document.php index 4453a260ea..aa4b4ec7ca 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -144,7 +144,7 @@ $group_member_with_upload_rights = false; if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { //needed for group related stuff - include_once(api_get_path(LIBRARY_PATH) . 'groupmanager.lib.php'); + require_once(api_get_path(LIBRARY_PATH) . 'groupmanager.lib.php'); //get group info $group_properties = GroupManager::get_group_properties($_SESSION['_gid']); $noPHP_SELF=true; @@ -283,9 +283,9 @@ if (isset($_GET['action']) && $_GET['action']=="download") //-------------------------------------------------------------------// //download of an completed folder -if(isset($_GET['action']) && $_GET['action']=="downloadfolder") -{ - include('downloadfolder.inc.php'); +if(isset($_GET['action']) && $_GET['action']=="downloadfolder" && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) +{ + require('downloadfolder.inc.php'); } //-------------------------------------------------------------------// @@ -405,7 +405,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY } } - include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'); + require_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'); //this is needed for the update_db_info function //$dbTable = $_course['dbNameGlu']."document"; $dbTable = Database::get_course_table(TABLE_DOCUMENT); @@ -448,7 +448,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY } } - include_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'); + require_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'); if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir)) { @@ -504,7 +504,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY if(isset($_POST['create_dir']) && $_POST['dirname']!='') { //needed for directory creation - include_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'); + require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'); $post_dir_name=Security::remove_XSS($_POST['dirname']); if ($post_dir_name=='../' || $post_dir_name=='.' || $post_dir_name=='..') @@ -843,7 +843,7 @@ $column_show=array(); } if ($docs_and_folders!=null) { global $total_size; - if ($total_size!=0){ ?> + if ($total_size!=0 && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())){ ?> (ZIP)" alt="" /> (ZIP)  @@ -851,7 +851,7 @@ $column_show=array(); } } // Slideshow by Patrick Cool, May 2004 - include("document_slideshow.inc.php"); + require("document_slideshow.inc.php"); if ($image_present) { echo " ". get_lang('ViewSlideshow') . ""; diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php index a24cf61130..8180ebb37b 100755 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/inc/class.upload.php @@ -204,7 +204,7 @@ class Upload { $this->fileBaseName = $fileBaseName; } - $this->fileBaseName=disable_dangerous_file(replace_dangerous_char(str_replace(' ','_',$this->fileBaseName)));// Juan Carlos Raña replace space by _ because fix long names. See: ajaxfilemanager/inc/class.manager.php. And add cleaning from dokeos replace_dangerous_char() and disable_dangerous_file() + $this->fileBaseName=disable_dangerous_file(replace_dangerous_char(str_replace(' ','_',$this->fileBaseName),'strict'));// Juan Carlos Raña replace space by _ because fix long names. See: ajaxfilemanager/inc/class.manager.php. And add cleaning from dokeos replace_dangerous_char() and disable_dangerous_file() $fileName = $this->fileBaseName . $this->fileExtension; $filePath = $dest . $fileName; diff --git a/main/inc/lib/fckeditor/editor/plugins/asciimath/asciimath.gif b/main/inc/lib/fckeditor/editor/plugins/asciimath/asciimath.gif index 86d68e1e22..61db5905cc 100755 Binary files a/main/inc/lib/fckeditor/editor/plugins/asciimath/asciimath.gif and b/main/inc/lib/fckeditor/editor/plugins/asciimath/asciimath.gif differ diff --git a/main/inc/lib/fckeditor/editor/plugins/asciimath/lang/es.js b/main/inc/lib/fckeditor/editor/plugins/asciimath/lang/es.js index c5bbf667f2..2afef98d98 100755 --- a/main/inc/lib/fckeditor/editor/plugins/asciimath/lang/es.js +++ b/main/inc/lib/fckeditor/editor/plugins/asciimath/lang/es.js @@ -3,20 +3,20 @@ * asciimath plugin Spanish language file. * Encoding: UTF-8. * - * Author: + * Author: Juan Carlos Raña Trabado */ -FCKLang["DlgAsciiMath"] = 'AsciiMath Formula Input' ; -FCKLang["DlgAsciiMathFormulaEditor"] = 'Formula Editor' ; -FCKLang["DlgAsciiMathInput"] = 'Input' ; -FCKLang["DlgAsciiMathClear"] = 'Clear' ; -FCKLang["DlgAsciiMathDelete"] = 'Delete' ; -FCKLang["DlgAsciiMathPreview"] = 'Preview' ; -FCKLang["DlgAsciiMathBasedOn"] = 'Based on ASCIIMathML by ' ; -FCKLang["DlgAsciiMathForMoreInfo"] = 'For more information on AsciiMathML visit this page: ' ; -FCKLang["DlgAsciiMathShowMathML"] = 'Show MathML' ; -FCKLang["DlgAsciiMathFormulaPreview"] = 'Formula Preview' ; -FCKLang["DlgAsciiIncompatibleBrowser"] = 'Your browser is not able to show mathematical formulas. Please, use %s1 or Internet Explorer with %s2 plugin.' ; -FCKLang["DlgAsciiMathOldIE"] = 'Your browser is not able to show mathematical formulas. You need to upgrade to Internet Explorer 6.0+. Then you need to install the MathPlayer 2 plugin for Internet Explorer. Please, see %s for more information.' ; -FCKLang["DlgAsciiMathInstallMathPlayer"] = 'Your browser is not able to show mathematical formulas. You need to install the MathPlayer 2 plugin for Internet Explorer. Please, see %s for more information.' ; -FCKLang["DlgAsciiMathOldMathPlayer"] = 'Your browser is not able to show mathematical formulas. You need to upgrade the MathPlayer plugin for Internet Explorer to version 2. Please, see %s for more information.' ; +FCKLang["DlgAsciiMath"] = 'Insertar una fórmula ASCIIMath' ; +FCKLang["DlgAsciiMathFormulaEditor"] = 'Editor de ecuaciones' ; +FCKLang["DlgAsciiMathInput"] = 'Insertar' ; +FCKLang["DlgAsciiMathClear"] = 'Limpiar' ; +FCKLang["DlgAsciiMathDelete"] = 'Eliminar' ; +FCKLang["DlgAsciiMathPreview"] = 'Previsualización' ; +FCKLang["DlgAsciiMathBasedOn"] = 'Basado en ASCIIMathML por ' ; +FCKLang["DlgAsciiMathForMoreInfo"] = 'Para más información sobre AsciiMathML visite esta página: ' ; +FCKLang["DlgAsciiMathShowMathML"] = 'Mostrar MathML' ; +FCKLang["DlgAsciiMathFormulaPreview"] = 'Previsualización de la ecuación' ; +FCKLang["DlgAsciiIncompatibleBrowser"] = 'Su navegador no puede mostrar fórmulas matemáticas. Use %s1 o Internet Explorer con el plugin %s2 ' ; +FCKLang["DlgAsciiMathOldIE"] = 'Su navegador no puede mostrar fórmulas matemáticas. Actualícese a Internet Explorer 6.0+. Tras esto, tendra que instalar el plugin MathPlayer 2 para Internet Explorer. Para más información vea %s' ; +FCKLang["DlgAsciiMathInstallMathPlayer"] = 'Su navegador no puede mostrar fórmulas matemáticas. Necesita instalar el plugin MathPlayer 2 para Internet Explorer. Para más información vea %s' ; +FCKLang["DlgAsciiMathOldMathPlayer"] = 'Su navegador no puede mostrar fórmulas matemáticas. Necesita actualizar el plugin MathPlayer para Internet Explorer a la version 2. Para más información vea %s' ; \ No newline at end of file diff --git a/main/inc/lib/fckeditor/myconfig.php b/main/inc/lib/fckeditor/myconfig.php index 057f8835b7..eaf1824682 100755 --- a/main/inc/lib/fckeditor/myconfig.php +++ b/main/inc/lib/fckeditor/myconfig.php @@ -66,9 +66,20 @@ // Then, you may modify the newly copied toolbar definitions at your will, just keep correct php-syntax. // It is not mandatory you to create custom files for all the toolbars. In case of missing file in the directory with the // custom toobar definitions the system would read the correspondent "factory" toolbar definition (form 'default' directory). -$config['ToolbarSets']['Directory'] = 'default'; -// You may try this provided example of custom toolbars: -//$config['ToolbarSets']['Directory'] = 'extended'; + + +// This is the visible toolbar set when the editor is maximized. +// If it has not been defined, then the toolbar set for the "normal" size is used. +// if do you prefer configure for each toolbar edit main/inc/lib/fckeditor/toolbars/ + +if ((api_get_setting('more_buttons_maximized_mode') == 'true')) +{ + $config['ToolbarSets']['Directory'] = 'extended'; +} +else +{ + $config['ToolbarSets']['Directory'] = 'default'; +} /* @@ -119,8 +130,15 @@ $config['LoadPlugin'][] = 'fckEmbedMovies'; $config['LoadPlugin'][] = 'flvPlayer'; // youtube : Adds a dilog for inserting YouTube video-streams. -if (api_is_allowed_to_edit() || api_is_platform_admin()) { // (not for students) +if ((api_get_setting('youtube_for_students') == 'true')) { + $config['LoadPlugin'][] = 'youtube'; + +} +else{ + if (api_is_allowed_to_edit() || api_is_platform_admin()) { // (not for students) + $config['LoadPlugin'][] = 'youtube'; + } } // googlemaps : Adds a dilog for inserting Google maps. @@ -136,8 +154,11 @@ $config['LoadPlugin'][] = 'googlemaps'; // mimetex : Adds a dilog for inserting mathematical formulas. In order this plugin to work prpoperly, preliminary changes // in your server configuration have to be done. The MimeTex executable file has to be installed, see the installation guide. // -// Uncomment the line below (remove the double slash at the beginning) to enable the 'mimetex' plugin: -//$config['LoadPlugin'][] = 'mimetex'; +if ((api_get_setting('math_mimetex') == 'true')) { + + $config['LoadPlugin'][] = 'mimetex'; +} + // // Some additional settings become active only when the 'mimetex' plugin has been enabled: // @@ -166,7 +187,11 @@ $config['MimetexExecutableDetectionTimeout'] = 0.05; // After enabling it, this plugin is configured to work with full-page html documents out-of-the box. // You may try it in the "Documents" and "Wiki" tools. // Browser compatibility: Internet Explorer 6.0+ with MathPlayer plugin, Mozilla Firefox 2.0+, Opera 9.5+ -//$config['LoadPlugin'][] = 'asciimath'; + +if ((api_get_setting('math_asciimathML') == 'true')) { + + $config['LoadPlugin'][] = 'asciimath'; +} // wikilink : Adds a dialog for inserting wiki-formatted links. $config['LoadPlugin'][] = 'wikilink'; @@ -279,6 +304,15 @@ $config['FontFormats'] = 'p;h1;h2;h3;h4;h5'; // A reduced format list. // for all browsers. You may disable or change it if you wish. $config['EditorAreaStyles'] = 'body { background-color: #ffffff; }'; +// A setting for blocking copy/paste functions of the editor. +// This setting activates on leaners only. For users with other statuses there is no blocking copy/paste. +// if do you prefer configure for each toolbar edit main/inc/lib/fckeditor/toolbars/ +if ((api_get_setting('block_copy_paste_for_students') == 'true')) +{ + + $config['BlockCopyPaste'] = true; +} + /* * Additional note: * For debugging purposes the editor may run using original source versions of its javascripts, not the "compressed" versions. diff --git a/main/inc/lib/fckeditor/toolbars/default/terms_and_conditions.php b/main/inc/lib/fckeditor/toolbars/default/terms_and_conditions.php new file mode 100644 index 0000000000..e042af88c1 --- /dev/null +++ b/main/inc/lib/fckeditor/toolbars/default/terms_and_conditions.php @@ -0,0 +1,46 @@ + diff --git a/main/inc/lib/fckeditor/toolbars/extended/admin_templates.php b/main/inc/lib/fckeditor/toolbars/extended/admin_templates.php index e6e083b688..43d7e53926 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/admin_templates.php +++ b/main/inc/lib/fckeditor/toolbars/extended/admin_templates.php @@ -9,17 +9,13 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), + array('NewPage','Templates','Save','Print','PageBreak','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll','-','Find'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), + array('Table','Smiley','SpecialChar','googlemaps'), + array('FontFormat','FontName','FontSize'), + array('JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), array('Source') ); diff --git a/main/inc/lib/fckeditor/toolbars/extended/agenda.php b/main/inc/lib/fckeditor/toolbars/extended/agenda.php index 007b9fc7cf..eadb79b114 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/agenda.php +++ b/main/inc/lib/fckeditor/toolbars/extended/agenda.php @@ -9,15 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/agenda_student.php b/main/inc/lib/fckeditor/toolbars/extended/agenda_student.php index 60d9e40705..88a1ef1d69 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/agenda_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/agenda_student.php @@ -9,15 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + '/', + array('FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/announcements.php b/main/inc/lib/fckeditor/toolbars/extended/announcements.php index fb0c777bf8..545696affe 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/announcements.php +++ b/main/inc/lib/fckeditor/toolbars/extended/announcements.php @@ -9,15 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/announcements_student.php b/main/inc/lib/fckeditor/toolbars/extended/announcements_student.php index db6976b2bc..a9c93489ab 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/announcements_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/announcements_student.php @@ -9,15 +9,16 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/assessments_introduction.php b/main/inc/lib/fckeditor/toolbars/extended/assessments_introduction.php index 21e7cb2b46..2de167c78a 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/assessments_introduction.php +++ b/main/inc/lib/fckeditor/toolbars/extended/assessments_introduction.php @@ -9,18 +9,16 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), - array('Source') + array('Save','FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/documents.php b/main/inc/lib/fckeditor/toolbars/extended/documents.php index 8764f393fd..e0995b36d4 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/documents.php +++ b/main/inc/lib/fckeditor/toolbars/extended/documents.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink','Glossary'), - array('Image','Flash'), + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor','Glossary'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), + array('Table','SpecialChar'), + array('Outdent','Indent','-','TextColor','BGColor','-','OrderedList','UnorderedList','-','Source'), '/', array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex','asciimath'), - array('Source') + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/documents_student.php b/main/inc/lib/fckeditor/toolbars/extended/documents_student.php index 43fab324d9..0fa041e61a 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/documents_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/documents_student.php @@ -9,17 +9,16 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink','Glossary'), - array('Image','Flash'), + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), + array('Table','SpecialChar'), + array('Outdent','Indent','-','TextColor','BGColor','-','OrderedList','UnorderedList'), '/', array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex','asciimath') + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/faq.php b/main/inc/lib/fckeditor/toolbars/extended/faq.php index 874e6d13ad..83134dfee5 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/faq.php +++ b/main/inc/lib/fckeditor/toolbars/extended/faq.php @@ -7,7 +7,16 @@ // For more information: http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options // This is the visible toolbar set when the editor has "normal" size. + $config['ToolbarSets']['Normal'] = array( + array('Save','Preview','Source') +); + + +// This is the visible toolbar set when the editor is maximized. +// If it has not been defined, then the toolbar set for the "normal" size is used. + +$config['ToolbarSets']['Maximized'] = array( //array('FitWindow','Save'), array('Save'), array('Bold','Italic','Underline'), @@ -16,13 +25,6 @@ $config['ToolbarSets']['Normal'] = array( array('Link','Unlink') ); -// This is the visible toolbar set when the editor is maximized. -// If it has not been defined, then the toolbar set for the "normal" size is used. -/* -$config['ToolbarSets']['Maximized'] = array( - array('FitWindow','-') // ... -); -*/ // Sets whether the toolbar can be collapsed/expanded or not. // Possible values: true , false diff --git a/main/inc/lib/fckeditor/toolbars/extended/forum.php b/main/inc/lib/fckeditor/toolbars/extended/forum.php index 689dccb4b8..21cb1371fc 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/forum.php +++ b/main/inc/lib/fckeditor/toolbars/extended/forum.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex'), - array('Source') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/forum_student.php b/main/inc/lib/fckeditor/toolbars/extended/forum_student.php index bd4dc416ae..00c1017baf 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/forum_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/forum_student.php @@ -9,17 +9,16 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/global_agenda.php b/main/inc/lib/fckeditor/toolbars/extended/global_agenda.php index 8cd665d505..1b7f74833a 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/global_agenda.php +++ b/main/inc/lib/fckeditor/toolbars/extended/global_agenda.php @@ -9,15 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar','googlemaps'), + array('FontName','FontSize'), + array('Bold','Italic','Underline'), + array('OrderedList','UnorderedList','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/glossary.php b/main/inc/lib/fckeditor/toolbars/extended/glossary.php index 5fe491dabe..2caa4bdca1 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/glossary.php +++ b/main/inc/lib/fckeditor/toolbars/extended/glossary.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex'), - array('Source') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/introduction.php b/main/inc/lib/fckeditor/toolbars/extended/introduction.php index 89a6ae8573..655e594707 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/introduction.php +++ b/main/inc/lib/fckeditor/toolbars/extended/introduction.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), + array('NewPage','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), '/', array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), - array('Source') + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/learning_path_author.php b/main/inc/lib/fckeditor/toolbars/extended/learning_path_author.php index f5d2bbc484..bba97ea486 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/learning_path_author.php +++ b/main/inc/lib/fckeditor/toolbars/extended/learning_path_author.php @@ -9,11 +9,7 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow'), - array('Bold','Italic','Underline'), - array('Undo','Redo'), - array('TextColor','BGColor'), - array('Link','Unlink') + array('Link','Unlink','Bold','Italic','TextColor','BGColor','Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/learning_path_documents.php b/main/inc/lib/fckeditor/toolbars/extended/learning_path_documents.php index ee9a183fed..a27e5701a5 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/learning_path_documents.php +++ b/main/inc/lib/fckeditor/toolbars/extended/learning_path_documents.php @@ -9,19 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink','Glossary'), - array('Image','Flash'), + array('PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor','Glossary'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath','Table','SpecialChar'), + array('Outdent','Indent','TextColor','BGColor','-','OrderedList','UnorderedList','JustifyLeft','JustifyCenter','JustifyRight'), '/', array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex','asciimath'), - array('Source') -); + array('Bold','Italic','Underline','-','Source'), +);//save, FitWindow don't run well here // This is the visible toolbar set when the editor is maximized. // If it has not been defined, then the toolbar set for the "normal" size is used. diff --git a/main/inc/lib/fckeditor/toolbars/extended/messages.php b/main/inc/lib/fckeditor/toolbars/extended/messages.php index eccb9a83f3..7b32efc9c1 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/messages.php +++ b/main/inc/lib/fckeditor/toolbars/extended/messages.php @@ -9,17 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','Smiley'), '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex') + array('FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/notebook.php b/main/inc/lib/fckeditor/toolbars/extended/notebook.php index 9cb2a53f50..2e93862a4e 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/notebook.php +++ b/main/inc/lib/fckeditor/toolbars/extended/notebook.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex'), - array('Source') + array('Save','FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/notebook_student.php b/main/inc/lib/fckeditor/toolbars/extended/notebook_student.php index e96238bf44..8646a8d954 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/notebook_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/notebook_student.php @@ -9,17 +9,16 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex') + array('Save','FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/portal_home_page.php b/main/inc/lib/fckeditor/toolbars/extended/portal_home_page.php index d61cee006b..634714bbb6 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/portal_home_page.php +++ b/main/inc/lib/fckeditor/toolbars/extended/portal_home_page.php @@ -9,17 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), + array('NewPage','Templates','Save','Print','PageBreak','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll','-','Find'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','Smiley','SpecialChar','googlemaps'), '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), + array('FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), array('Source') ); diff --git a/main/inc/lib/fckeditor/toolbars/extended/portal_news.php b/main/inc/lib/fckeditor/toolbars/extended/portal_news.php index 5cfd2478e1..ac8ac67c89 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/portal_news.php +++ b/main/inc/lib/fckeditor/toolbars/extended/portal_news.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), - array('Source') + array('Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/profile.php b/main/inc/lib/fckeditor/toolbars/extended/profile.php index 843ecca014..0427d8023e 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/profile.php +++ b/main/inc/lib/fckeditor/toolbars/extended/profile.php @@ -9,13 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','Smiley'), + '/', + array('FontName','FontSize'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('TextColor','BGColor'), - array('Link','Unlink','SpecialChar') + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/project.php b/main/inc/lib/fckeditor/toolbars/extended/project.php index ac29bd4c32..74ad295f56 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/project.php +++ b/main/inc/lib/fckeditor/toolbars/extended/project.php @@ -9,15 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','googlemaps'), + array('FontName','FontSize'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/project_comment.php b/main/inc/lib/fckeditor/toolbars/extended/project_comment.php index 921c7db520..90c12dee83 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/project_comment.php +++ b/main/inc/lib/fckeditor/toolbars/extended/project_comment.php @@ -9,15 +9,13 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','googlemaps'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/project_comment_student.php b/main/inc/lib/fckeditor/toolbars/extended/project_comment_student.php index bdb9e55436..854090519a 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/project_comment_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/project_comment_student.php @@ -9,15 +9,13 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','googlemaps'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/project_student.php b/main/inc/lib/fckeditor/toolbars/extended/project_student.php index 73abca9f8d..046520c592 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/project_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/project_student.php @@ -9,15 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','googlemaps'), + array('FontName','FontSize'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor') + array('JustifyLeft','JustifyCenter','-','OrderedList','UnorderedList','-','TextColor','BGColor'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/survey.php b/main/inc/lib/fckeditor/toolbars/extended/survey.php index 5e6239d24a..e108df0624 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/survey.php +++ b/main/inc/lib/fckeditor/toolbars/extended/survey.php @@ -10,14 +10,13 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( array('FitWindow'), - array('FontSize', 'Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','SelectAll','RemoveFormat'), - array('TextColor','BGColor'), array('Link','Unlink'), - array('Table','SpecialChar'), - array('Image','Flash') + array('Image'), + array('Table'), + array('FontSize'), + array('Bold','Italic'), + array('OrderedList','UnorderedList','-','TextColor'), + array('Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/terms_and_conditions.php b/main/inc/lib/fckeditor/toolbars/extended/terms_and_conditions.php new file mode 100644 index 0000000000..b28b2b60bf --- /dev/null +++ b/main/inc/lib/fckeditor/toolbars/extended/terms_and_conditions.php @@ -0,0 +1,41 @@ + diff --git a/main/inc/lib/fckeditor/toolbars/extended/test_answer_feedback.php b/main/inc/lib/fckeditor/toolbars/extended/test_answer_feedback.php index 8e550c5fc3..4f7abd1e4f 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/test_answer_feedback.php +++ b/main/inc/lib/fckeditor/toolbars/extended/test_answer_feedback.php @@ -9,11 +9,7 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow'), - array('Bold','Italic','Underline','-','Subscript','Superscript'), - array('Undo','Redo'), - array('TextColor','BGColor'), - array('SpecialChar','mimetex') + array('Link','Unlink','Bold','Italic','TextColor','BGColor','mimetex') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/test_description.php b/main/inc/lib/fckeditor/toolbars/extended/test_description.php index ddc36ca091..e372a7d20b 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/test_description.php +++ b/main/inc/lib/fckeditor/toolbars/extended/test_description.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex'), - array('Source') + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/test_free_answer.php b/main/inc/lib/fckeditor/toolbars/extended/test_free_answer.php index 65d96eb3cf..f611445ee1 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/test_free_answer.php +++ b/main/inc/lib/fckeditor/toolbars/extended/test_free_answer.php @@ -9,11 +9,7 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow'), - array('Bold','Italic','Underline','-','Subscript','Superscript'), - array('Undo','Redo'), - array('TextColor','BGColor'), - array('SpecialChar','mimetex') + array('FitWindow','Bold','Image','Link','PasteWord','MP3','mimetex','Table','Subscript','Superscript','ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/test_proposed_answer.php b/main/inc/lib/fckeditor/toolbars/extended/test_proposed_answer.php index ead03680b6..a7f8b03e7b 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/test_proposed_answer.php +++ b/main/inc/lib/fckeditor/toolbars/extended/test_proposed_answer.php @@ -9,10 +9,7 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow'), - array('Bold','Italic','Underline','-','Subscript','Superscript'), - array('Undo','Redo'), - array('SpecialChar','mimetex') + array('FitWindow','Bold','Image','Link','PasteWord','MP3','mimetex','Table','Subscript','Superscript','Source') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/test_question_description.php b/main/inc/lib/fckeditor/toolbars/extended/test_question_description.php index 0bcb17cf75..4bdd6d73ae 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/test_question_description.php +++ b/main/inc/lib/fckeditor/toolbars/extended/test_question_description.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex'), - array('Source') + array('FitWindow','-','PasteWord','-','Undo','Redo'), + array('Link','Unlink'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','-','Source'), + '/', + array('Style','FontFormat','FontName','FontSize'), + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/training_description.php b/main/inc/lib/fckeditor/toolbars/extended/training_description.php index 44050b1193..6a467c001a 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/training_description.php +++ b/main/inc/lib/fckeditor/toolbars/extended/training_description.php @@ -9,18 +9,15 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), - array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink'), - array('Image','Flash'), + array('NewPage','Save','FitWindow','PasteWord','-','Undo','Redo'), + array('Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex'), + array('Table','SpecialChar'), + array('OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor','Source'), '/', array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar'), - array('Source') + array('Bold','Italic','Underline'), + array('JustifyLeft','JustifyCenter','JustifyRight') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fckeditor/toolbars/extended/wiki.php b/main/inc/lib/fckeditor/toolbars/extended/wiki.php index 71a4f73129..d35ea07212 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/wiki.php +++ b/main/inc/lib/fckeditor/toolbars/extended/wiki.php @@ -9,17 +9,13 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), + array('NewPage','Templates','Save','PageBreak','Preview','FitWindow','-','PasteText','-','Undo','Redo','-','SelectAll','-','Find'), + array('Wikilink','Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), + array('Table','Smiley','SpecialChar','googlemaps'), + array('FontFormat','FontName','FontSize'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink','Wikilink','Glossary'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex','asciimath'), + array('Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), array('Source') ); diff --git a/main/inc/lib/fckeditor/toolbars/extended/wiki_student.php b/main/inc/lib/fckeditor/toolbars/extended/wiki_student.php index 1c0d612c13..3c29126185 100755 --- a/main/inc/lib/fckeditor/toolbars/extended/wiki_student.php +++ b/main/inc/lib/fckeditor/toolbars/extended/wiki_student.php @@ -9,17 +9,14 @@ // This is the visible toolbar set when the editor has "normal" size. $config['ToolbarSets']['Normal'] = array( - array('FitWindow','Save','Preview'), + array('NewPage','Save','PageBreak','Preview','FitWindow','-','PasteText','-','Undo','Redo','-','SelectAll','-','Find'), + array('Wikilink','Link','Unlink','Anchor'), + array('Image','flvPlayer','Flash','EmbedMovies','YouTube','MP3','mimetex','asciimath'), + array('Table','Smiley','SpecialChar','googlemaps'), + array('FontFormat','FontName','FontSize'), array('Bold','Italic','Underline'), - array('OrderedList','UnorderedList','-','Outdent','Indent'), - array('JustifyLeft','JustifyCenter','JustifyRight'), - array('Undo','Redo','-','Find','-','SelectAll','RemoveFormat'), - array('Link','Unlink','Wikilink','Glossary'), - array('Image','Flash'), - '/', - array('Style','FontFormat','FontName','FontSize'), - array('TextColor','BGColor'), - array('Rule','Table','SpecialChar','mimetex','asciimath') + array('Subscript','Superscript','-','JustifyLeft','JustifyCenter','JustifyRight','-','OrderedList','UnorderedList','-','Outdent','Indent','-','TextColor','BGColor'), + array('ShowBlocks') ); // This is the visible toolbar set when the editor is maximized. diff --git a/main/inc/lib/fileUpload.lib.php b/main/inc/lib/fileUpload.lib.php index b22e80b8f1..334e284ff3 100755 --- a/main/inc/lib/fileUpload.lib.php +++ b/main/inc/lib/fileUpload.lib.php @@ -248,8 +248,8 @@ function handle_uploaded_document($_course,$uploaded_file,$base_work_dir,$upload } else { - //clean up the name, only ASCII characters should stay. - $clean_name = replace_dangerous_char($uploaded_file['name']); + //clean up the name, only ASCII characters should stay. (and strict) + $clean_name = replace_dangerous_char($uploaded_file['name'], 'strict'); //no "dangerous" files $clean_name = disable_dangerous_file($clean_name); if(!filter_extension($clean_name)) @@ -703,7 +703,7 @@ function treat_uploaded_file($uploadedFile, $baseWorkDir, $uploadPath, $maxFille $fileName = trim($uploadedFile['name']); // CHECK FOR NO DESIRED CHARACTERS - $fileName = replace_dangerous_char($fileName); + $fileName = replace_dangerous_char($fileName, 'strict'); // TRY TO ADD AN EXTENSION TO FILES WITOUT EXTENSION $fileName = add_ext_on_mime($fileName,$uploadedFile['type']); @@ -1875,7 +1875,7 @@ $handle=opendir($path); else { //rename - $safe_file=disable_dangerous_file(replace_dangerous_char($file)); + $safe_file=disable_dangerous_file(replace_dangerous_char($file, 'strict')); @rename($base_work_dir.$current_path.'/'.$file,$base_work_dir.$current_path.'/'.$safe_file); if(!DocumentManager::get_document_id($_course, $current_path.'/'.$safe_file)) diff --git a/main/inc/lib/html2pdf/_fpdf/font/courier.php b/main/inc/lib/html2pdf/_fpdf/font/courier.php index 4c009f39b4..913f9a4533 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/courier.php +++ b/main/inc/lib/html2pdf/_fpdf/font/courier.php @@ -1,7 +1,7 @@ - + diff --git a/main/inc/lib/html2pdf/_fpdf/font/helvetica.php b/main/inc/lib/html2pdf/_fpdf/font/helvetica.php index 8fa7683e7c..ca94cdf21a 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/helvetica.php +++ b/main/inc/lib/html2pdf/_fpdf/font/helvetica.php @@ -1,15 +1,15 @@ -278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/helveticab.php b/main/inc/lib/html2pdf/_fpdf/font/helveticab.php index a8473c94d7..276cfa8cb8 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/helveticab.php +++ b/main/inc/lib/html2pdf/_fpdf/font/helveticab.php @@ -1,15 +1,15 @@ -278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); -?> +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/helveticabi.php b/main/inc/lib/html2pdf/_fpdf/font/helveticabi.php index 41379537dc..8d21774325 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/helveticabi.php +++ b/main/inc/lib/html2pdf/_fpdf/font/helveticabi.php @@ -1,15 +1,15 @@ -278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, - 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, - 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, - chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, - chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); -?> +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722, + 'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889, + 'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556, + chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611, + chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/helveticai.php b/main/inc/lib/html2pdf/_fpdf/font/helveticai.php index d5bb6e094e..88bf4371bd 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/helveticai.php +++ b/main/inc/lib/html2pdf/_fpdf/font/helveticai.php @@ -1,15 +1,15 @@ -278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, - chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, - ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, - 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, - 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, - chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, - chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, - chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> +278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278, + chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584, + ','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944, + 'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833, + 'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556, + chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333, + chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556, + chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/makefont/makefont.php b/main/inc/lib/html2pdf/_fpdf/font/makefont/makefont.php index 787a74a88b..13039326db 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/makefont/makefont.php +++ b/main/inc/lib/html2pdf/_fpdf/font/makefont/makefont.php @@ -1,419 +1,419 @@ -Error: encoding not found: '.$enc); - $cc2gn=array(); - foreach($a as $l) - { - if($l[0]=='!') - { - $e=preg_split('/[ \\t]+/',rtrim($l)); - $cc=hexdec(substr($e[0],1)); - $gn=$e[2]; - $cc2gn[$cc]=$gn; - } - } - for($i=0;$i<=255;$i++) - { - if(!isset($cc2gn[$i])) - $cc2gn[$i]='.notdef'; - } - return $cc2gn; -} - -function ReadAFM($file, &$map) -{ - //Read a font metric file - $a=file($file); - if(empty($a)) - die('File not found'); - $widths=array(); - $fm=array(); - $fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent', - 'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut', - 'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent', - 'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent', - 'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent', - 'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat', - 'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb', - 'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong'); - foreach($a as $l) - { - $e=explode(' ',rtrim($l)); - if(count($e)<2) - continue; - $code=$e[0]; - $param=$e[1]; - if($code=='C') - { - //Character metrics - $cc=(int)$e[1]; - $w=$e[4]; - $gn=$e[7]; - if(substr($gn,-4)=='20AC') - $gn='Euro'; - if(isset($fix[$gn])) - { - //Fix incorrect glyph name - foreach($map as $c=>$n) - { - if($n==$fix[$gn]) - $map[$c]=$gn; - } - } - if(empty($map)) - { - //Symbolic font: use built-in encoding - $widths[$cc]=$w; - } - else - { - $widths[$gn]=$w; - if($gn=='X') - $fm['CapXHeight']=$e[13]; - } - if($gn=='.notdef') - $fm['MissingWidth']=$w; - } - elseif($code=='FontName') - $fm['FontName']=$param; - elseif($code=='Weight') - $fm['Weight']=$param; - elseif($code=='ItalicAngle') - $fm['ItalicAngle']=(double)$param; - elseif($code=='Ascender') - $fm['Ascender']=(int)$param; - elseif($code=='Descender') - $fm['Descender']=(int)$param; - elseif($code=='UnderlineThickness') - $fm['UnderlineThickness']=(int)$param; - elseif($code=='UnderlinePosition') - $fm['UnderlinePosition']=(int)$param; - elseif($code=='IsFixedPitch') - $fm['IsFixedPitch']=($param=='true'); - elseif($code=='FontBBox') - $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); - elseif($code=='CapHeight') - $fm['CapHeight']=(int)$param; - elseif($code=='StdVW') - $fm['StdVW']=(int)$param; - } - if(!isset($fm['FontName'])) - die('FontName not found'); - if(!empty($map)) - { - if(!isset($widths['.notdef'])) - $widths['.notdef']=600; - if(!isset($widths['Delta']) && isset($widths['increment'])) - $widths['Delta']=$widths['increment']; - //Order widths according to map - for($i=0;$i<=255;$i++) - { - if(!isset($widths[$map[$i]])) - { - echo 'Warning: character '.$map[$i].' is missing
'; - $widths[$i]=$widths['.notdef']; - } - else - $widths[$i]=$widths[$map[$i]]; - } - } - $fm['Widths']=$widths; - return $fm; -} - -function MakeFontDescriptor($fm, $symbolic) -{ - //Ascent - $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); - $fd="array('Ascent'=>".$asc; - //Descent - $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); - $fd.=",'Descent'=>".$desc; - //CapHeight - if(isset($fm['CapHeight'])) - $ch=$fm['CapHeight']; - elseif(isset($fm['CapXHeight'])) - $ch=$fm['CapXHeight']; - else - $ch=$asc; - $fd.=",'CapHeight'=>".$ch; - //Flags - $flags=0; - if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) - $flags+=1<<0; - if($symbolic) - $flags+=1<<2; - if(!$symbolic) - $flags+=1<<5; - if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) - $flags+=1<<6; - $fd.=",'Flags'=>".$flags; - //FontBBox - if(isset($fm['FontBBox'])) - $fbb=$fm['FontBBox']; - else - $fbb=array(0,$desc-100,1000,$asc+100); - $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; - //ItalicAngle - $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); - $fd.=",'ItalicAngle'=>".$ia; - //StemV - if(isset($fm['StdVW'])) - $stemv=$fm['StdVW']; - elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight'])) - $stemv=120; - else - $stemv=70; - $fd.=",'StemV'=>".$stemv; - //MissingWidth - if(isset($fm['MissingWidth'])) - $fd.=",'MissingWidth'=>".$fm['MissingWidth']; - $fd.=')'; - return $fd; -} - -function MakeWidthArray($fm) -{ - //Make character width array - $s="array(\n\t"; - $cw=$fm['Widths']; - for($i=0;$i<=255;$i++) - { - if(chr($i)=="'") - $s.="'\\''"; - elseif(chr($i)=="\\") - $s.="'\\\\'"; - elseif($i>=32 && $i<=126) - $s.="'".chr($i)."'"; - else - $s.="chr($i)"; - $s.='=>'.$fm['Widths'][$i]; - if($i<255) - $s.=','; - if(($i+1)%22==0) - $s.="\n\t"; - } - $s.=')'; - return $s; -} - -function MakeFontEncoding($map) -{ - //Build differences from reference encoding - $ref=ReadMap('cp1252'); - $s=''; - $last=0; - for($i=32;$i<=255;$i++) - { - if($map[$i]!=$ref[$i]) - { - if($i!=$last+1) - $s.=$i.' '; - $last=$i; - $s.='/'.$map[$i].' '; - } - } - return rtrim($s); -} - -function SaveToFile($file, $s, $mode) -{ - $f=fopen($file,'w'.$mode); - if(!$f) - die('Can\'t write to file '.$file); - fwrite($f,$s,strlen($s)); - fclose($f); -} - -function ReadShort($f) -{ - $a=unpack('n1n',fread($f,2)); - return $a['n']; -} - -function ReadLong($f) -{ - $a=unpack('N1N',fread($f,4)); - return $a['N']; -} - -function CheckTTF($file) -{ - //Check if font license allows embedding - $f=fopen($file,'rb'); - if(!$f) - die('Error: Can\'t open '.$file); - //Extract number of tables - fseek($f,4,SEEK_CUR); - $nb=ReadShort($f); - fseek($f,6,SEEK_CUR); - //Seek OS/2 table - $found=false; - for($i=0;$i<$nb;$i++) - { - if(fread($f,4)=='OS/2') - { - $found=true; - break; - } - fseek($f,12,SEEK_CUR); - } - if(!$found) - { - fclose($f); - return; - } - fseek($f,4,SEEK_CUR); - $offset=ReadLong($f); - fseek($f,$offset,SEEK_SET); - //Extract fsType flags - fseek($f,8,SEEK_CUR); - $fsType=ReadShort($f); - $rl=($fsType & 0x02)!=0; - $pp=($fsType & 0x04)!=0; - $e=($fsType & 0x08)!=0; - fclose($f); - if($rl && !$pp && !$e) - echo 'Warning: font license does not allow embedding'; -} - -/******************************************************************************* -* fontfile: path to TTF file (or empty string if not to be embedded0) -* afmfile: path to AFM file -* enc: font encoding (or empty string for symbolic fonts) -* patch: optional patch for encoding -* type: font type if fontfile is empty -*******************************************************************************/ -function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType') -{ - //Generate a font definition file - if(get_magic_quotes_runtime()) - @set_magic_quotes_runtime(0); - ini_set('auto_detect_line_endings','1'); - if($enc) - { - $map=ReadMap($enc); - foreach($patch as $cc=>$gn) - $map[$cc]=$gn; - } - else - $map=array(); - if(!file_exists($afmfile)) - die('Error: AFM file not found: '.$afmfile); - $fm=ReadAFM($afmfile,$map); - if($enc) - $diff=MakeFontEncoding($map); - else - $diff=''; - $fd=MakeFontDescriptor($fm,empty($map)); - //Find font type - if($fontfile) - { - $ext=strtolower(substr($fontfile,-3)); - if($ext=='ttf') - $type='TrueType'; - elseif($ext=='pfb') - $type='Type1'; - else - die('Error: unrecognized font file extension: '.$ext); - } - else - { - if($type!='TrueType' && $type!='Type1') - die('Error: incorrect font type: '.$type); - } - //Start generation - $s='Error: font file not found: '.$fontfile); - if($type=='TrueType') - CheckTTF($fontfile); - $f=fopen($fontfile,'rb'); - if(!$f) - die('Error: Can\'t open '.$fontfile); - $file=fread($f,filesize($fontfile)); - fclose($f); - if($type=='Type1') - { - //Find first two sections and discard third one - $header=(ord($file[0])==128); - if($header) - { - //Strip first binary header - $file=substr($file,6); - } - $pos=strpos($file,'eexec'); - if(!$pos) - die('Error: font file does not seem to be valid Type1'); - $size1=$pos+6; - if($header && ord($file[$size1])==128) - { - //Strip second binary header - $file=substr($file,0,$size1).substr($file,$size1+6); - } - $pos=strpos($file,'00000000'); - if(!$pos) - die('Error: font file does not seem to be valid Type1'); - $size2=$pos-$size1; - $file=substr($file,0,$size1+$size2); - } - if(function_exists('gzcompress')) - { - $cmp=$basename.'.z'; - SaveToFile($cmp,gzcompress($file),'b'); - $s.='$file=\''.$cmp."';\n"; - echo 'Font file compressed ('.$cmp.')
'; - } - else - { - $s.='$file=\''.basename($fontfile)."';\n"; - echo 'Notice: font file could not be compressed (zlib extension not available)
'; - } - if($type=='Type1') - { - $s.='$size1='.$size1.";\n"; - $s.='$size2='.$size2.";\n"; - } - else - $s.='$originalsize='.filesize($fontfile).";\n"; - } - else - { - //Not embedded font - $s.='$file='."'';\n"; - } - $s.="?>\n"; - SaveToFile($basename.'.php',$s,'t'); - echo 'Font definition file generated ('.$basename.'.php'.')
'; -} -?> +Error: encoding not found: '.$enc); + $cc2gn=array(); + foreach($a as $l) + { + if($l[0]=='!') + { + $e=preg_split('/[ \\t]+/',rtrim($l)); + $cc=hexdec(substr($e[0],1)); + $gn=$e[2]; + $cc2gn[$cc]=$gn; + } + } + for($i=0;$i<=255;$i++) + { + if(!isset($cc2gn[$i])) + $cc2gn[$i]='.notdef'; + } + return $cc2gn; +} + +function ReadAFM($file, &$map) +{ + //Read a font metric file + $a=file($file); + if(empty($a)) + die('File not found'); + $widths=array(); + $fm=array(); + $fix=array('Edot'=>'Edotaccent','edot'=>'edotaccent','Idot'=>'Idotaccent','Zdot'=>'Zdotaccent','zdot'=>'zdotaccent', + 'Odblacute'=>'Ohungarumlaut','odblacute'=>'ohungarumlaut','Udblacute'=>'Uhungarumlaut','udblacute'=>'uhungarumlaut', + 'Gcedilla'=>'Gcommaaccent','gcedilla'=>'gcommaaccent','Kcedilla'=>'Kcommaaccent','kcedilla'=>'kcommaaccent', + 'Lcedilla'=>'Lcommaaccent','lcedilla'=>'lcommaaccent','Ncedilla'=>'Ncommaaccent','ncedilla'=>'ncommaaccent', + 'Rcedilla'=>'Rcommaaccent','rcedilla'=>'rcommaaccent','Scedilla'=>'Scommaaccent','scedilla'=>'scommaaccent', + 'Tcedilla'=>'Tcommaaccent','tcedilla'=>'tcommaaccent','Dslash'=>'Dcroat','dslash'=>'dcroat','Dmacron'=>'Dcroat','dmacron'=>'dcroat', + 'combininggraveaccent'=>'gravecomb','combininghookabove'=>'hookabovecomb','combiningtildeaccent'=>'tildecomb', + 'combiningacuteaccent'=>'acutecomb','combiningdotbelow'=>'dotbelowcomb','dongsign'=>'dong'); + foreach($a as $l) + { + $e=explode(' ',rtrim($l)); + if(count($e)<2) + continue; + $code=$e[0]; + $param=$e[1]; + if($code=='C') + { + //Character metrics + $cc=(int)$e[1]; + $w=$e[4]; + $gn=$e[7]; + if(substr($gn,-4)=='20AC') + $gn='Euro'; + if(isset($fix[$gn])) + { + //Fix incorrect glyph name + foreach($map as $c=>$n) + { + if($n==$fix[$gn]) + $map[$c]=$gn; + } + } + if(empty($map)) + { + //Symbolic font: use built-in encoding + $widths[$cc]=$w; + } + else + { + $widths[$gn]=$w; + if($gn=='X') + $fm['CapXHeight']=$e[13]; + } + if($gn=='.notdef') + $fm['MissingWidth']=$w; + } + elseif($code=='FontName') + $fm['FontName']=$param; + elseif($code=='Weight') + $fm['Weight']=$param; + elseif($code=='ItalicAngle') + $fm['ItalicAngle']=(double)$param; + elseif($code=='Ascender') + $fm['Ascender']=(int)$param; + elseif($code=='Descender') + $fm['Descender']=(int)$param; + elseif($code=='UnderlineThickness') + $fm['UnderlineThickness']=(int)$param; + elseif($code=='UnderlinePosition') + $fm['UnderlinePosition']=(int)$param; + elseif($code=='IsFixedPitch') + $fm['IsFixedPitch']=($param=='true'); + elseif($code=='FontBBox') + $fm['FontBBox']=array($e[1],$e[2],$e[3],$e[4]); + elseif($code=='CapHeight') + $fm['CapHeight']=(int)$param; + elseif($code=='StdVW') + $fm['StdVW']=(int)$param; + } + if(!isset($fm['FontName'])) + die('FontName not found'); + if(!empty($map)) + { + if(!isset($widths['.notdef'])) + $widths['.notdef']=600; + if(!isset($widths['Delta']) && isset($widths['increment'])) + $widths['Delta']=$widths['increment']; + //Order widths according to map + for($i=0;$i<=255;$i++) + { + if(!isset($widths[$map[$i]])) + { + echo 'Warning: character '.$map[$i].' is missing
'; + $widths[$i]=$widths['.notdef']; + } + else + $widths[$i]=$widths[$map[$i]]; + } + } + $fm['Widths']=$widths; + return $fm; +} + +function MakeFontDescriptor($fm, $symbolic) +{ + //Ascent + $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); + $fd="array('Ascent'=>".$asc; + //Descent + $desc=(isset($fm['Descender']) ? $fm['Descender'] : -200); + $fd.=",'Descent'=>".$desc; + //CapHeight + if(isset($fm['CapHeight'])) + $ch=$fm['CapHeight']; + elseif(isset($fm['CapXHeight'])) + $ch=$fm['CapXHeight']; + else + $ch=$asc; + $fd.=",'CapHeight'=>".$ch; + //Flags + $flags=0; + if(isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) + $flags+=1<<0; + if($symbolic) + $flags+=1<<2; + if(!$symbolic) + $flags+=1<<5; + if(isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) + $flags+=1<<6; + $fd.=",'Flags'=>".$flags; + //FontBBox + if(isset($fm['FontBBox'])) + $fbb=$fm['FontBBox']; + else + $fbb=array(0,$desc-100,1000,$asc+100); + $fd.=",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; + //ItalicAngle + $ia=(isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); + $fd.=",'ItalicAngle'=>".$ia; + //StemV + if(isset($fm['StdVW'])) + $stemv=$fm['StdVW']; + elseif(isset($fm['Weight']) && preg_match('/bold|black/i',$fm['Weight'])) + $stemv=120; + else + $stemv=70; + $fd.=",'StemV'=>".$stemv; + //MissingWidth + if(isset($fm['MissingWidth'])) + $fd.=",'MissingWidth'=>".$fm['MissingWidth']; + $fd.=')'; + return $fd; +} + +function MakeWidthArray($fm) +{ + //Make character width array + $s="array(\n\t"; + $cw=$fm['Widths']; + for($i=0;$i<=255;$i++) + { + if(chr($i)=="'") + $s.="'\\''"; + elseif(chr($i)=="\\") + $s.="'\\\\'"; + elseif($i>=32 && $i<=126) + $s.="'".chr($i)."'"; + else + $s.="chr($i)"; + $s.='=>'.$fm['Widths'][$i]; + if($i<255) + $s.=','; + if(($i+1)%22==0) + $s.="\n\t"; + } + $s.=')'; + return $s; +} + +function MakeFontEncoding($map) +{ + //Build differences from reference encoding + $ref=ReadMap('cp1252'); + $s=''; + $last=0; + for($i=32;$i<=255;$i++) + { + if($map[$i]!=$ref[$i]) + { + if($i!=$last+1) + $s.=$i.' '; + $last=$i; + $s.='/'.$map[$i].' '; + } + } + return rtrim($s); +} + +function SaveToFile($file, $s, $mode) +{ + $f=fopen($file,'w'.$mode); + if(!$f) + die('Can\'t write to file '.$file); + fwrite($f,$s,strlen($s)); + fclose($f); +} + +function ReadShort($f) +{ + $a=unpack('n1n',fread($f,2)); + return $a['n']; +} + +function ReadLong($f) +{ + $a=unpack('N1N',fread($f,4)); + return $a['N']; +} + +function CheckTTF($file) +{ + //Check if font license allows embedding + $f=fopen($file,'rb'); + if(!$f) + die('Error: Can\'t open '.$file); + //Extract number of tables + fseek($f,4,SEEK_CUR); + $nb=ReadShort($f); + fseek($f,6,SEEK_CUR); + //Seek OS/2 table + $found=false; + for($i=0;$i<$nb;$i++) + { + if(fread($f,4)=='OS/2') + { + $found=true; + break; + } + fseek($f,12,SEEK_CUR); + } + if(!$found) + { + fclose($f); + return; + } + fseek($f,4,SEEK_CUR); + $offset=ReadLong($f); + fseek($f,$offset,SEEK_SET); + //Extract fsType flags + fseek($f,8,SEEK_CUR); + $fsType=ReadShort($f); + $rl=($fsType & 0x02)!=0; + $pp=($fsType & 0x04)!=0; + $e=($fsType & 0x08)!=0; + fclose($f); + if($rl && !$pp && !$e) + echo 'Warning: font license does not allow embedding'; +} + +/******************************************************************************* +* fontfile: path to TTF file (or empty string if not to be embedded0) +* afmfile: path to AFM file +* enc: font encoding (or empty string for symbolic fonts) +* patch: optional patch for encoding +* type: font type if fontfile is empty +*******************************************************************************/ +function MakeFont($fontfile, $afmfile, $enc='cp1252', $patch=array(), $type='TrueType') +{ + //Generate a font definition file + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); + ini_set('auto_detect_line_endings','1'); + if($enc) + { + $map=ReadMap($enc); + foreach($patch as $cc=>$gn) + $map[$cc]=$gn; + } + else + $map=array(); + if(!file_exists($afmfile)) + die('Error: AFM file not found: '.$afmfile); + $fm=ReadAFM($afmfile,$map); + if($enc) + $diff=MakeFontEncoding($map); + else + $diff=''; + $fd=MakeFontDescriptor($fm,empty($map)); + //Find font type + if($fontfile) + { + $ext=strtolower(substr($fontfile,-3)); + if($ext=='ttf') + $type='TrueType'; + elseif($ext=='pfb') + $type='Type1'; + else + die('Error: unrecognized font file extension: '.$ext); + } + else + { + if($type!='TrueType' && $type!='Type1') + die('Error: incorrect font type: '.$type); + } + //Start generation + $s='Error: font file not found: '.$fontfile); + if($type=='TrueType') + CheckTTF($fontfile); + $f=fopen($fontfile,'rb'); + if(!$f) + die('Error: Can\'t open '.$fontfile); + $file=fread($f,filesize($fontfile)); + fclose($f); + if($type=='Type1') + { + //Find first two sections and discard third one + $header=(ord($file[0])==128); + if($header) + { + //Strip first binary header + $file=substr($file,6); + } + $pos=strpos($file,'eexec'); + if(!$pos) + die('Error: font file does not seem to be valid Type1'); + $size1=$pos+6; + if($header && ord($file[$size1])==128) + { + //Strip second binary header + $file=substr($file,0,$size1).substr($file,$size1+6); + } + $pos=strpos($file,'00000000'); + if(!$pos) + die('Error: font file does not seem to be valid Type1'); + $size2=$pos-$size1; + $file=substr($file,0,$size1+$size2); + } + if(function_exists('gzcompress')) + { + $cmp=$basename.'.z'; + SaveToFile($cmp,gzcompress($file),'b'); + $s.='$file=\''.$cmp."';\n"; + echo 'Font file compressed ('.$cmp.')
'; + } + else + { + $s.='$file=\''.basename($fontfile)."';\n"; + echo 'Notice: font file could not be compressed (zlib extension not available)
'; + } + if($type=='Type1') + { + $s.='$size1='.$size1.";\n"; + $s.='$size2='.$size2.";\n"; + } + else + $s.='$originalsize='.filesize($fontfile).";\n"; + } + else + { + //Not embedded font + $s.='$file='."'';\n"; + } + $s.="?>\n"; + SaveToFile($basename.'.php',$s,'t'); + echo 'Font definition file generated ('.$basename.'.php'.')
'; +} +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/symbol.php b/main/inc/lib/html2pdf/_fpdf/font/symbol.php index b556ed84cf..43b50e4511 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/symbol.php +++ b/main/inc/lib/html2pdf/_fpdf/font/symbol.php @@ -1,15 +1,15 @@ -250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, - ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, - 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, - 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, - 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, - chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, - chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, - chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, - chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, - chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); -?> +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549, + ','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722, + 'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768, + 'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576, + 'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0, + chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603, + chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768, + chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042, + chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329, + chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/times.php b/main/inc/lib/html2pdf/_fpdf/font/times.php index b9be1b21d6..837c706e08 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/times.php +++ b/main/inc/lib/html2pdf/_fpdf/font/times.php @@ -1,15 +1,15 @@ -250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, - 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, - 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, - chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); -?> +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722, + 'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944, + 'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/timesb.php b/main/inc/lib/html2pdf/_fpdf/font/timesb.php index c3eb9fa75b..09cff86ac4 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/timesb.php +++ b/main/inc/lib/html2pdf/_fpdf/font/timesb.php @@ -1,15 +1,15 @@ -250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, - 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, - 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, - 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, - chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); -?> +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722, + 'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000, + 'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833, + 'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722, + chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/timesbi.php b/main/inc/lib/html2pdf/_fpdf/font/timesbi.php index 161f6302c8..b4e38d763b 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/timesbi.php +++ b/main/inc/lib/html2pdf/_fpdf/font/timesbi.php @@ -1,15 +1,15 @@ -250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, - 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, - 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, - 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, - chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, - chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, - chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); -?> +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667, + 'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889, + 'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778, + 'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000, + chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333, + chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667, + chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/timesi.php b/main/inc/lib/html2pdf/_fpdf/font/timesi.php index de171fd19e..0ba2b7773d 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/timesi.php +++ b/main/inc/lib/html2pdf/_fpdf/font/timesi.php @@ -1,15 +1,15 @@ -250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, - chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, - ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, - 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, - 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, - 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, - chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, - chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, - chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, - chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, - chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, - chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); -?> +250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250, + chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675, + ','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611, + 'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833, + 'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722, + 'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500, + chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980, + chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333, + chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611, + chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722, + chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500, + chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/font/zapfdingbats.php b/main/inc/lib/html2pdf/_fpdf/font/zapfdingbats.php index f2bdfd5c94..1f926a8c3f 100755 --- a/main/inc/lib/html2pdf/_fpdf/font/zapfdingbats.php +++ b/main/inc/lib/html2pdf/_fpdf/font/zapfdingbats.php @@ -1,15 +1,15 @@ -0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, - chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, - ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, - 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, - 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, - 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, - chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, - chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, - chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, - chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, - chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, - chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); -?> +0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0, + chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939, + ','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692, + 'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776, + 'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873, + 'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317, + chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0, + chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788, + chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788, + chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918, + chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874, + chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0); +?> diff --git a/main/inc/lib/html2pdf/_fpdf/fpdf.php b/main/inc/lib/html2pdf/_fpdf/fpdf.php index ae10e3dc2a..d14c8d7505 100755 --- a/main/inc/lib/html2pdf/_fpdf/fpdf.php +++ b/main/inc/lib/html2pdf/_fpdf/fpdf.php @@ -1,1734 +1,1736 @@ -_dochecks(); - //Initialization of properties - $this->page=0; - $this->n=2; - $this->buffer=''; - $this->pages=array(); - $this->PageSizes=array(); - $this->state=0; - $this->fonts=array(); - $this->FontFiles=array(); - $this->diffs=array(); - $this->images=array(); - $this->links=array(); - $this->InHeader=false; - $this->InFooter=false; - $this->lasth=0; - $this->FontFamily=''; - $this->FontStyle=''; - $this->FontSizePt=12; - $this->underline=false; - $this->DrawColor='0 G'; - $this->FillColor='0 g'; - $this->TextColor='0 g'; - $this->ColorFlag=false; - $this->ws=0; - //Standard fonts - $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', - 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', - 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', - 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); - //Scale factor - if($unit=='pt') - $this->k=1; - elseif($unit=='mm') - $this->k=72/25.4; - elseif($unit=='cm') - $this->k=72/2.54; - elseif($unit=='in') - $this->k=72; - else - $this->Error('Incorrect unit: '.$unit); - //Page format - $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), - 'letter'=>array(612,792), 'legal'=>array(612,1008)); - if(is_string($format)) - $format=$this->_getpageformat($format); - $this->DefPageFormat=$format; - $this->CurPageFormat=$format; - //Page orientation - $orientation=strtolower($orientation); - if($orientation=='p' || $orientation=='portrait') - { - $this->DefOrientation='P'; - $this->w=$this->DefPageFormat[0]; - $this->h=$this->DefPageFormat[1]; - } - elseif($orientation=='l' || $orientation=='landscape') - { - $this->DefOrientation='L'; - $this->w=$this->DefPageFormat[1]; - $this->h=$this->DefPageFormat[0]; - } - else - $this->Error('Incorrect orientation: '.$orientation); - $this->CurOrientation=$this->DefOrientation; - $this->wPt=$this->w*$this->k; - $this->hPt=$this->h*$this->k; - //Page margins (1 cm) - $margin=28.35/$this->k; - $this->SetMargins($margin,$margin); - //Interior cell margin (1 mm) - $this->cMargin=$margin/10; - //Line width (0.2 mm) - $this->LineWidth=.567/$this->k; - //Automatic page break - $this->SetAutoPageBreak(true,2*$margin); - //Full width display mode - $this->SetDisplayMode('fullwidth'); - //Enable compression - $this->SetCompression(true); - //Set default PDF version number - $this->PDFVersion='1.3'; -} - -function SetMargins($left, $top, $right=null) -{ - //Set left, top and right margins - $this->lMargin=$left; - $this->tMargin=$top; - if($right===null) - $right=$left; - $this->rMargin=$right; -} - -function SetLeftMargin($margin) -{ - //Set left margin - $this->lMargin=$margin; - if($this->page>0 && $this->x<$margin) - $this->x=$margin; -} - -function SetTopMargin($margin) -{ - //Set top margin - $this->tMargin=$margin; -} - -function SetRightMargin($margin) -{ - //Set right margin - $this->rMargin=$margin; -} - -function SetAutoPageBreak($auto, $margin=0) -{ - //Set auto page break mode and triggering margin - $this->AutoPageBreak=$auto; - $this->bMargin=$margin; - $this->PageBreakTrigger=$this->h-$margin; -} - -function SetDisplayMode($zoom, $layout='continuous') -{ - //Set display mode in viewer - if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) - $this->ZoomMode=$zoom; - else - $this->Error('Incorrect zoom display mode: '.$zoom); - if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') - $this->LayoutMode=$layout; - else - $this->Error('Incorrect layout display mode: '.$layout); -} - -function SetCompression($compress) -{ - //Set page compression - if(function_exists('gzcompress')) - $this->compress=$compress; - else - $this->compress=false; -} - -function SetTitle($title, $isUTF8=false) -{ - //Title of document - if($isUTF8) - $title=$this->_UTF8toUTF16($title); - $this->title=$title; -} - -function SetSubject($subject, $isUTF8=false) -{ - //Subject of document - if($isUTF8) - $subject=$this->_UTF8toUTF16($subject); - $this->subject=$subject; -} - -function SetAuthor($author, $isUTF8=false) -{ - //Author of document - if($isUTF8) - $author=$this->_UTF8toUTF16($author); - $this->author=$author; -} - -function SetKeywords($keywords, $isUTF8=false) -{ - //Keywords of document - if($isUTF8) - $keywords=$this->_UTF8toUTF16($keywords); - $this->keywords=$keywords; -} - -function SetCreator($creator, $isUTF8=false) -{ - //Creator of document - if($isUTF8) - $creator=$this->_UTF8toUTF16($creator); - $this->creator=$creator; -} - -function AliasNbPages($alias='{nb}') -{ - //Define an alias for total number of pages - $this->AliasNbPages=$alias; -} - -function Error($msg) -{ - //Fatal error - die('FPDF error: '.$msg); -} - -function Open() -{ - //Begin document - $this->state=1; -} - -function Close() -{ - //Terminate document - if($this->state==3) - return; - if($this->page==0) - $this->AddPage(); - //Page footer - $this->InFooter=true; - $this->Footer(); - $this->InFooter=false; - //Close page - $this->_endpage(); - //Close document - $this->_enddoc(); -} - -function AddPage($orientation='', $format='') -{ - //Start a new page - if($this->state==0) - $this->Open(); - $family=$this->FontFamily; - $style=$this->FontStyle.($this->underline ? 'U' : ''); - $size=$this->FontSizePt; - $lw=$this->LineWidth; - $dc=$this->DrawColor; - $fc=$this->FillColor; - $tc=$this->TextColor; - $cf=$this->ColorFlag; - if($this->page>0) - { - //Page footer - $this->InFooter=true; - $this->Footer(); - $this->InFooter=false; - //Close page - $this->_endpage(); - } - //Start new page - $this->_beginpage($orientation,$format); - //Set line cap style to square - $this->_out('2 J'); - //Set line width - $this->LineWidth=$lw; - $this->_out(sprintf('%.2F w',$lw*$this->k)); - //Set font - if($family) - $this->SetFont($family,$style,$size); - //Set colors - $this->DrawColor=$dc; - if($dc!='0 G') - $this->_out($dc); - $this->FillColor=$fc; - if($fc!='0 g') - $this->_out($fc); - $this->TextColor=$tc; - $this->ColorFlag=$cf; - //Page header - $this->InHeader=true; - $this->Header(); - $this->InHeader=false; - //Restore line width - if($this->LineWidth!=$lw) - { - $this->LineWidth=$lw; - $this->_out(sprintf('%.2F w',$lw*$this->k)); - } - //Restore font - if($family) - $this->SetFont($family,$style,$size); - //Restore colors - if($this->DrawColor!=$dc) - { - $this->DrawColor=$dc; - $this->_out($dc); - } - if($this->FillColor!=$fc) - { - $this->FillColor=$fc; - $this->_out($fc); - } - $this->TextColor=$tc; - $this->ColorFlag=$cf; -} - -function Header() -{ - //To be implemented in your own inherited class -} - -function Footer() -{ - //To be implemented in your own inherited class -} - -function PageNo() -{ - //Get current page number - return $this->page; -} - -function SetDrawColor($r, $g=null, $b=null) -{ - //Set color for all stroking operations - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->DrawColor=sprintf('%.3F G',$r/255); - else - $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); - if($this->page>0) - $this->_out($this->DrawColor); -} - -function SetFillColor($r, $g=null, $b=null) -{ - //Set color for all filling operations - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->FillColor=sprintf('%.3F g',$r/255); - else - $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); - $this->ColorFlag=($this->FillColor!=$this->TextColor); - if($this->page>0) - $this->_out($this->FillColor); -} - -function SetTextColor($r, $g=null, $b=null) -{ - //Set color for text - if(($r==0 && $g==0 && $b==0) || $g===null) - $this->TextColor=sprintf('%.3F g',$r/255); - else - $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); - $this->ColorFlag=($this->FillColor!=$this->TextColor); -} - -function GetStringWidth($s) -{ - //Get width of a string in the current font - $s=(string)$s; - $cw=&$this->CurrentFont['cw']; - $w=0; - $l=strlen($s); - for($i=0;$i<$l;$i++) - $w+=$cw[$s[$i]]; - return $w*$this->FontSize/1000; -} - -function SetLineWidth($width) -{ - //Set line width - $this->LineWidth=$width; - if($this->page>0) - $this->_out(sprintf('%.2F w',$width*$this->k)); -} - -function Line($x1, $y1, $x2, $y2) -{ - //Draw a line - $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); -} - -function Rect($x, $y, $w, $h, $style='') -{ - //Draw a rectangle - if($style=='F') - $op='f'; - elseif($style=='FD' || $style=='DF') - $op='B'; - else - $op='S'; - $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); -} - -function AddFont($family, $style='', $file='') -{ - //Add a TrueType or Type1 font - $family=strtolower($family); - if($file=='') - $file=str_replace(' ','',$family).strtolower($style).'.php'; - if($family=='arial') - $family='helvetica'; - $style=strtoupper($style); - if($style=='IB') - $style='BI'; - $fontkey=$family.$style; - if(isset($this->fonts[$fontkey])) - return; - include($this->_getfontpath().$file); - if(!isset($name)) - $this->Error('Could not include font definition file'); - $i=count($this->fonts)+1; - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); - if($diff) - { - //Search existing encodings - $d=0; - $nb=count($this->diffs); - for($i=1;$i<=$nb;$i++) - { - if($this->diffs[$i]==$diff) - { - $d=$i; - break; - } - } - if($d==0) - { - $d=$nb+1; - $this->diffs[$d]=$diff; - } - $this->fonts[$fontkey]['diff']=$d; - } - if($file) - { - if($type=='TrueType') - $this->FontFiles[$file]=array('length1'=>$originalsize); - else - $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); - } -} - -function SetFont($family, $style='', $size=0) -{ - //Select a font; size given in points - global $fpdf_charwidths; - - $family=strtolower($family); - if($family=='') - $family=$this->FontFamily; - if($family=='arial') - $family='helvetica'; - elseif($family=='symbol' || $family=='zapfdingbats') - $style=''; - $style=strtoupper($style); - if(strpos($style,'U')!==false) - { - $this->underline=true; - $style=str_replace('U','',$style); - } - else - $this->underline=false; - if($style=='IB') - $style='BI'; - if($size==0) - $size=$this->FontSizePt; - //Test if font is already selected - if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) - return; - //Test if used for the first time - $fontkey=$family.$style; - if(!isset($this->fonts[$fontkey])) - { - //Check if one of the standard fonts - if(isset($this->CoreFonts[$fontkey])) - { - if(!isset($fpdf_charwidths[$fontkey])) - { - //Load metric file - $file=$family; - if($family=='times' || $family=='helvetica') - $file.=strtolower($style); - include($this->_getfontpath().$file.'.php'); - if(!isset($fpdf_charwidths[$fontkey])) - $this->Error('Could not include font metric file'); - } - $i=count($this->fonts)+1; - $name=$this->CoreFonts[$fontkey]; - $cw=$fpdf_charwidths[$fontkey]; - $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); - } - else - $this->Error('Undefined font: '.$family.' '.$style); - } - //Select it - $this->FontFamily=$family; - $this->FontStyle=$style; - $this->FontSizePt=$size; - $this->FontSize=$size/$this->k; - $this->CurrentFont=&$this->fonts[$fontkey]; - if($this->page>0) - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); -} - -function SetFontSize($size) -{ - //Set font size in points - if($this->FontSizePt==$size) - return; - $this->FontSizePt=$size; - $this->FontSize=$size/$this->k; - if($this->page>0) - $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); -} - -function AddLink() -{ - //Create a new internal link - $n=count($this->links)+1; - $this->links[$n]=array(0, 0); - return $n; -} - -function SetLink($link, $y=0, $page=-1) -{ - //Set destination of internal link - if($y==-1) - $y=$this->y; - if($page==-1) - $page=$this->page; - $this->links[$link]=array($page, $y); -} - -function Link($x, $y, $w, $h, $link) -{ - //Put a link on the page - $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); -} - -function Text($x, $y, $txt) -{ - //Output a string - $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); - if ($txt!='') - { - if($this->underline) $s.=' '.$this->_dounderline($x,$y,$txt); - } - if($this->ColorFlag) - $s='q '.$this->TextColor.' '.$s.' Q'; - $this->_out($s); -} - -function AcceptPageBreak() -{ - //Accept automatic page break or not - return $this->AutoPageBreak; -} - -function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') -{ - //Output a cell - $k=$this->k; - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x=$this->x; - $ws=$this->ws; - if($ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x; - if($ws>0) - { - $this->ws=$ws; - $this->_out(sprintf('%.3F Tw',$ws*$k)); - } - } - if($w==0) - $w=$this->w-$this->rMargin-$this->x; - $s=''; - if($fill || $border==1) - { - if($fill) - $op=($border==1) ? 'B' : 'f'; - else - $op='S'; - $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); - } - if(is_string($border)) - { - $x=$this->x; - $y=$this->y; - if(strpos($border,'L')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); - if(strpos($border,'T')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); - if(strpos($border,'R')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - if(strpos($border,'B')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - } - if($txt!=='') - { - if($align=='R') - $dx=$w-$this->cMargin-$this->GetStringWidth($txt); - elseif($align=='C') - $dx=($w-$this->GetStringWidth($txt))/2; - else - $dx=$this->cMargin; - if($this->ColorFlag) - $s.='q '.$this->TextColor.' '; - $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); - $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); - if($this->underline) - $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); - if($this->ColorFlag) - $s.=' Q'; - if($link) - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); - } - if($s) - $this->_out($s); - $this->lasth=$h; - if($ln>0) - { - //Go to next line - $this->y+=$h; - if($ln==1) - $this->x=$this->lMargin; - } - else - $this->x+=$w; -} - -function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) -{ - //Output text with automatic or explicit line breaks - $cw=&$this->CurrentFont['cw']; - if($w==0) - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); - $nb=strlen($s); - if($nb>0 && $s[$nb-1]=="\n") - $nb--; - $b=0; - if($border) - { - if($border==1) - { - $border='LTRB'; - $b='LRT'; - $b2='LR'; - } - else - { - $b2=''; - if(strpos($border,'L')!==false) - $b2.='L'; - if(strpos($border,'R')!==false) - $b2.='R'; - $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; - } - } - $sep=-1; - $i=0; - $j=0; - $l=0; - $ns=0; - $nl=1; - while($i<$nb) - { - //Get next character - $c=$s[$i]; - if($c=="\n") - { - //Explicit line break - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - $i++; - $sep=-1; - $j=$i; - $l=0; - $ns=0; - $nl++; - if($border && $nl==2) - $b=$b2; - continue; - } - if($c==' ') - { - $sep=$i; - $ls=$l; - $ns++; - } - $l+=$cw[$c]; - if($l>$wmax) - { - //Automatic line break - if($sep==-1) - { - if($i==$j) - $i++; - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - } - else - { - if($align=='J') - { - $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; - $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); - } - $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); - $i=$sep+1; - } - $sep=-1; - $j=$i; - $l=0; - $ns=0; - $nl++; - if($border && $nl==2) - $b=$b2; - } - else - $i++; - } - //Last chunk - if($this->ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - if($border && strpos($border,'B')!==false) - $b.='B'; - $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); - $this->x=$this->lMargin; -} - -function Write($h, $txt, $link='') -{ - //Output text in flowing mode - $cw=&$this->CurrentFont['cw']; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $s=str_replace("\r",'',$txt); - $nb=strlen($s); - $sep=-1; - $i=0; - $j=0; - $l=0; - $nl=1; - while($i<$nb) - { - //Get next character - $c=$s[$i]; - if($c=="\n") - { - //Explicit line break - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); - $i++; - $sep=-1; - $j=$i; - $l=0; - if($nl==1) - { - $this->x=$this->lMargin; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - } - $nl++; - continue; - } - if($c==' ') - $sep=$i; - $l+=$cw[$c]; - if($l>$wmax) - { - //Automatic line break - if($sep==-1) - { - if($this->x>$this->lMargin) - { - //Move to next line - $this->x=$this->lMargin; - $this->y+=$h; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - $i++; - $nl++; - continue; - } - if($i==$j) - $i++; - $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); - } - else - { - $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); - $i=$sep+1; - } - $sep=-1; - $j=$i; - $l=0; - if($nl==1) - { - $this->x=$this->lMargin; - $w=$this->w-$this->rMargin-$this->x; - $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; - } - $nl++; - } - else - $i++; - } - //Last chunk - if($i!=$j) - $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); -} - -function Ln($h=null) -{ - //Line feed; default value is last cell height - $this->x=$this->lMargin; - if($h===null) - $this->y+=$this->lasth; - else - $this->y+=$h; -} - -function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') -{ - //Put an image on the page - if(!isset($this->images[$file])) - { - //First use of this image, get info - if($type=='') - { - $pos=strrpos($file,'.'); - if(!$pos) - $this->Error('Image file has no extension and no type was specified: '.$file); - $type=substr($file,$pos+1); - } - $type=strtolower($type); - if($type=='jpeg') - $type='jpg'; - $mtd='_parse'.$type; - if(!method_exists($this,$mtd)) - $this->Error('Unsupported image type: '.$type); - $info=$this->$mtd($file); - $info['i']=count($this->images)+1; - $this->images[$file]=$info; - } - else - $info=$this->images[$file]; - //Automatic width and height calculation if needed - if($w==0 && $h==0) - { - //Put image at 72 dpi - $w=$info['w']/$this->k; - $h=$info['h']/$this->k; - } - elseif($w==0) - $w=$h*$info['w']/$info['h']; - elseif($h==0) - $h=$w*$info['h']/$info['w']; - //Flowing mode - if($y===null) - { - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x2=$this->x; - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x2; - } - $y=$this->y; - $this->y+=$h; - } - if($x===null) - $x=$this->x; - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); - if($link) - $this->Link($x,$y,$w,$h,$link); -} - -function GetX() -{ - //Get x position - return $this->x; -} - -function SetX($x) -{ - //Set x position - if($x>=0) - $this->x=$x; - else - $this->x=$this->w+$x; -} - -function GetY() -{ - //Get y position - return $this->y; -} - -function SetY($y) -{ - //Set y position and reset x - $this->x=$this->lMargin; - if($y>=0) - $this->y=$y; - else - $this->y=$this->h+$y; -} - -function SetXY($x, $y) -{ - //Set x and y positions - $this->SetY($y); - $this->SetX($x); -} - -function Output($name='', $dest='') -{ - //Output PDF to some destination - if($this->state<3) - $this->Close(); - $dest=strtoupper($dest); - if($dest=='') - { - if($name=='') - { - $name='doc.pdf'; - $dest='I'; - } - else - $dest='F'; - } - switch($dest) - { - case 'I': - //Send to standard output - if(ob_get_length()) - $this->Error('Some data has already been output, can\'t send PDF file'); - if(php_sapi_name()!='cli') - { - //We send to a browser - header('Content-Type: application/pdf'); - if(headers_sent()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Length: '.strlen($this->buffer)); - header('Content-Disposition: inline; filename="'.$name.'"'); - header('Cache-Control: private, max-age=0, must-revalidate'); - header('Pragma: public'); - ini_set('zlib.output_compression','0'); - } - echo $this->buffer; - break; - case 'D': - //Download file - if(ob_get_length()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Type: application/x-download'); - if(headers_sent()) - $this->Error('Some data has already been output, can\'t send PDF file'); - header('Content-Length: '.strlen($this->buffer)); - header('Content-Disposition: attachment; filename="'.$name.'"'); - header('Cache-Control: private, max-age=0, must-revalidate'); - header('Pragma: public'); - ini_set('zlib.output_compression','0'); - echo $this->buffer; - break; - case 'F': - //Save to local file - $f=fopen($name,'wb'); - if(!$f) - $this->Error('Unable to create output file: '.$name); - fwrite($f,$this->buffer,strlen($this->buffer)); - fclose($f); - break; - case 'S': - //Return as a string - return $this->buffer; - default: - $this->Error('Incorrect output destination: '.$dest); - } - return ''; -} - -/******************************************************************************* -* * -* Protected methods * -* * -*******************************************************************************/ -function _dochecks() -{ - //Check availability of %F - if(sprintf('%.1F',1.0)!='1.0') - $this->Error('This version of PHP is not supported'); - //Check mbstring overloading - if(ini_get('mbstring.func_overload') & 2) - $this->Error('mbstring overloading must be disabled'); - //Disable runtime magic quotes - if(get_magic_quotes_runtime()) - @set_magic_quotes_runtime(0); -} - -function _getpageformat($format) -{ - $format=strtolower($format); - if(!isset($this->PageFormats[$format])) - $this->Error('Unknown page format: '.$format); - $a=$this->PageFormats[$format]; - return array($a[0]/$this->k, $a[1]/$this->k); -} - -function _getfontpath() -{ - if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) - define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); - return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; -} - -function _beginpage($orientation, $format) -{ - $this->page++; - $this->pages[$this->page]=''; - $this->state=2; - $this->x=$this->lMargin; - $this->y=$this->tMargin; - $this->FontFamily=''; - //Check page size - if($orientation=='') - $orientation=$this->DefOrientation; - else - $orientation=strtoupper($orientation[0]); - if($format=='') - $format=$this->DefPageFormat; - else - { - if(is_string($format)) - $format=$this->_getpageformat($format); - } - if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) - { - //New size - if($orientation=='P') - { - $this->w=$format[0]; - $this->h=$format[1]; - } - else - { - $this->w=$format[1]; - $this->h=$format[0]; - } - $this->wPt=$this->w*$this->k; - $this->hPt=$this->h*$this->k; - $this->PageBreakTrigger=$this->h-$this->bMargin; - $this->CurOrientation=$orientation; - $this->CurPageFormat=$format; - } - if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) - $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); -} - -function _endpage() -{ - $this->state=1; -} - -function _escape($s) -{ - //Escape special characters in strings - $s=str_replace('\\','\\\\',$s); - $s=str_replace('(','\\(',$s); - $s=str_replace(')','\\)',$s); - $s=str_replace("\r",'\\r',$s); - return $s; -} - -function _textstring($s) -{ - //Format a text string - return '('.$this->_escape($s).')'; -} - -function _UTF8toUTF16($s) -{ - //Convert UTF-8 to UTF-16BE with BOM - $res="\xFE\xFF"; - $nb=strlen($s); - $i=0; - while($i<$nb) - { - $c1=ord($s[$i++]); - if($c1>=224) - { - //3-byte character - $c2=ord($s[$i++]); - $c3=ord($s[$i++]); - $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); - $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); - } - elseif($c1>=192) - { - //2-byte character - $c2=ord($s[$i++]); - $res.=chr(($c1 & 0x1C)>>2); - $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); - } - else - { - //Single-byte character - $res.="\0".chr($c1); - } - } - return $res; -} - -function _dounderline($x, $y, $txt) -{ - //Underline text - $up=$this->CurrentFont['up']; - $ut=$this->CurrentFont['ut']; - $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); - return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); -} - -function _parsejpg($file) -{ - //Extract info from a JPEG file - $a=GetImageSize($file); - if(!$a) - $this->Error('Missing or incorrect image file: '.$file); - if($a[2]!=2) - $this->Error('Not a JPEG file: '.$file); - if(!isset($a['channels']) || $a['channels']==3) - $colspace='DeviceRGB'; - elseif($a['channels']==4) - $colspace='DeviceCMYK'; - else - $colspace='DeviceGray'; - $bpc=isset($a['bits']) ? $a['bits'] : 8; - //Read whole file - $f=fopen($file,'rb'); - $data=''; - while(!feof($f)) - $data.=fread($f,8192); - fclose($f); - return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); -} - -function _parsepng($file) -{ - //Extract info from a PNG file - $f=fopen($file,'rb'); - if(!$f) - $this->Error('Can\'t open image file: '.$file); - //Check signature - if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) - $this->Error('Not a PNG file: '.$file); - //Read header chunk - $this->_readstream($f,4); - if($this->_readstream($f,4)!='IHDR') - $this->Error('Incorrect PNG file: '.$file); - $w=$this->_readint($f); - $h=$this->_readint($f); - $bpc=ord($this->_readstream($f,1)); - if($bpc>8) - $this->Error('16-bit depth not supported: '.$file); - $ct=ord($this->_readstream($f,1)); - if($ct==0) - $colspace='DeviceGray'; - elseif($ct==2) - $colspace='DeviceRGB'; - elseif($ct==3) - $colspace='Indexed'; - else - $this->Error('Alpha channel not supported: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Unknown compression method: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Unknown filter method: '.$file); - if(ord($this->_readstream($f,1))!=0) - $this->Error('Interlacing not supported: '.$file); - $this->_readstream($f,4); - $parms='/DecodeParms <>'; - //Scan chunks looking for palette, transparency and image data - $pal=''; - $trns=''; - $data=''; - do - { - $n=$this->_readint($f); - $type=$this->_readstream($f,4); - if($type=='PLTE') - { - //Read palette - $pal=$this->_readstream($f,$n); - $this->_readstream($f,4); - } - elseif($type=='tRNS') - { - //Read transparency info - $t=$this->_readstream($f,$n); - if($ct==0) - $trns=array(ord(substr($t,1,1))); - elseif($ct==2) - $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); - else - { - $pos=strpos($t,chr(0)); - if($pos!==false) - $trns=array($pos); - } - $this->_readstream($f,4); - } - elseif($type=='IDAT') - { - //Read image data block - $data.=$this->_readstream($f,$n); - $this->_readstream($f,4); - } - elseif($type=='IEND') - break; - else - $this->_readstream($f,$n+4); - } - while($n); - if($colspace=='Indexed' && empty($pal)) - $this->Error('Missing palette in '.$file); - fclose($f); - return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); -} - -function _readstream($f, $n) -{ - //Read n bytes from stream - $res=''; - while($n>0 && !feof($f)) - { - $s=fread($f,$n); - if($s===false) - $this->Error('Error while reading stream'); - $n-=strlen($s); - $res.=$s; - } - if($n>0) - $this->Error('Unexpected end of stream'); - return $res; -} - -function _readint($f) -{ - //Read a 4-byte integer from stream - $a=unpack('Ni',$this->_readstream($f,4)); - return $a['i']; -} - -function _parsegif($file) -{ - //Extract info from a GIF file (via PNG conversion) - if(!function_exists('imagepng')) - $this->Error('GD extension is required for GIF support'); - if(!function_exists('imagecreatefromgif')) - $this->Error('GD has no GIF read support'); - $im=imagecreatefromgif($file); - if(!$im) - $this->Error('Missing or incorrect image file: '.$file); - imageinterlace($im,0); - $tmp=tempnam('.','gif'); - if(!$tmp) - $this->Error('Unable to create a temporary file'); - if(!imagepng($im,$tmp)) - $this->Error('Error while saving to temporary file'); - imagedestroy($im); - $info=$this->_parsepng($tmp); - unlink($tmp); - return $info; -} - -function _newobj() -{ - //Begin a new object - $this->n++; - $this->offsets[$this->n]=strlen($this->buffer); - $this->_out($this->n.' 0 obj'); -} - -function _putstream($s) -{ - $this->_out('stream'); - $this->_out($s); - $this->_out('endstream'); -} - -function _out($s) -{ - //Add a line to the document - if($this->state==2) - $this->pages[$this->page].=$s."\n"; - else - $this->buffer.=$s."\n"; -} - -function _putpages() -{ - $nb=$this->page; - if(!empty($this->AliasNbPages)) - { - //Replace number of pages - for($n=1;$n<=$nb;$n++) - $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); - } - if($this->DefOrientation=='P') - { - $wPt=$this->DefPageFormat[0]*$this->k; - $hPt=$this->DefPageFormat[1]*$this->k; - } - else - { - $wPt=$this->DefPageFormat[1]*$this->k; - $hPt=$this->DefPageFormat[0]*$this->k; - } - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - for($n=1;$n<=$nb;$n++) - { - //Page - $this->_newobj(); - $this->_out('<_out('/Parent 1 0 R'); - if(isset($this->PageSizes[$n])) - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); - $this->_out('/Resources 2 0 R'); - if(isset($this->PageLinks[$n])) - { - //Links - $annots='/Annots ['; - foreach($this->PageLinks[$n] as $pl) - { - $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); - $annots.='<_textstring($pl[4]).'>>>>'; - else - { - $l=$this->links[$pl[4]]; - $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; - $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); - } - } - $this->_out($annots.']'); - } - $this->_out('/Contents '.($this->n+1).' 0 R>>'); - $this->_out('endobj'); - //Page content - $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; - $this->_newobj(); - $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); - $this->_putstream($p); - $this->_out('endobj'); - } - //Pages root - $this->offsets[1]=strlen($this->buffer); - $this->_out('1 0 obj'); - $this->_out('<_out($kids.']'); - $this->_out('/Count '.$nb); - $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); - $this->_out('>>'); - $this->_out('endobj'); -} - -function _putfonts() -{ - $nf=$this->n; - foreach($this->diffs as $diff) - { - //Encodings - $this->_newobj(); - $this->_out('<>'); - $this->_out('endobj'); - } - foreach($this->FontFiles as $file=>$info) - { - //Font file embedding - $this->_newobj(); - $this->FontFiles[$file]['n']=$this->n; - $font=''; - $f=fopen($this->_getfontpath().$file,'rb',1); - if(!$f) - $this->Error('Font file not found'); - while(!feof($f)) - $font.=fread($f,8192); - fclose($f); - $compressed=(substr($file,-2)=='.z'); - if(!$compressed && isset($info['length2'])) - { - $header=(ord($font[0])==128); - if($header) - { - //Strip first binary header - $font=substr($font,6); - } - if($header && ord($font[$info['length1']])==128) - { - //Strip second binary header - $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); - } - } - $this->_out('<_out('/Filter /FlateDecode'); - $this->_out('/Length1 '.$info['length1']); - if(isset($info['length2'])) - $this->_out('/Length2 '.$info['length2'].' /Length3 0'); - $this->_out('>>'); - $this->_putstream($font); - $this->_out('endobj'); - } - foreach($this->fonts as $k=>$font) - { - //Font objects - $this->fonts[$k]['n']=$this->n+1; - $type=$font['type']; - $name=$font['name']; - if($type=='core') - { - //Standard font - $this->_newobj(); - $this->_out('<_out('/BaseFont /'.$name); - $this->_out('/Subtype /Type1'); - if($name!='Symbol' && $name!='ZapfDingbats') - $this->_out('/Encoding /WinAnsiEncoding'); - $this->_out('>>'); - $this->_out('endobj'); - } - elseif($type=='Type1' || $type=='TrueType') - { - //Additional Type1 or TrueType font - $this->_newobj(); - $this->_out('<_out('/BaseFont /'.$name); - $this->_out('/Subtype /'.$type); - $this->_out('/FirstChar 32 /LastChar 255'); - $this->_out('/Widths '.($this->n+1).' 0 R'); - $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); - if($font['enc']) - { - if(isset($font['diff'])) - $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); - else - $this->_out('/Encoding /WinAnsiEncoding'); - } - $this->_out('>>'); - $this->_out('endobj'); - //Widths - $this->_newobj(); - $cw=&$font['cw']; - $s='['; - for($i=32;$i<=255;$i++) - $s.=$cw[chr($i)].' '; - $this->_out($s.']'); - $this->_out('endobj'); - //Descriptor - $this->_newobj(); - $s='<$v) - $s.=' /'.$k.' '.$v; - $file=$font['file']; - if($file) - $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; - $this->_out($s.'>>'); - $this->_out('endobj'); - } - else - { - //Allow for additional types - $mtd='_put'.strtolower($type); - if(!method_exists($this,$mtd)) - $this->Error('Unsupported font type: '.$type); - $this->$mtd($font); - } - } -} - -function _putimages() -{ - $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; - reset($this->images); - while(list($file,$info)=each($this->images)) - { - $this->_newobj(); - $this->images[$file]['n']=$this->n; - $this->_out('<_out('/Subtype /Image'); - $this->_out('/Width '.$info['w']); - $this->_out('/Height '.$info['h']); - if($info['cs']=='Indexed') - $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); - else - { - $this->_out('/ColorSpace /'.$info['cs']); - if($info['cs']=='DeviceCMYK') - $this->_out('/Decode [1 0 1 0 1 0 1 0]'); - } - $this->_out('/BitsPerComponent '.$info['bpc']); - if(isset($info['f'])) - $this->_out('/Filter /'.$info['f']); - if(isset($info['parms'])) - $this->_out($info['parms']); - if(isset($info['trns']) && is_array($info['trns'])) - { - $trns=''; - for($i=0;$i_out('/Mask ['.$trns.']'); - } - $this->_out('/Length '.strlen($info['data']).'>>'); - $this->_putstream($info['data']); - unset($this->images[$file]['data']); - $this->_out('endobj'); - //Palette - if($info['cs']=='Indexed') - { - $this->_newobj(); - $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; - $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); - $this->_putstream($pal); - $this->_out('endobj'); - } - } -} - -function _putxobjectdict() -{ - foreach($this->images as $image) - $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); -} - -function _putresourcedict() -{ - $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); - $this->_out('/Font <<'); - foreach($this->fonts as $font) - $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); - $this->_out('>>'); - $this->_out('/XObject <<'); - $this->_putxobjectdict(); - $this->_out('>>'); -} - -function _putresources() -{ - $this->_putfonts(); - $this->_putimages(); - //Resource dictionary - $this->offsets[2]=strlen($this->buffer); - $this->_out('2 0 obj'); - $this->_out('<<'); - $this->_putresourcedict(); - $this->_out('>>'); - $this->_out('endobj'); -} - -function _putinfo() -{ - $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); - if(!empty($this->title)) - $this->_out('/Title '.$this->_textstring($this->title)); - if(!empty($this->subject)) - $this->_out('/Subject '.$this->_textstring($this->subject)); - if(!empty($this->author)) - $this->_out('/Author '.$this->_textstring($this->author)); - if(!empty($this->keywords)) - $this->_out('/Keywords '.$this->_textstring($this->keywords)); - if(!empty($this->creator)) - $this->_out('/Creator '.$this->_textstring($this->creator)); - $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); -} - -function _putcatalog() -{ - $this->_out('/Type /Catalog'); - $this->_out('/Pages 1 0 R'); - if($this->ZoomMode=='fullpage') - $this->_out('/OpenAction [3 0 R /Fit]'); - elseif($this->ZoomMode=='fullwidth') - $this->_out('/OpenAction [3 0 R /FitH null]'); - elseif($this->ZoomMode=='real') - $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); - elseif(!is_string($this->ZoomMode)) - $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); - if($this->LayoutMode=='single') - $this->_out('/PageLayout /SinglePage'); - elseif($this->LayoutMode=='continuous') - $this->_out('/PageLayout /OneColumn'); - elseif($this->LayoutMode=='two') - $this->_out('/PageLayout /TwoColumnLeft'); -} - -function _putheader() -{ - $this->_out('%PDF-'.$this->PDFVersion); -} - -function _puttrailer() -{ - $this->_out('/Size '.($this->n+1)); - $this->_out('/Root '.$this->n.' 0 R'); - $this->_out('/Info '.($this->n-1).' 0 R'); -} - -function _enddoc() -{ - $this->_putheader(); - $this->_putpages(); - $this->_putresources(); - //Info - $this->_newobj(); - $this->_out('<<'); - $this->_putinfo(); - $this->_out('>>'); - $this->_out('endobj'); - //Catalog - $this->_newobj(); - $this->_out('<<'); - $this->_putcatalog(); - $this->_out('>>'); - $this->_out('endobj'); - //Cross-ref - $o=strlen($this->buffer); - $this->_out('xref'); - $this->_out('0 '.($this->n+1)); - $this->_out('0000000000 65535 f '); - for($i=1;$i<=$this->n;$i++) - $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); - //Trailer - $this->_out('trailer'); - $this->_out('<<'); - $this->_puttrailer(); - $this->_out('>>'); - $this->_out('startxref'); - $this->_out($o); - $this->_out('%%EOF'); - $this->state=3; -} -//End of class -} - -//Handle special IE contype request -if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') -{ - header('Content-Type: application/pdf'); - exit; -} - -?> +_dochecks(); + //Initialization of properties + $this->page=0; + $this->n=2; + $this->buffer=''; + $this->pages=array(); + $this->PageSizes=array(); + $this->state=0; + $this->fonts=array(); + $this->FontFiles=array(); + $this->diffs=array(); + $this->images=array(); + $this->links=array(); + $this->InHeader=false; + $this->InFooter=false; + $this->lasth=0; + $this->FontFamily=''; + $this->FontStyle=''; + $this->FontSizePt=12; + $this->underline=false; + $this->DrawColor='0 G'; + $this->FillColor='0 g'; + $this->TextColor='0 g'; + $this->ColorFlag=false; + $this->ws=0; + //Standard fonts + $this->CoreFonts=array('courier'=>'Courier', 'courierB'=>'Courier-Bold', 'courierI'=>'Courier-Oblique', 'courierBI'=>'Courier-BoldOblique', + 'helvetica'=>'Helvetica', 'helveticaB'=>'Helvetica-Bold', 'helveticaI'=>'Helvetica-Oblique', 'helveticaBI'=>'Helvetica-BoldOblique', + 'times'=>'Times-Roman', 'timesB'=>'Times-Bold', 'timesI'=>'Times-Italic', 'timesBI'=>'Times-BoldItalic', + 'symbol'=>'Symbol', 'zapfdingbats'=>'ZapfDingbats'); + //Scale factor + if($unit=='pt') + $this->k=1; + elseif($unit=='mm') + $this->k=72/25.4; + elseif($unit=='cm') + $this->k=72/2.54; + elseif($unit=='in') + $this->k=72; + else + $this->Error('Incorrect unit: '.$unit); + //Page format + $this->PageFormats=array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28), + 'letter'=>array(612,792), 'legal'=>array(612,1008)); + if(is_string($format)) + $format=$this->_getpageformat($format); + $this->DefPageFormat=$format; + $this->CurPageFormat=$format; + //Page orientation + $orientation=strtolower($orientation); + if($orientation=='p' || $orientation=='portrait') + { + $this->DefOrientation='P'; + $this->w=$this->DefPageFormat[0]; + $this->h=$this->DefPageFormat[1]; + } + elseif($orientation=='l' || $orientation=='landscape') + { + $this->DefOrientation='L'; + $this->w=$this->DefPageFormat[1]; + $this->h=$this->DefPageFormat[0]; + } + else + $this->Error('Incorrect orientation: '.$orientation); + $this->CurOrientation=$this->DefOrientation; + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + //Page margins (1 cm) + $margin=28.35/$this->k; + $this->SetMargins($margin,$margin); + //Interior cell margin (1 mm) + $this->cMargin=$margin/10; + //Line width (0.2 mm) + $this->LineWidth=.567/$this->k; + //Automatic page break + $this->SetAutoPageBreak(true,2*$margin); + //Full width display mode + $this->SetDisplayMode('fullwidth'); + //Enable compression + $this->SetCompression(true); + //Set default PDF version number + $this->PDFVersion='1.3'; +} + +function SetMargins($left, $top, $right=null) +{ + //Set left, top and right margins + $this->lMargin=$left; + $this->tMargin=$top; + if($right===null) + $right=$left; + $this->rMargin=$right; +} + +function SetLeftMargin($margin) +{ + //Set left margin + $this->lMargin=$margin; + if($this->page>0 && $this->x<$margin) + $this->x=$margin; +} + +function SetTopMargin($margin) +{ + //Set top margin + $this->tMargin=$margin; +} + +function SetRightMargin($margin) +{ + //Set right margin + $this->rMargin=$margin; +} + +function SetAutoPageBreak($auto, $margin=0) +{ + //Set auto page break mode and triggering margin + $this->AutoPageBreak=$auto; + $this->bMargin=$margin; + $this->PageBreakTrigger=$this->h-$margin; +} + +function SetDisplayMode($zoom, $layout='continuous') +{ + //Set display mode in viewer + if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom)) + $this->ZoomMode=$zoom; + else + $this->Error('Incorrect zoom display mode: '.$zoom); + if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default') + $this->LayoutMode=$layout; + else + $this->Error('Incorrect layout display mode: '.$layout); +} + +function SetCompression($compress) +{ + //Set page compression + if(function_exists('gzcompress')) + $this->compress=$compress; + else + $this->compress=false; +} + +function SetTitle($title, $isUTF8=false) +{ + //Title of document + if($isUTF8) + $title=$this->_UTF8toUTF16($title); + $this->title=$title; +} + +function SetSubject($subject, $isUTF8=false) +{ + //Subject of document + if($isUTF8) + $subject=$this->_UTF8toUTF16($subject); + $this->subject=$subject; +} + +function SetAuthor($author, $isUTF8=false) +{ + //Author of document + if($isUTF8) + $author=$this->_UTF8toUTF16($author); + $this->author=$author; +} + +function SetKeywords($keywords, $isUTF8=false) +{ + //Keywords of document + if($isUTF8) + $keywords=$this->_UTF8toUTF16($keywords); + $this->keywords=$keywords; +} + +function SetCreator($creator, $isUTF8=false) +{ + //Creator of document + if($isUTF8) + $creator=$this->_UTF8toUTF16($creator); + $this->creator=$creator; +} + +function AliasNbPages($alias='{nb}') +{ + //Define an alias for total number of pages + $this->AliasNbPages=$alias; +} + +function Error($msg) +{ + //Fatal error + die('FPDF error: '.$msg); +} + +function Open() +{ + //Begin document + $this->state=1; +} + +function Close() +{ + //Terminate document + if($this->state==3) + return; + if($this->page==0) + $this->AddPage(); + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + //Close document + $this->_enddoc(); +} + +function AddPage($orientation='', $format='') +{ + //Start a new page + if($this->state==0) + $this->Open(); + $family=$this->FontFamily; + $style=$this->FontStyle.($this->underline ? 'U' : ''); + $size=$this->FontSizePt; + $lw=$this->LineWidth; + $dc=$this->DrawColor; + $fc=$this->FillColor; + $tc=$this->TextColor; + $cf=$this->ColorFlag; + if($this->page>0) + { + //Page footer + $this->InFooter=true; + $this->Footer(); + $this->InFooter=false; + //Close page + $this->_endpage(); + } + //Start new page + $this->_beginpage($orientation,$format); + //Set line cap style to square + $this->_out('2 J'); + //Set line width + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + //Set font + if($family) + $this->SetFont($family,$style,$size); + //Set colors + $this->DrawColor=$dc; + if($dc!='0 G') + $this->_out($dc); + $this->FillColor=$fc; + if($fc!='0 g') + $this->_out($fc); + $this->TextColor=$tc; + $this->ColorFlag=$cf; + //Page header + $this->InHeader=true; + $this->Header(); + $this->InHeader=false; + //Restore line width + if($this->LineWidth!=$lw) + { + $this->LineWidth=$lw; + $this->_out(sprintf('%.2F w',$lw*$this->k)); + } + //Restore font + if($family) + $this->SetFont($family,$style,$size); + //Restore colors + if($this->DrawColor!=$dc) + { + $this->DrawColor=$dc; + $this->_out($dc); + } + if($this->FillColor!=$fc) + { + $this->FillColor=$fc; + $this->_out($fc); + } + $this->TextColor=$tc; + $this->ColorFlag=$cf; +} + +function Header() +{ + //To be implemented in your own inherited class +} + +function Footer() +{ + //To be implemented in your own inherited class +} + +function PageNo() +{ + //Get current page number + return $this->page; +} + +function SetDrawColor($r, $g=null, $b=null) +{ + //Set color for all stroking operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->DrawColor=sprintf('%.3F G',$r/255); + else + $this->DrawColor=sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255); + if($this->page>0) + $this->_out($this->DrawColor); +} + +function SetFillColor($r, $g=null, $b=null) +{ + //Set color for all filling operations + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->FillColor=sprintf('%.3F g',$r/255); + else + $this->FillColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) + $this->_out($this->FillColor); +} + +function SetTextColor($r, $g=null, $b=null) +{ + //Set color for text + if(($r==0 && $g==0 && $b==0) || $g===null) + $this->TextColor=sprintf('%.3F g',$r/255); + else + $this->TextColor=sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255); + $this->ColorFlag=($this->FillColor!=$this->TextColor); +} + +function GetStringWidth($s) +{ + //Get width of a string in the current font + $s=(string)$s; + $cw=&$this->CurrentFont['cw']; + $w=0; + $l=strlen($s); + for($i=0;$i<$l;$i++) + $w+=$cw[$s[$i]]; + return $w*$this->FontSize/1000; +} + +function SetLineWidth($width) +{ + //Set line width + $this->LineWidth=$width; + if($this->page>0) + $this->_out(sprintf('%.2F w',$width*$this->k)); +} + +function Line($x1, $y1, $x2, $y2) +{ + //Draw a line + $this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k)); +} + +function Rect($x, $y, $w, $h, $style='') +{ + //Draw a rectangle + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op)); +} + +function AddFont($family, $style='', $file='') +{ + //Add a TrueType or Type1 font + $family=strtolower($family); + if($file=='') + $file=str_replace(' ','',$family).strtolower($style).'.php'; + if($family=='arial') + $family='helvetica'; + $style=strtoupper($style); + if($style=='IB') + $style='BI'; + $fontkey=$family.$style; + if(isset($this->fonts[$fontkey])) + return; + include($this->_getfontpath().$file); + if(!isset($name)) + $this->Error('Could not include font definition file'); + $i=count($this->fonts)+1; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>$type, 'name'=>$name, 'desc'=>$desc, 'up'=>$up, 'ut'=>$ut, 'cw'=>$cw, 'enc'=>$enc, 'file'=>$file); + if($diff) + { + //Search existing encodings + $d=0; + $nb=count($this->diffs); + for($i=1;$i<=$nb;$i++) + { + if($this->diffs[$i]==$diff) + { + $d=$i; + break; + } + } + if($d==0) + { + $d=$nb+1; + $this->diffs[$d]=$diff; + } + $this->fonts[$fontkey]['diff']=$d; + } + if($file) + { + if($type=='TrueType') + $this->FontFiles[$file]=array('length1'=>$originalsize); + else + $this->FontFiles[$file]=array('length1'=>$size1, 'length2'=>$size2); + } +} + +function SetFont($family, $style='', $size=0) +{ + //Select a font; size given in points + global $fpdf_charwidths; + + $family=strtolower($family); + if($family=='') + $family=$this->FontFamily; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + $style=strtoupper($style); + if(strpos($style,'U')!==false) + { + $this->underline=true; + $style=str_replace('U','',$style); + } + else + $this->underline=false; + if($style=='IB') + $style='BI'; + if($size==0) + $size=$this->FontSizePt; + //Test if font is already selected + if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size) + return; + //Test if used for the first time + $fontkey=$family.$style; + if(!isset($this->fonts[$fontkey])) + { + //Check if one of the standard fonts + if(isset($this->CoreFonts[$fontkey])) + { + if(!isset($fpdf_charwidths[$fontkey])) + { + //Load metric file + $file=$family; + if($family=='times' || $family=='helvetica') + $file.=strtolower($style); + include($this->_getfontpath().$file.'.php'); + if(!isset($fpdf_charwidths[$fontkey])) + $this->Error('Could not include font metric file'); + } + $i=count($this->fonts)+1; + $name=$this->CoreFonts[$fontkey]; + $cw=$fpdf_charwidths[$fontkey]; + $this->fonts[$fontkey]=array('i'=>$i, 'type'=>'core', 'name'=>$name, 'up'=>-100, 'ut'=>50, 'cw'=>$cw); + } + else + $this->Error('Undefined font: '.$family.' '.$style); + } + //Select it + $this->FontFamily=$family; + $this->FontStyle=$style; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + $this->CurrentFont=&$this->fonts[$fontkey]; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function SetFontSize($size) +{ + //Set font size in points + if($this->FontSizePt==$size) + return; + $this->FontSizePt=$size; + $this->FontSize=$size/$this->k; + if($this->page>0) + $this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt)); +} + +function AddLink() +{ + //Create a new internal link + $n=count($this->links)+1; + $this->links[$n]=array(0, 0); + return $n; +} + +function SetLink($link, $y=0, $page=-1) +{ + //Set destination of internal link + if($y==-1) + $y=$this->y; + if($page==-1) + $page=$this->page; + $this->links[$link]=array($page, $y); +} + +function Link($x, $y, $w, $h, $link) +{ + //Put a link on the page + $this->PageLinks[$this->page][]=array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link); +} + +function Text($x, $y, $txt) +{ + //Output a string + $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + if ($txt!='') + { + if($this->underline) $s.=' '.$this->_dounderline($x,$y,$txt); + } + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); +} + +function AcceptPageBreak() +{ + //Accept automatic page break or not + return $this->AutoPageBreak; +} + +function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') +{ + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3F Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill || $border==1) + { + if($fill) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + if($this->underline) + $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; +} + +function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false) +{ + //Output text with automatic or explicit line breaks + $cw=&$this->CurrentFont['cw']; + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + if($nb>0 && $s[$nb-1]=="\n") + $nb--; + $b=0; + if($border) + { + if($border==1) + { + $border='LTRB'; + $b='LRT'; + $b2='LR'; + } + else + { + $b2=''; + if(strpos($border,'L')!==false) + $b2.='L'; + if(strpos($border,'R')!==false) + $b2.='R'; + $b=(strpos($border,'T')!==false) ? $b2.'T' : $b2; + } + } + $sep=-1; + $i=0; + $j=0; + $l=0; + $ns=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $i++; + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + continue; + } + if($c==' ') + { + $sep=$i; + $ls=$l; + $ns++; + } + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($i==$j) + $i++; + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + } + else + { + if($align=='J') + { + $this->ws=($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; + $this->_out(sprintf('%.3F Tw',$this->ws*$this->k)); + } + $this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + $ns=0; + $nl++; + if($border && $nl==2) + $b=$b2; + } + else + $i++; + } + //Last chunk + if($this->ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + if($border && strpos($border,'B')!==false) + $b.='B'; + $this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill); + $this->x=$this->lMargin; +} + +function Write($h, $txt, $link='') +{ + //Output text in flowing mode + $cw=&$this->CurrentFont['cw']; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $s=str_replace("\r",'',$txt); + $nb=strlen($s); + $sep=-1; + $i=0; + $j=0; + $l=0; + $nl=1; + while($i<$nb) + { + //Get next character + $c=$s[$i]; + if($c=="\n") + { + //Explicit line break + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + $i++; + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + continue; + } + if($c==' ') + $sep=$i; + $l+=$cw[$c]; + if($l>$wmax) + { + //Automatic line break + if($sep==-1) + { + if($this->x>$this->lMargin) + { + //Move to next line + $this->x=$this->lMargin; + $this->y+=$h; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + $i++; + $nl++; + continue; + } + if($i==$j) + $i++; + $this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link); + } + else + { + $this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link); + $i=$sep+1; + } + $sep=-1; + $j=$i; + $l=0; + if($nl==1) + { + $this->x=$this->lMargin; + $w=$this->w-$this->rMargin-$this->x; + $wmax=($w-2*$this->cMargin)*1000/$this->FontSize; + } + $nl++; + } + else + $i++; + } + //Last chunk + if($i!=$j) + $this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link); +} + +function Ln($h=null) +{ + //Line feed; default value is last cell height + $this->x=$this->lMargin; + if($h===null) + $this->y+=$this->lasth; + else + $this->y+=$h; +} +/* + * en commentaire car erreur PHP : + * Strict Standards: Declaration of FPDF_Alpha::Image() should be compatible with that of FPDF::Image() + */ +/* +function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') +{ + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of this image, get info + if($type=='') + { + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); + } + $type=strtolower($type); + if($type=='jpeg') + $type='jpg'; + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + $info['i']=count($this->images)+1; + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + elseif($w==0) + $w=$h*$info['w']/$info['h']; + elseif($h==0) + $h=$w*$info['h']/$info['w']; + //Flowing mode + if($y===null) + { + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x2=$this->x; + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x2; + } + $y=$this->y; + $this->y+=$h; + } + if($x===null) + $x=$this->x; + $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) + $this->Link($x,$y,$w,$h,$link); +} +*/ +function GetX() +{ + //Get x position + return $this->x; +} + +function SetX($x) +{ + //Set x position + if($x>=0) + $this->x=$x; + else + $this->x=$this->w+$x; +} + +function GetY() +{ + //Get y position + return $this->y; +} + +function SetY($y) +{ + //Set y position and reset x + $this->x=$this->lMargin; + if($y>=0) + $this->y=$y; + else + $this->y=$this->h+$y; +} + +function SetXY($x, $y) +{ + //Set x and y positions + $this->SetY($y); + $this->SetX($x); +} + +function Output($name='', $dest='') +{ + //Output PDF to some destination + if($this->state<3) + $this->Close(); + $dest=strtoupper($dest); + if($dest=='') + { + if($name=='') + { + $name='doc.pdf'; + $dest='I'; + } + else + $dest='F'; + } + switch($dest) + { + case 'I': + //Send to standard output + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + if(php_sapi_name()!='cli') + { + //We send to a browser + header('Content-Type: application/pdf'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: inline; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + } + echo $this->buffer; + break; + case 'D': + //Download file + if(ob_get_length()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Type: application/x-download'); + if(headers_sent()) + $this->Error('Some data has already been output, can\'t send PDF file'); + header('Content-Length: '.strlen($this->buffer)); + header('Content-Disposition: attachment; filename="'.$name.'"'); + header('Cache-Control: private, max-age=0, must-revalidate'); + header('Pragma: public'); + ini_set('zlib.output_compression','0'); + echo $this->buffer; + break; + case 'F': + //Save to local file + $f=fopen($name,'wb'); + if(!$f) + $this->Error('Unable to create output file: '.$name); + fwrite($f,$this->buffer,strlen($this->buffer)); + fclose($f); + break; + case 'S': + //Return as a string + return $this->buffer; + default: + $this->Error('Incorrect output destination: '.$dest); + } + return ''; +} + +/******************************************************************************* +* * +* Protected methods * +* * +*******************************************************************************/ +function _dochecks() +{ + //Check availability of %F + if(sprintf('%.1F',1.0)!='1.0') + $this->Error('This version of PHP is not supported'); + //Check mbstring overloading + if(ini_get('mbstring.func_overload') & 2) + $this->Error('mbstring overloading must be disabled'); + //Disable runtime magic quotes + if(get_magic_quotes_runtime()) + @set_magic_quotes_runtime(0); +} + +function _getpageformat($format) +{ + $format=strtolower($format); + if(!isset($this->PageFormats[$format])) + $this->Error('Unknown page format: '.$format); + $a=$this->PageFormats[$format]; + return array($a[0]/$this->k, $a[1]/$this->k); +} + +function _getfontpath() +{ + if(!defined('FPDF_FONTPATH') && is_dir(dirname(__FILE__).'/font')) + define('FPDF_FONTPATH',dirname(__FILE__).'/font/'); + return defined('FPDF_FONTPATH') ? FPDF_FONTPATH : ''; +} + +function _beginpage($orientation, $format) +{ + $this->page++; + $this->pages[$this->page]=''; + $this->state=2; + $this->x=$this->lMargin; + $this->y=$this->tMargin; + $this->FontFamily=''; + //Check page size + if($orientation=='') + $orientation=$this->DefOrientation; + else + $orientation=strtoupper($orientation[0]); + if($format=='') + $format=$this->DefPageFormat; + else + { + if(is_string($format)) + $format=$this->_getpageformat($format); + } + if($orientation!=$this->CurOrientation || $format[0]!=$this->CurPageFormat[0] || $format[1]!=$this->CurPageFormat[1]) + { + //New size + if($orientation=='P') + { + $this->w=$format[0]; + $this->h=$format[1]; + } + else + { + $this->w=$format[1]; + $this->h=$format[0]; + } + $this->wPt=$this->w*$this->k; + $this->hPt=$this->h*$this->k; + $this->PageBreakTrigger=$this->h-$this->bMargin; + $this->CurOrientation=$orientation; + $this->CurPageFormat=$format; + } + if($orientation!=$this->DefOrientation || $format[0]!=$this->DefPageFormat[0] || $format[1]!=$this->DefPageFormat[1]) + $this->PageSizes[$this->page]=array($this->wPt, $this->hPt); +} + +function _endpage() +{ + $this->state=1; +} + +function _escape($s) +{ + //Escape special characters in strings + $s=str_replace('\\','\\\\',$s); + $s=str_replace('(','\\(',$s); + $s=str_replace(')','\\)',$s); + $s=str_replace("\r",'\\r',$s); + return $s; +} + +function _textstring($s) +{ + //Format a text string + return '('.$this->_escape($s).')'; +} + +function _UTF8toUTF16($s) +{ + //Convert UTF-8 to UTF-16BE with BOM + $res="\xFE\xFF"; + $nb=strlen($s); + $i=0; + while($i<$nb) + { + $c1=ord($s[$i++]); + if($c1>=224) + { + //3-byte character + $c2=ord($s[$i++]); + $c3=ord($s[$i++]); + $res.=chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2)); + $res.=chr((($c2 & 0x03)<<6) + ($c3 & 0x3F)); + } + elseif($c1>=192) + { + //2-byte character + $c2=ord($s[$i++]); + $res.=chr(($c1 & 0x1C)>>2); + $res.=chr((($c1 & 0x03)<<6) + ($c2 & 0x3F)); + } + else + { + //Single-byte character + $res.="\0".chr($c1); + } + } + return $res; +} + +function _dounderline($x, $y, $txt) +{ + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + $w=$this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '); + return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt); +} + +function _parsejpg($file) +{ + //Extract info from a JPEG file + $a=GetImageSize($file); + if(!$a) + $this->Error('Missing or incorrect image file: '.$file); + if($a[2]!=2) + $this->Error('Not a JPEG file: '.$file); + if(!isset($a['channels']) || $a['channels']==3) + $colspace='DeviceRGB'; + elseif($a['channels']==4) + $colspace='DeviceCMYK'; + else + $colspace='DeviceGray'; + $bpc=isset($a['bits']) ? $a['bits'] : 8; + //Read whole file + $f=fopen($file,'rb'); + $data=''; + while(!feof($f)) + $data.=fread($f,8192); + fclose($f); + return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data); +} + +function _parsepng($file) +{ + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + $this->_readstream($f,4); + if($this->_readstream($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_readint($f); + $h=$this->_readint($f); + $bpc=ord($this->_readstream($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord($this->_readstream($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + $this->Error('Alpha channel not supported: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord($this->_readstream($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + $this->_readstream($f,4); + $parms='/DecodeParms <>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_readint($f); + $type=$this->_readstream($f,4); + if($type=='PLTE') + { + //Read palette + $pal=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=$this->_readstream($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + $this->_readstream($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=$this->_readstream($f,$n); + $this->_readstream($f,4); + } + elseif($type=='IEND') + break; + else + $this->_readstream($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'parms'=>$parms, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data); +} + +function _readstream($f, $n) +{ + //Read n bytes from stream + $res=''; + while($n>0 && !feof($f)) + { + $s=fread($f,$n); + if($s===false) + $this->Error('Error while reading stream'); + $n-=strlen($s); + $res.=$s; + } + if($n>0) + $this->Error('Unexpected end of stream'); + return $res; +} + +function _readint($f) +{ + //Read a 4-byte integer from stream + $a=unpack('Ni',$this->_readstream($f,4)); + return $a['i']; +} + +function _parsegif($file) +{ + //Extract info from a GIF file (via PNG conversion) + if(!function_exists('imagepng')) + $this->Error('GD extension is required for GIF support'); + if(!function_exists('imagecreatefromgif')) + $this->Error('GD has no GIF read support'); + $im=imagecreatefromgif($file); + if(!$im) + $this->Error('Missing or incorrect image file: '.$file); + imageinterlace($im,0); + $tmp=tempnam('.','gif'); + if(!$tmp) + $this->Error('Unable to create a temporary file'); + if(!imagepng($im,$tmp)) + $this->Error('Error while saving to temporary file'); + imagedestroy($im); + $info=$this->_parsepng($tmp); + unlink($tmp); + return $info; +} + +function _newobj() +{ + //Begin a new object + $this->n++; + $this->offsets[$this->n]=strlen($this->buffer); + $this->_out($this->n.' 0 obj'); +} + +function _putstream($s) +{ + $this->_out('stream'); + $this->_out($s); + $this->_out('endstream'); +} + +function _out($s) +{ + //Add a line to the document + if($this->state==2) + $this->pages[$this->page].=$s."\n"; + else + $this->buffer.=$s."\n"; +} + +function _putpages() +{ + $nb=$this->page; + if(!empty($this->AliasNbPages)) + { + //Replace number of pages + for($n=1;$n<=$nb;$n++) + $this->pages[$n]=str_replace($this->AliasNbPages,$nb,$this->pages[$n]); + } + if($this->DefOrientation=='P') + { + $wPt=$this->DefPageFormat[0]*$this->k; + $hPt=$this->DefPageFormat[1]*$this->k; + } + else + { + $wPt=$this->DefPageFormat[1]*$this->k; + $hPt=$this->DefPageFormat[0]*$this->k; + } + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + for($n=1;$n<=$nb;$n++) + { + //Page + $this->_newobj(); + $this->_out('<_out('/Parent 1 0 R'); + if(isset($this->PageSizes[$n])) + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1])); + $this->_out('/Resources 2 0 R'); + if(isset($this->PageLinks[$n])) + { + //Links + $annots='/Annots ['; + foreach($this->PageLinks[$n] as $pl) + { + $rect=sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]); + $annots.='<_textstring($pl[4]).'>>>>'; + else + { + $l=$this->links[$pl[4]]; + $h=isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt; + $annots.=sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k); + } + } + $this->_out($annots.']'); + } + $this->_out('/Contents '.($this->n+1).' 0 R>>'); + $this->_out('endobj'); + //Page content + $p=($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n]; + $this->_newobj(); + $this->_out('<<'.$filter.'/Length '.strlen($p).'>>'); + $this->_putstream($p); + $this->_out('endobj'); + } + //Pages root + $this->offsets[1]=strlen($this->buffer); + $this->_out('1 0 obj'); + $this->_out('<_out($kids.']'); + $this->_out('/Count '.$nb); + $this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt)); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putfonts() +{ + $nf=$this->n; + foreach($this->diffs as $diff) + { + //Encodings + $this->_newobj(); + $this->_out('<>'); + $this->_out('endobj'); + } + foreach($this->FontFiles as $file=>$info) + { + //Font file embedding + $this->_newobj(); + $this->FontFiles[$file]['n']=$this->n; + $font=''; + $f=fopen($this->_getfontpath().$file,'rb',1); + if(!$f) + $this->Error('Font file not found'); + while(!feof($f)) + $font.=fread($f,8192); + fclose($f); + $compressed=(substr($file,-2)=='.z'); + if(!$compressed && isset($info['length2'])) + { + $header=(ord($font[0])==128); + if($header) + { + //Strip first binary header + $font=substr($font,6); + } + if($header && ord($font[$info['length1']])==128) + { + //Strip second binary header + $font=substr($font,0,$info['length1']).substr($font,$info['length1']+6); + } + } + $this->_out('<_out('/Filter /FlateDecode'); + $this->_out('/Length1 '.$info['length1']); + if(isset($info['length2'])) + $this->_out('/Length2 '.$info['length2'].' /Length3 0'); + $this->_out('>>'); + $this->_putstream($font); + $this->_out('endobj'); + } + foreach($this->fonts as $k=>$font) + { + //Font objects + $this->fonts[$k]['n']=$this->n+1; + $type=$font['type']; + $name=$font['name']; + if($type=='core') + { + //Standard font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /Type1'); + if($name!='Symbol' && $name!='ZapfDingbats') + $this->_out('/Encoding /WinAnsiEncoding'); + $this->_out('>>'); + $this->_out('endobj'); + } + elseif($type=='Type1' || $type=='TrueType') + { + //Additional Type1 or TrueType font + $this->_newobj(); + $this->_out('<_out('/BaseFont /'.$name); + $this->_out('/Subtype /'.$type); + $this->_out('/FirstChar 32 /LastChar 255'); + $this->_out('/Widths '.($this->n+1).' 0 R'); + $this->_out('/FontDescriptor '.($this->n+2).' 0 R'); + if($font['enc']) + { + if(isset($font['diff'])) + $this->_out('/Encoding '.($nf+$font['diff']).' 0 R'); + else + $this->_out('/Encoding /WinAnsiEncoding'); + } + $this->_out('>>'); + $this->_out('endobj'); + //Widths + $this->_newobj(); + $cw=&$font['cw']; + $s='['; + for($i=32;$i<=255;$i++) + $s.=$cw[chr($i)].' '; + $this->_out($s.']'); + $this->_out('endobj'); + //Descriptor + $this->_newobj(); + $s='<$v) + $s.=' /'.$k.' '.$v; + $file=$font['file']; + if($file) + $s.=' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$file]['n'].' 0 R'; + $this->_out($s.'>>'); + $this->_out('endobj'); + } + else + { + //Allow for additional types + $mtd='_put'.strtolower($type); + if(!method_exists($this,$mtd)) + $this->Error('Unsupported font type: '.$type); + $this->$mtd($font); + } + } +} + +function _putimages() +{ + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } +} + +function _putxobjectdict() +{ + foreach($this->images as $image) + $this->_out('/I'.$image['i'].' '.$image['n'].' 0 R'); +} + +function _putresourcedict() +{ + $this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]'); + $this->_out('/Font <<'); + foreach($this->fonts as $font) + $this->_out('/F'.$font['i'].' '.$font['n'].' 0 R'); + $this->_out('>>'); + $this->_out('/XObject <<'); + $this->_putxobjectdict(); + $this->_out('>>'); +} + +function _putresources() +{ + $this->_putfonts(); + $this->_putimages(); + //Resource dictionary + $this->offsets[2]=strlen($this->buffer); + $this->_out('2 0 obj'); + $this->_out('<<'); + $this->_putresourcedict(); + $this->_out('>>'); + $this->_out('endobj'); +} + +function _putinfo() +{ + $this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION)); + if(!empty($this->title)) + $this->_out('/Title '.$this->_textstring($this->title)); + if(!empty($this->subject)) + $this->_out('/Subject '.$this->_textstring($this->subject)); + if(!empty($this->author)) + $this->_out('/Author '.$this->_textstring($this->author)); + if(!empty($this->keywords)) + $this->_out('/Keywords '.$this->_textstring($this->keywords)); + if(!empty($this->creator)) + $this->_out('/Creator '.$this->_textstring($this->creator)); + $this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis'))); +} + +function _putcatalog() +{ + $this->_out('/Type /Catalog'); + $this->_out('/Pages 1 0 R'); + if($this->ZoomMode=='fullpage') + $this->_out('/OpenAction [3 0 R /Fit]'); + elseif($this->ZoomMode=='fullwidth') + $this->_out('/OpenAction [3 0 R /FitH null]'); + elseif($this->ZoomMode=='real') + $this->_out('/OpenAction [3 0 R /XYZ null null 1]'); + elseif(!is_string($this->ZoomMode)) + $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode/100).']'); + if($this->LayoutMode=='single') + $this->_out('/PageLayout /SinglePage'); + elseif($this->LayoutMode=='continuous') + $this->_out('/PageLayout /OneColumn'); + elseif($this->LayoutMode=='two') + $this->_out('/PageLayout /TwoColumnLeft'); +} + +function _putheader() +{ + $this->_out('%PDF-'.$this->PDFVersion); +} + +function _puttrailer() +{ + $this->_out('/Size '.($this->n+1)); + $this->_out('/Root '.$this->n.' 0 R'); + $this->_out('/Info '.($this->n-1).' 0 R'); +} + +function _enddoc() +{ + $this->_putheader(); + $this->_putpages(); + $this->_putresources(); + //Info + $this->_newobj(); + $this->_out('<<'); + $this->_putinfo(); + $this->_out('>>'); + $this->_out('endobj'); + //Catalog + $this->_newobj(); + $this->_out('<<'); + $this->_putcatalog(); + $this->_out('>>'); + $this->_out('endobj'); + //Cross-ref + $o=strlen($this->buffer); + $this->_out('xref'); + $this->_out('0 '.($this->n+1)); + $this->_out('0000000000 65535 f '); + for($i=1;$i<=$this->n;$i++) + $this->_out(sprintf('%010d 00000 n ',$this->offsets[$i])); + //Trailer + $this->_out('trailer'); + $this->_out('<<'); + $this->_puttrailer(); + $this->_out('>>'); + $this->_out('startxref'); + $this->_out($o); + $this->_out('%%EOF'); + $this->state=3; +} +//End of class +} + +//Handle special IE contype request +if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype') +{ + header('Content-Type: application/pdf'); + exit; +} diff --git a/main/inc/lib/html2pdf/_fpdf/license.txt b/main/inc/lib/html2pdf/_fpdf/license.txt index 6107ee4777..fd811c6f56 100755 --- a/main/inc/lib/html2pdf/_fpdf/license.txt +++ b/main/inc/lib/html2pdf/_fpdf/license.txt @@ -1,6 +1,6 @@ -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software to use, copy, modify, distribute, sublicense, and/or sell -copies of the software, and to permit persons to whom the software is furnished -to do so. - +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software to use, copy, modify, distribute, sublicense, and/or sell +copies of the software, and to permit persons to whom the software is furnished +to do so. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. \ No newline at end of file diff --git a/main/inc/lib/html2pdf/_mypdf/00_fpdf_codebar.class.php b/main/inc/lib/html2pdf/_mypdf/00_fpdf_codebar.class.php index 9fb8ff05cb..220f05b7ea 100755 --- a/main/inc/lib/html2pdf/_mypdf/00_fpdf_codebar.class.php +++ b/main/inc/lib/html2pdf/_mypdf/00_fpdf_codebar.class.php @@ -1,238 +1,237 @@ -FPDF($sens, $unit, $format); - } - - function BARCODE_EAN13($x,$y,$barcode,$h=10,$w=.35) - { - return $this->Barcode($x,$y,$barcode,$h,$w,13); - } - - function BARCODE_UPC_A($x,$y,$barcode,$h=10,$w=.35) - { - return $this->Barcode($x,$y,$barcode,$h,$w,12); - } - - function GetCheckDigit($barcode) - { - //Compute the check digit - $sum=0; - for($i=1;$i<=11;$i+=2) - $sum+=3*$barcode{$i}; - for($i=0;$i<=10;$i+=2) - $sum+=$barcode{$i}; - $r=$sum%10; - if($r>0) - $r=10-$r; - return $r; - } - - function TestCheckDigit($barcode) - { - //Test validity of check digit - $sum=0; - for($i=1;$i<=11;$i+=2) - $sum+=3*$barcode{$i}; - for($i=0;$i<=10;$i+=2) - $sum+=$barcode{$i}; - return ($sum+$barcode{12})%10==0; - } - - function Barcode($x,$y,$barcode,$h,$w,$len) - { - //Padding - $barcode=str_pad($barcode,$len-1,'0',STR_PAD_LEFT); - if($len==12) - $barcode='0'.$barcode; - //Add or control the check digit - if(strlen($barcode)==12) - $barcode.=$this->GetCheckDigit($barcode); - elseif(!$this->TestCheckDigit($barcode)) - $this->Error('Incorrect check digit'); - //Convert digits to bars - $codes=array( - 'A'=>array( - '0'=>'0001101','1'=>'0011001','2'=>'0010011','3'=>'0111101','4'=>'0100011', - '5'=>'0110001','6'=>'0101111','7'=>'0111011','8'=>'0110111','9'=>'0001011'), - 'B'=>array( - '0'=>'0100111','1'=>'0110011','2'=>'0011011','3'=>'0100001','4'=>'0011101', - '5'=>'0111001','6'=>'0000101','7'=>'0010001','8'=>'0001001','9'=>'0010111'), - 'C'=>array( - '0'=>'1110010','1'=>'1100110','2'=>'1101100','3'=>'1000010','4'=>'1011100', - '5'=>'1001110','6'=>'1010000','7'=>'1000100','8'=>'1001000','9'=>'1110100') - ); - $parities=array( - '0'=>array('A','A','A','A','A','A'), - '1'=>array('A','A','B','A','B','B'), - '2'=>array('A','A','B','B','A','B'), - '3'=>array('A','A','B','B','B','A'), - '4'=>array('A','B','A','A','B','B'), - '5'=>array('A','B','B','A','A','B'), - '6'=>array('A','B','B','B','A','A'), - '7'=>array('A','B','A','B','A','B'), - '8'=>array('A','B','A','B','B','A'), - '9'=>array('A','B','B','A','B','A') - ); - $code='101'; - $p=$parities[$barcode{0}]; - for($i=1;$i<=6;$i++) - $code.=$codes[$p[$i-1]][$barcode{$i}]; - $code.='01010'; - for($i=7;$i<=12;$i++) - $code.=$codes['C'][$barcode{$i}]; - $code.='101'; - //Draw bars - for($i=0;$iRect($x+$i*$w,$y,$w,$h,'F'); - } - - $code_w = strlen($code)*$w; - $code_t = substr($barcode,-$len); - - $code_f = $code_w/strlen($code_t)*$this->k/0.60; - $code_h = $h+$code_f/$this->k; - - //Print text uder barcode - $this->SetFont('Arial','',$code_f); - $this->Text($x,$y+$h+0.90*$code_f/$this->k,$code_t); - - return array($code_w, $code_h); - } - - function BARCODE_CODE39($xpos, $ypos, $code,$height=10, $baseline=0.5 ) - { - - $wide = $baseline; - $narrow = $baseline / 3 ; - $gap = $narrow; - - $barChar['0'] = 'nnnwwnwnn'; - $barChar['1'] = 'wnnwnnnnw'; - $barChar['2'] = 'nnwwnnnnw'; - $barChar['3'] = 'wnwwnnnnn'; - $barChar['4'] = 'nnnwwnnnw'; - $barChar['5'] = 'wnnwwnnnn'; - $barChar['6'] = 'nnwwwnnnn'; - $barChar['7'] = 'nnnwnnwnw'; - $barChar['8'] = 'wnnwnnwnn'; - $barChar['9'] = 'nnwwnnwnn'; - $barChar['A'] = 'wnnnnwnnw'; - $barChar['B'] = 'nnwnnwnnw'; - $barChar['C'] = 'wnwnnwnnn'; - $barChar['D'] = 'nnnnwwnnw'; - $barChar['E'] = 'wnnnwwnnn'; - $barChar['F'] = 'nnwnwwnnn'; - $barChar['G'] = 'nnnnnwwnw'; - $barChar['H'] = 'wnnnnwwnn'; - $barChar['I'] = 'nnwnnwwnn'; - $barChar['J'] = 'nnnnwwwnn'; - $barChar['K'] = 'wnnnnnnww'; - $barChar['L'] = 'nnwnnnnww'; - $barChar['M'] = 'wnwnnnnwn'; - $barChar['N'] = 'nnnnwnnww'; - $barChar['O'] = 'wnnnwnnwn'; - $barChar['P'] = 'nnwnwnnwn'; - $barChar['Q'] = 'nnnnnnwww'; - $barChar['R'] = 'wnnnnnwwn'; - $barChar['S'] = 'nnwnnnwwn'; - $barChar['T'] = 'nnnnwnwwn'; - $barChar['U'] = 'wwnnnnnnw'; - $barChar['V'] = 'nwwnnnnnw'; - $barChar['W'] = 'wwwnnnnnn'; - $barChar['X'] = 'nwnnwnnnw'; - $barChar['Y'] = 'wwnnwnnnn'; - $barChar['Z'] = 'nwwnwnnnn'; - $barChar['-'] = 'nwnnnnwnw'; - $barChar['.'] = 'wwnnnnwnn'; - $barChar[' '] = 'nwwnnnwnn'; - $barChar['*'] = 'nwnnwnwnn'; - $barChar['$'] = 'nwnwnwnnn'; - $barChar['/'] = 'nwnwnnnwn'; - $barChar['+'] = 'nwnnnwnwn'; - $barChar['%'] = 'nnnwnwnwn'; - - $xpos_dep = $xpos; - $code = '*'.strtoupper($code).'*'; - for($i=0; $iError('Invalid character in barcode: '.$char); - } - $seq = $barChar[$char]; - for($bar=0; $bar<9; $bar++){ - if($seq{$bar} == 'n'){ - $lineWidth = $narrow; - }else{ - $lineWidth = $wide; - } - if($bar % 2 == 0){ - $this->Rect($xpos, $ypos, $lineWidth, $height, 'F'); - } - $xpos += $lineWidth; - } - $xpos += $gap; - } - - $code_w = $xpos-$xpos_dep; - $code_t = $code; - - $code_f = $code_w/strlen($code_t)*$this->k/0.60/3; - $code_h = $height+$code_f/$this->k; - - //Print text uder barcode - $this->SetFont('Arial','',$code_f); - $this->Text($xpos_dep,$ypos+$height+0.90*$code_f/$this->k,$code_t); - - return array($code_w, $code_h); - } - } -} -?> \ No newline at end of file +FPDF($sens, $unit, $format); + } + + function BARCODE_EAN13($x,$y,$barcode,$h=10,$w=.35) + { + return $this->Barcode($x,$y,$barcode,$h,$w,13); + } + + function BARCODE_UPC_A($x,$y,$barcode,$h=10,$w=.35) + { + return $this->Barcode($x,$y,$barcode,$h,$w,12); + } + + function GetCheckDigit($barcode) + { + //Compute the check digit + $sum=0; + for($i=1;$i<=11;$i+=2) + $sum+=3*$barcode{$i}; + for($i=0;$i<=10;$i+=2) + $sum+=$barcode{$i}; + $r=$sum%10; + if($r>0) + $r=10-$r; + return $r; + } + + function TestCheckDigit($barcode) + { + //Test validity of check digit + $sum=0; + for($i=1;$i<=11;$i+=2) + $sum+=3*$barcode{$i}; + for($i=0;$i<=10;$i+=2) + $sum+=$barcode{$i}; + return ($sum+$barcode{12})%10==0; + } + + function Barcode($x,$y,$barcode,$h,$w,$len) + { + //Padding + $barcode=str_pad($barcode,$len-1,'0',STR_PAD_LEFT); + if($len==12) + $barcode='0'.$barcode; + //Add or control the check digit + if(strlen($barcode)==12) + $barcode.=$this->GetCheckDigit($barcode); + elseif(!$this->TestCheckDigit($barcode)) + $this->Error('Incorrect check digit'); + //Convert digits to bars + $codes=array( + 'A'=>array( + '0'=>'0001101','1'=>'0011001','2'=>'0010011','3'=>'0111101','4'=>'0100011', + '5'=>'0110001','6'=>'0101111','7'=>'0111011','8'=>'0110111','9'=>'0001011'), + 'B'=>array( + '0'=>'0100111','1'=>'0110011','2'=>'0011011','3'=>'0100001','4'=>'0011101', + '5'=>'0111001','6'=>'0000101','7'=>'0010001','8'=>'0001001','9'=>'0010111'), + 'C'=>array( + '0'=>'1110010','1'=>'1100110','2'=>'1101100','3'=>'1000010','4'=>'1011100', + '5'=>'1001110','6'=>'1010000','7'=>'1000100','8'=>'1001000','9'=>'1110100') + ); + $parities=array( + '0'=>array('A','A','A','A','A','A'), + '1'=>array('A','A','B','A','B','B'), + '2'=>array('A','A','B','B','A','B'), + '3'=>array('A','A','B','B','B','A'), + '4'=>array('A','B','A','A','B','B'), + '5'=>array('A','B','B','A','A','B'), + '6'=>array('A','B','B','B','A','A'), + '7'=>array('A','B','A','B','A','B'), + '8'=>array('A','B','A','B','B','A'), + '9'=>array('A','B','B','A','B','A') + ); + $code='101'; + $p=$parities[$barcode{0}]; + for($i=1;$i<=6;$i++) + $code.=$codes[$p[$i-1]][$barcode{$i}]; + $code.='01010'; + for($i=7;$i<=12;$i++) + $code.=$codes['C'][$barcode{$i}]; + $code.='101'; + //Draw bars + for($i=0;$iRect($x+$i*$w,$y,$w,$h,'F'); + } + + $code_w = strlen($code)*$w; + $code_t = substr($barcode,-$len); + + $code_f = $code_w/strlen($code_t)*$this->k/0.60; + $code_h = $h+$code_f/$this->k; + + //Print text uder barcode + $this->SetFont('Arial','',$code_f); + $this->Text($x,$y+$h+0.90*$code_f/$this->k,$code_t); + + return array($code_w, $code_h); + } + + function BARCODE_CODE39($xpos, $ypos, $code,$height=10, $baseline=0.5 ) + { + + $wide = $baseline; + $narrow = $baseline / 3 ; + $gap = $narrow; + + $barChar['0'] = 'nnnwwnwnn'; + $barChar['1'] = 'wnnwnnnnw'; + $barChar['2'] = 'nnwwnnnnw'; + $barChar['3'] = 'wnwwnnnnn'; + $barChar['4'] = 'nnnwwnnnw'; + $barChar['5'] = 'wnnwwnnnn'; + $barChar['6'] = 'nnwwwnnnn'; + $barChar['7'] = 'nnnwnnwnw'; + $barChar['8'] = 'wnnwnnwnn'; + $barChar['9'] = 'nnwwnnwnn'; + $barChar['A'] = 'wnnnnwnnw'; + $barChar['B'] = 'nnwnnwnnw'; + $barChar['C'] = 'wnwnnwnnn'; + $barChar['D'] = 'nnnnwwnnw'; + $barChar['E'] = 'wnnnwwnnn'; + $barChar['F'] = 'nnwnwwnnn'; + $barChar['G'] = 'nnnnnwwnw'; + $barChar['H'] = 'wnnnnwwnn'; + $barChar['I'] = 'nnwnnwwnn'; + $barChar['J'] = 'nnnnwwwnn'; + $barChar['K'] = 'wnnnnnnww'; + $barChar['L'] = 'nnwnnnnww'; + $barChar['M'] = 'wnwnnnnwn'; + $barChar['N'] = 'nnnnwnnww'; + $barChar['O'] = 'wnnnwnnwn'; + $barChar['P'] = 'nnwnwnnwn'; + $barChar['Q'] = 'nnnnnnwww'; + $barChar['R'] = 'wnnnnnwwn'; + $barChar['S'] = 'nnwnnnwwn'; + $barChar['T'] = 'nnnnwnwwn'; + $barChar['U'] = 'wwnnnnnnw'; + $barChar['V'] = 'nwwnnnnnw'; + $barChar['W'] = 'wwwnnnnnn'; + $barChar['X'] = 'nwnnwnnnw'; + $barChar['Y'] = 'wwnnwnnnn'; + $barChar['Z'] = 'nwwnwnnnn'; + $barChar['-'] = 'nwnnnnwnw'; + $barChar['.'] = 'wwnnnnwnn'; + $barChar[' '] = 'nwwnnnwnn'; + $barChar['*'] = 'nwnnwnwnn'; + $barChar['$'] = 'nwnwnwnnn'; + $barChar['/'] = 'nwnwnnnwn'; + $barChar['+'] = 'nwnnnwnwn'; + $barChar['%'] = 'nnnwnwnwn'; + + $xpos_dep = $xpos; + $code = '*'.strtoupper($code).'*'; + for($i=0; $iError('Invalid character in barcode: '.$char); + } + $seq = $barChar[$char]; + for($bar=0; $bar<9; $bar++){ + if($seq{$bar} == 'n'){ + $lineWidth = $narrow; + }else{ + $lineWidth = $wide; + } + if($bar % 2 == 0){ + $this->Rect($xpos, $ypos, $lineWidth, $height, 'F'); + } + $xpos += $lineWidth; + } + $xpos += $gap; + } + + $code_w = $xpos-$xpos_dep; + $code_t = $code; + + $code_f = $code_w/strlen($code_t)*$this->k/0.60/3; + $code_h = $height+$code_f/$this->k; + + //Print text uder barcode + $this->SetFont('Arial','',$code_f); + $this->Text($xpos_dep,$ypos+$height+0.90*$code_f/$this->k,$code_t); + + return array($code_w, $code_h); + } + } +} \ No newline at end of file diff --git a/main/inc/lib/html2pdf/_mypdf/01_fpdf_bookmark.class.php b/main/inc/lib/html2pdf/_mypdf/01_fpdf_bookmark.class.php index 80e70a3d63..89d65900ae 100755 --- a/main/inc/lib/html2pdf/_mypdf/01_fpdf_bookmark.class.php +++ b/main/inc/lib/html2pdf/_mypdf/01_fpdf_bookmark.class.php @@ -1,27 +1,27 @@ FPDF_Codebar($orientation,$unit,$format); - + } - + function Bookmark($txt, $level=0, $y=0) { if($y==-1) $y=$this->GetY(); $this->outlines[]=array('t'=>$txt, 'l'=>$level, 'y'=>($this->h-$y)*$this->k, 'p'=>$this->PageNo()); } - + function _putbookmarks() { $nb=count($this->outlines); @@ -67,7 +67,7 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); } else $this->outlines[$i]['parent']=$nb; - + if($o['l']<=$level and $i>0) { //Set prev and next pointers @@ -78,7 +78,7 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); $lru[$o['l']]=$i; $level=$o['l']; } - + //Outline items $n=$this->n+1; foreach($this->outlines as $i=>$o) @@ -98,7 +98,7 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); $this->_out('/Count 0>>'); $this->_out('endobj'); } - + //Outline root $this->_newobj(); $this->OutlineRoot=$this->n; @@ -106,13 +106,13 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); $this->_out('/Last '.($n+$lru[0]).' 0 R>>'); $this->_out('endobj'); } - + function _putresources() { parent::_putresources(); $this->_putbookmarks(); } - + function _putcatalog() { parent::_putcatalog(); @@ -122,17 +122,17 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); $this->_out('/PageMode /UseOutlines'); } } - + function CreateIndex(&$obj, $titre = 'Index', $size_title = 20, $size_bookmark = 15, $bookmark_title = true, $display_page = true) { if ($bookmark_title) $this->Bookmark($titre, 0, -1); - + //Index title $this->SetFontSize($size_title); $this->Cell(0,5,$titre,0,1,'C'); $this->SetFontSize($size_bookmark); $this->Ln(10); - + $size=sizeof($this->outlines); $PageCellSize=$this->GetStringWidth('p. '.$this->outlines[$size-1]['p'])+2; for ($i=0;$i<$size;$i++) @@ -142,11 +142,11 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); $obj->setNewPage(); $this->SetFontSize($size_bookmark); } - + //Offset $level=$this->outlines[$i]['l']; if($level>0) $this->Cell($level*8); - + //Caption $str=$this->outlines[$i]['t']; $strsize=$this->GetStringWidth($str); @@ -159,7 +159,7 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); if ($display_page) { $this->Cell($strsize+2,$this->FontSize+2,$str); - + //Filling dots $w=$this->w-$this->lMargin-$this->rMargin-$PageCellSize-($level*8)-($strsize+2); $nb=$w/$this->GetStringWidth('.'); @@ -171,10 +171,9 @@ require_once(dirname(__FILE__).'/00_fpdf_codebar.class.php'); } else { - $this->Cell($strsize+2,$this->FontSize+2,$str, 0, 1); + $this->Cell($strsize+2,$this->FontSize+2,$str, 0, 1); } } } } } -?> \ No newline at end of file diff --git a/main/inc/lib/html2pdf/_mypdf/02_fpdf_formulaire.class.php b/main/inc/lib/html2pdf/_mypdf/02_fpdf_formulaire.class.php index 65a0b4a73a..d1b6e70d6f 100755 --- a/main/inc/lib/html2pdf/_mypdf/02_fpdf_formulaire.class.php +++ b/main/inc/lib/html2pdf/_mypdf/02_fpdf_formulaire.class.php @@ -1,9 +1,9 @@ */ @@ -11,29 +11,29 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) { define('__CLASS_FPDF_FORMULAIRE__', true); - + require_once(dirname(__FILE__).'/01_fpdf_bookmark.class.php'); - + class FPDF_Formulaire extends FPDF_BookMark { var $javascript = ''; //javascript code - var $n_js; //num�ro de l'objet javascript - var $n_cata; //num�ro de l'objet catalogue + var $n_js; //numéro de l'objet javascript + var $n_cata; //numéro de l'objet catalogue var $ur; // - + function FPDF_Formulaire($orientation='P',$unit='mm',$format='A4') { $this->FPDF_BookMark($orientation,$unit,$format); $this->PDFVersion='1.6'; - + $this->ur = false; } - + function _putuserrights() { if (!$this->ur) return; $this->_out('/Perms<<'); - + $this->_out('/UR3<<'); $this->_out('/Reference[<<'); $this->_out('/Type /SigRef'); @@ -50,20 +50,20 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) $this->_out('>>'); $this->_out('>>'); } - + function _putresources() { - + parent::_putresources(); $this->_putjavascript(); } - + function _putcatalog() { $this->n_cata = $this->n; - + parent::_putcatalog(); - + if (!empty($this->javascript)) $this->_out('/Names <n_js).' 0 R>>'); $this->_putuserrights(); } @@ -71,12 +71,12 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) /* * Create a javascript PDF string. * @access protected - * @author Johannes G�ntert, Nicola Asuni + * @author Johannes Güntert, Nicola Asuni */ function _putjavascript() { if (empty($this->javascript)) return; - + // the following two lines are used to avoid form fields duplication after saving if ($this->ur) { @@ -86,9 +86,9 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) else { $js1 = ''; - $js2 = ''; + $js2 = ''; } - + $this->_newobj(); $this->n_js = $this->n; $this->_out('<<'); @@ -102,7 +102,7 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) $this->_out('>>'); $this->_out('endobj'); } - + /* * Convert color to javascript color. * @param string $color color name or #RRGGBB @@ -120,10 +120,10 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) { $this->Error('Invalid color: '.$color); } - + return 'color.'.$color; } - + /* * Adds a javascript form field. * @param string $type field type @@ -149,10 +149,10 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) $r = 0.1; $this->Rect($x+$d*0.5+$r, $y-$d*0.5+$r, $w-$d-2*$r, $h-$d-2*$r, 'F'); } - - // javascript inclus + + // javascript inclus $this->ur = true; - + // the followind avoid fields duplication after saving the document $this->javascript .= "if(this.getField('pdfoldsaved') && this.getField('pdfoldsaved').value != 'saved') {"; $this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%d,[%.2F,%.2F,%.2F,%.2F]);", $name, $type, $this->PageNo()-1, $x*$this->k, ($this->h-$y)*$this->k+1, ($x+$w)*$this->k, ($this->h-$y-$h)*$this->k+1)."\n"; @@ -165,23 +165,23 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) $val = '"'.$val.'"'; $this->javascript .= 'f'.$name.'.'.$key.'='.$val.";\n"; } - + $this->javascript .= '}'; $this->javascript.= "\n".$js_after; } - + function IncludeJS($script) { $this->javascript .= $script; } - + function form_InputHidden($name, $value) { $prop = array('value' => $value); $js_after = ''; $this->_addfield('checkbox', $name, 0, 0, 0.1, 0.1, $prop, $js_after); } - + function form_InputCheckBox($name, $x, $y, $w, $checked) { $prop = array(); @@ -189,20 +189,20 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) $js_after = ''; $this->_addfield('checkbox', $name, $x, $y, $w, $w, $prop, $js_after); } - + function form_InputRadio($name, $x, $y, $w) { $prop = array(); $js_after = ''; $this->_addfield('radiobutton', $name, $x, $y, $w, $w, $prop, $js_after); } - + function form_InputText($name, $x, $y, $w, $h, $prop) { $js_after = ''; $this->_addfield('text', $name, $x, $y, $w, $h, $prop, $js_after); } - + function form_InputButton($name, $x, $y, $w, $h, $caption, $action, $prop) { if (!isset($prop['borderStyle'])) $prop['borderStyle'] = 'beveled'; @@ -218,11 +218,10 @@ if (!defined('__CLASS_FPDF_FORMULAIRE__')) function form_Select($name, $x, $y, $w, $h, $values, $multiligne, $prop) { - $type = ($multiligne ? 'listbox' : 'combobox'); + $type = ($multiligne ? 'listbox' : 'combobox'); $s = ''; foreach ($values as $value) { $s .= ($s ? ',' : '')."'".addslashes($value)."'"; } $js_after = 'f'.$name.'.setItems(['.$s."]);\n"; $this->_addfield($type, $name, $x, $y, $w, $h, $prop, $js_after); } } } -?> \ No newline at end of file diff --git a/main/inc/lib/html2pdf/_mypdf/03_fpdf_alpha.class.php b/main/inc/lib/html2pdf/_mypdf/03_fpdf_alpha.class.php new file mode 100644 index 0000000000..6af47e891a --- /dev/null +++ b/main/inc/lib/html2pdf/_mypdf/03_fpdf_alpha.class.php @@ -0,0 +1,326 @@ +FPDF_Formulaire($orientation,$unit,$format); + } + + /* Public methods */ + function Image($file,$x,$y,$w=0,$h=0,$type='',$link='', $isMask=false, $maskImg=0) + { + //Put an image on the page + if(!isset($this->images[$file])) + { + //First use of image, get info + if($type=='') + { + /* MODIFICATION HTML2PDF pour le support des images PHP */ + $type = explode('?', $file); + $type = pathinfo($type[0]); + if (!isset($type['extension']) || !$type['extension']) + $this->Error('Image file has no extension and no type was specified: '.$file); + + $type = $type['extension']; + /* FIN MODIFICATION */ +/* + $pos=strrpos($file,'.'); + if(!$pos) + $this->Error('Image file has no extension and no type was specified: '.$file); + $type=substr($file,$pos+1); +*/ + } + $type=strtolower($type); + + /* MODIFICATION HTML2PDF pour le support des images PHP et CGI*/ + if ($type=='php' || $type=='cgi') + { + // identification des infos + $infos=@GetImageSize($file); + if (!$infos) $this->Error('Unsupported image : '.$file); + + // identification du type + $type = explode('/', $infos['mime']); + if ($type[0]!='image') $this->Error('Unsupported image : '.$file); + $type = $type[1]; + } + /* FIN MODIFICATION */ + +// $mqr=get_magic_quotes_runtime(); +// set_magic_quotes_runtime(0); + if($type=='jpg' || $type=='jpeg') + $info=$this->_parsejpg($file); + elseif($type=='png') + { + $info=$this->_parsepng($file); + if ($info=='alpha') + return $this->ImagePngWithAlpha($file,$x,$y,$w,$h,$link); + } + else + { + //Allow for additional formats + $mtd='_parse'.$type; + if(!method_exists($this,$mtd)) + $this->Error('Unsupported image type: '.$type); + $info=$this->$mtd($file); + } +// set_magic_quotes_runtime($mqr); + + if ($isMask) + { + $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed) + } + $info['i']=count($this->images)+1; + if ($maskImg>0) $info['masked'] = $maskImg;### + $this->images[$file]=$info; + } + else + $info=$this->images[$file]; + + //Automatic width and height calculation if needed + if($w==0 && $h==0) + { + //Put image at 72 dpi + $w=$info['w']/$this->k; + $h=$info['h']/$this->k; + } + if($w==0) + $w=$h*$info['w']/$info['h']; + if($h==0) + $h=$w*$info['h']/$info['w']; + + if ($isMask) // embed hidden, ouside the canvas + { + $x = ($this->CurOrientation=='P'?$this->CurPageFormat[0]*2:$this->CurPageFormat[1]*2) + 10; + } + else // modification by spipu :) pas besoin de tracer l'image si c'est pour faire un mask !!!! + { + $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); + if($link) $this->Link($x,$y,$w,$h,$link); + } + + return $info['i']; + } + + // needs GD 2.x extension + // pixel-wise operation, not very fast + function ImagePngWithAlpha($file,$x,$y,$w=0,$h=0,$link='') + { + $tmp_alpha = tempnam('.', 'mska'); + $this->tmpFiles[] = $tmp_alpha; + $tmp_plain = tempnam('.', 'mskp'); + $this->tmpFiles[] = $tmp_plain; + + list($wpx, $hpx) = @getimagesize($file); + $img = imagecreatefrompng($file); + $alpha_img = imagecreate( $wpx, $hpx ); + + // generate gray scale pallete + for($c=0;$c<256;$c++) ImageColorAllocate($alpha_img, $c, $c, $c); + + // extract alpha channel + $xpx=0; + while ($xpx<$wpx) + { + $ypx = 0; + while ($ypx<$hpx) + { + $color_index = imagecolorat($img, $xpx, $ypx); + $col = imagecolorsforindex($img, $color_index); + imagesetpixel($alpha_img, $xpx, $ypx, $this->_gamma( (127-$col['alpha'])*255/127) ); + ++$ypx; + } + ++$xpx; + } + + imagepng($alpha_img, $tmp_alpha); + imagedestroy($alpha_img); + + // extract image without alpha channel + $plain_img = imagecreatetruecolor ( $wpx, $hpx ); + imagecopy ($plain_img, $img, 0, 0, 0, 0, $wpx, $hpx ); + imagepng($plain_img, $tmp_plain); + imagedestroy($plain_img); + + //first embed mask image (w, h, x, will be ignored) + $maskImg = $this->Image($tmp_alpha, 0,0,0,0, 'PNG', '', true); + + //embed image, masked with previously embedded mask + $this->Image($tmp_plain,$x,$y,$w,$h,'PNG',$link, false, $maskImg); + } + + function Close() + { + parent::Close(); + // clean up tmp files + foreach($this->tmpFiles as $tmp) @unlink($tmp); + } + + /* Private methods */ + function _putimages() + { + $filter=($this->compress) ? '/Filter /FlateDecode ' : ''; + reset($this->images); + while(list($file,$info)=each($this->images)) + { + $this->_newobj(); + $this->images[$file]['n']=$this->n; + $this->_out('<_out('/Subtype /Image'); + $this->_out('/Width '.$info['w']); + $this->_out('/Height '.$info['h']); + + if (isset($info["masked"])) $this->_out('/SMask '.($this->n-1).' 0 R'); ### + + if($info['cs']=='Indexed') + $this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]'); + else + { + $this->_out('/ColorSpace /'.$info['cs']); + if($info['cs']=='DeviceCMYK') + $this->_out('/Decode [1 0 1 0 1 0 1 0]'); + } + $this->_out('/BitsPerComponent '.$info['bpc']); + if(isset($info['f'])) + $this->_out('/Filter /'.$info['f']); + if(isset($info['parms'])) + $this->_out($info['parms']); + if(isset($info['trns']) && is_array($info['trns'])) + { + $trns=''; + for($i=0;$i_out('/Mask ['.$trns.']'); + } + $this->_out('/Length '.strlen($info['data']).'>>'); + $this->_putstream($info['data']); + unset($this->images[$file]['data']); + $this->_out('endobj'); + //Palette + if($info['cs']=='Indexed') + { + $this->_newobj(); + $pal=($this->compress) ? gzcompress($info['pal']) : $info['pal']; + $this->_out('<<'.$filter.'/Length '.strlen($pal).'>>'); + $this->_putstream($pal); + $this->_out('endobj'); + } + } + } + + // GD seems to use a different gamma, this method is used to correct it again + function _gamma($v) + { + return pow ($v/255, 2.2) * 255; + } + + // this method overwriing the original version is only needed to make the Image method support PNGs with alpha channels. + // if you only use the ImagePngWithAlpha method for such PNGs, you can remove it from this script. + function _parsepng($file) + { + //Extract info from a PNG file + $f=fopen($file,'rb'); + if(!$f) + $this->Error('Can\'t open image file: '.$file); + //Check signature + if(fread($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10)) + $this->Error('Not a PNG file: '.$file); + //Read header chunk + fread($f,4); + if(fread($f,4)!='IHDR') + $this->Error('Incorrect PNG file: '.$file); + $w=$this->_readint($f); + $h=$this->_readint($f); + $bpc=ord(fread($f,1)); + if($bpc>8) + $this->Error('16-bit depth not supported: '.$file); + $ct=ord(fread($f,1)); + if($ct==0) + $colspace='DeviceGray'; + elseif($ct==2) + $colspace='DeviceRGB'; + elseif($ct==3) + $colspace='Indexed'; + else + { + fclose($f); // the only changes are + return 'alpha'; // made in those 2 lines + } + if(ord(fread($f,1))!=0) + $this->Error('Unknown compression method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Unknown filter method: '.$file); + if(ord(fread($f,1))!=0) + $this->Error('Interlacing not supported: '.$file); + fread($f,4); + $parms='/DecodeParms <>'; + //Scan chunks looking for palette, transparency and image data + $pal=''; + $trns=''; + $data=''; + do + { + $n=$this->_readint($f); + $type=fread($f,4); + if($type=='PLTE') + { + //Read palette + $pal=fread($f,$n); + fread($f,4); + } + elseif($type=='tRNS') + { + //Read transparency info + $t=fread($f,$n); + if($ct==0) + $trns=array(ord(substr($t,1,1))); + elseif($ct==2) + $trns=array(ord(substr($t,1,1)),ord(substr($t,3,1)),ord(substr($t,5,1))); + else + { + $pos=strpos($t,chr(0)); + if($pos!==false) + $trns=array($pos); + } + fread($f,4); + } + elseif($type=='IDAT') + { + //Read image data block + $data.=fread($f,$n); + fread($f,4); + } + elseif($type=='IEND') + break; + else + fread($f,$n+4); + } + while($n); + if($colspace=='Indexed' && empty($pal)) + $this->Error('Missing palette in '.$file); + fclose($f); + return array('w'=>$w,'h'=>$h,'cs'=>$colspace,'bpc'=>$bpc,'f'=>'FlateDecode','parms'=>$parms,'pal'=>$pal,'trns'=>$trns,'data'=>$data); + } + + } +} diff --git a/main/inc/lib/html2pdf/_mypdf/99_fpdf_protection.class.php b/main/inc/lib/html2pdf/_mypdf/99_fpdf_protection.class.php index 779cb99cf7..ab091efb54 100755 --- a/main/inc/lib/html2pdf/_mypdf/99_fpdf_protection.class.php +++ b/main/inc/lib/html2pdf/_mypdf/99_fpdf_protection.class.php @@ -1,229 +1,228 @@ -FPDF_Formulaire($orientation,$unit,$format); - - $this->encrypted=false; - $this->last_rc4_key=''; - $this->padding="\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08". - "\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A"; - } - - /** - * Function to set permissions as well as user and owner passwords - * - * - permissions is an array with values taken from the following list: - * copy, print, modify, annot-forms - * If a value is present it means that the permission is granted - * - If a user password is set, user will be prompted before document is opened - * - If an owner password is set, document can be opened in privilege mode with no - * restriction if that password is entered - */ - function SetProtection($permissions=array(),$user_pass='',$owner_pass=null) - { - $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 ); - $protection = 192; - foreach($permissions as $permission){ - if (!isset($options[$permission])) - $this->Error('Incorrect permission: '.$permission); - $protection += $options[$permission]; - } - if ($owner_pass === null) - $owner_pass = uniqid(rand()); - $this->encrypted = true; - $this->_generateencryptionkey($user_pass, $owner_pass, $protection); - } - -/**************************************************************************** -* * -* Private methods * -* * -****************************************************************************/ - - function _putstream($s) - { - if ($this->encrypted) { - $s = $this->_RC4($this->_objectkey($this->n), $s); - } - parent::_putstream($s); - } - - function _textstring($s) - { - if ($this->encrypted) { - $s = $this->_RC4($this->_objectkey($this->n), $s); - } - return parent::_textstring($s); - } - - /** - * Compute key depending on object number where the encrypted data is stored - */ - function _objectkey($n) - { - return substr($this->_md5_16($this->encryption_key.pack('VXxx',$n)),0,10); - } - - function _putresources() - { - parent::_putresources(); - if ($this->encrypted) { - $this->_newobj(); - $this->enc_obj_id = $this->n; - $this->_out('<<'); - $this->_putencryption(); - $this->_out('>>'); - $this->_out('endobj'); - } - } - - function _putencryption() - { - $this->_out('/Filter /Standard'); - $this->_out('/V 1'); - $this->_out('/R 2'); - $this->_out('/O ('.$this->_escape($this->Ovalue).')'); - $this->_out('/U ('.$this->_escape($this->Uvalue).')'); - $this->_out('/P '.$this->Pvalue); - } - - function _puttrailer() - { - parent::_puttrailer(); - if ($this->encrypted) { - $this->_out('/Encrypt '.$this->enc_obj_id.' 0 R'); - $this->_out('/ID [()()]'); - } - } - - /** - * RC4 is the standard encryption algorithm used in PDF format - */ - function _RC4($key, $text) - { - if ($this->last_rc4_key != $key) { - $k = str_repeat($key, 256/strlen($key)+1); - $rc4 = range(0,255); - $j = 0; - for ($i=0; $i<256; $i++){ - $t = $rc4[$i]; - $j = ($j + $t + ord($k{$i})) % 256; - $rc4[$i] = $rc4[$j]; - $rc4[$j] = $t; - } - $this->last_rc4_key = $key; - $this->last_rc4_key_c = $rc4; - } else { - $rc4 = $this->last_rc4_key_c; - } - - $len = strlen($text); - $a = 0; - $b = 0; - $out = ''; - for ($i=0; $i<$len; $i++){ - $a = ($a+1)%256; - $t= $rc4[$a]; - $b = ($b+$t)%256; - $rc4[$a] = $rc4[$b]; - $rc4[$b] = $t; - $k = $rc4[($rc4[$a]+$rc4[$b])%256]; - $out.=chr(ord($text{$i}) ^ $k); - } - - return $out; - } - - /** - * Get MD5 as binary string - */ - function _md5_16($string) - { - return pack('H*',md5($string)); - } - - /** - * Compute O value - */ - function _Ovalue($user_pass, $owner_pass) - { - $tmp = $this->_md5_16($owner_pass); - $owner_RC4_key = substr($tmp,0,5); - return $this->_RC4($owner_RC4_key, $user_pass); - } - - /** - * Compute U value - */ - function _Uvalue() - { - return $this->_RC4($this->encryption_key, $this->padding); - } - - /** - * Compute encryption key - */ - function _generateencryptionkey($user_pass, $owner_pass, $protection) - { - // Pad passwords - $user_pass = substr($user_pass.$this->padding,0,32); - $owner_pass = substr($owner_pass.$this->padding,0,32); - // Compute O value - $this->Ovalue = $this->_Ovalue($user_pass,$owner_pass); - // Compute encyption key - $tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF"); - $this->encryption_key = substr($tmp,0,5); - // Compute U value - $this->Uvalue = $this->_Uvalue(); - // Compute P value - $this->Pvalue = -(($protection^255)+1); - } - } -} -?> \ No newline at end of file +FPDF_Formulaire($orientation,$unit,$format); + + $this->encrypted=false; + $this->last_rc4_key=''; + $this->padding="\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08". + "\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A"; + } + + /** + * Function to set permissions as well as user and owner passwords + * + * - permissions is an array with values taken from the following list: + * copy, print, modify, annot-forms + * If a value is present it means that the permission is granted + * - If a user password is set, user will be prompted before document is opened + * - If an owner password is set, document can be opened in privilege mode with no + * restriction if that password is entered + */ + function SetProtection($permissions=array(),$user_pass='',$owner_pass=null) + { + $options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 ); + $protection = 192; + foreach($permissions as $permission){ + if (!isset($options[$permission])) + $this->Error('Incorrect permission: '.$permission); + $protection += $options[$permission]; + } + if ($owner_pass === null) + $owner_pass = uniqid(rand()); + $this->encrypted = true; + $this->_generateencryptionkey($user_pass, $owner_pass, $protection); + } + +/**************************************************************************** +* * +* Private methods * +* * +****************************************************************************/ + + function _putstream($s) + { + if ($this->encrypted) { + $s = $this->_RC4($this->_objectkey($this->n), $s); + } + parent::_putstream($s); + } + + function _textstring($s) + { + if ($this->encrypted) { + $s = $this->_RC4($this->_objectkey($this->n), $s); + } + return parent::_textstring($s); + } + + /** + * Compute key depending on object number where the encrypted data is stored + */ + function _objectkey($n) + { + return substr($this->_md5_16($this->encryption_key.pack('VXxx',$n)),0,10); + } + + function _putresources() + { + parent::_putresources(); + if ($this->encrypted) { + $this->_newobj(); + $this->enc_obj_id = $this->n; + $this->_out('<<'); + $this->_putencryption(); + $this->_out('>>'); + $this->_out('endobj'); + } + } + + function _putencryption() + { + $this->_out('/Filter /Standard'); + $this->_out('/V 1'); + $this->_out('/R 2'); + $this->_out('/O ('.$this->_escape($this->Ovalue).')'); + $this->_out('/U ('.$this->_escape($this->Uvalue).')'); + $this->_out('/P '.$this->Pvalue); + } + + function _puttrailer() + { + parent::_puttrailer(); + if ($this->encrypted) { + $this->_out('/Encrypt '.$this->enc_obj_id.' 0 R'); + $this->_out('/ID [()()]'); + } + } + + /** + * RC4 is the standard encryption algorithm used in PDF format + */ + function _RC4($key, $text) + { + if ($this->last_rc4_key != $key) { + $k = str_repeat($key, 256/strlen($key)+1); + $rc4 = range(0,255); + $j = 0; + for ($i=0; $i<256; $i++){ + $t = $rc4[$i]; + $j = ($j + $t + ord($k{$i})) % 256; + $rc4[$i] = $rc4[$j]; + $rc4[$j] = $t; + } + $this->last_rc4_key = $key; + $this->last_rc4_key_c = $rc4; + } else { + $rc4 = $this->last_rc4_key_c; + } + + $len = strlen($text); + $a = 0; + $b = 0; + $out = ''; + for ($i=0; $i<$len; $i++){ + $a = ($a+1)%256; + $t= $rc4[$a]; + $b = ($b+$t)%256; + $rc4[$a] = $rc4[$b]; + $rc4[$b] = $t; + $k = $rc4[($rc4[$a]+$rc4[$b])%256]; + $out.=chr(ord($text{$i}) ^ $k); + } + + return $out; + } + + /** + * Get MD5 as binary string + */ + function _md5_16($string) + { + return pack('H*',md5($string)); + } + + /** + * Compute O value + */ + function _Ovalue($user_pass, $owner_pass) + { + $tmp = $this->_md5_16($owner_pass); + $owner_RC4_key = substr($tmp,0,5); + return $this->_RC4($owner_RC4_key, $user_pass); + } + + /** + * Compute U value + */ + function _Uvalue() + { + return $this->_RC4($this->encryption_key, $this->padding); + } + + /** + * Compute encryption key + */ + function _generateencryptionkey($user_pass, $owner_pass, $protection) + { + // Pad passwords + $user_pass = substr($user_pass.$this->padding,0,32); + $owner_pass = substr($owner_pass.$this->padding,0,32); + // Compute O value + $this->Ovalue = $this->_Ovalue($user_pass,$owner_pass); + // Compute encyption key + $tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF"); + $this->encryption_key = substr($tmp,0,5); + // Compute U value + $this->Uvalue = $this->_Uvalue(); + // Compute P value + $this->Pvalue = -(($protection^255)+1); + } + } +} diff --git a/main/inc/lib/html2pdf/_mypdf/mypdf.class.php b/main/inc/lib/html2pdf/_mypdf/mypdf.class.php index d1b02f3d1b..bbd3a0893c 100755 --- a/main/inc/lib/html2pdf/_mypdf/mypdf.class.php +++ b/main/inc/lib/html2pdf/_mypdf/mypdf.class.php @@ -1,485 +1,502 @@ - PDF, utilise fpdf de Olivier PLATHEY - * Distribu� sous la licence LGPL. - * - * @author Laurent MINGUET - * @version 3.24 - 05/08/2009 - */ - -if (!defined('__CLASS_MYPDF__')) -{ - define('__CLASS_MYPDF__', true); - - require_once(dirname(__FILE__).'/99_fpdf_protection.class.php'); // classe fpdf_protection - - class MyPDF extends FPDF_Protection - { - var $footer_param = array(); - - var $underline = false; - var $overline = false; - var $linethrough = false; - - function MyPDF($sens = 'P', $unit = 'mm', $format = 'A4') - { - $this->underline = false; - $this->overline = false; - $this->linethrough = false; - - $this->FPDF_Protection($sens, $unit, $format); - $this->AliasNbPages(); - $this->SetMyFooter(); - } - - function SetMyFooter($page = null, $date = null, $heure = null, $form = null) - { - if ($page===null) $page = null; - if ($date===null) $date = null; - if ($heure===null) $heure = null; - if ($form===null) $form = null; - - $this->footer_param = array('page' => $page, 'date' => $date, 'heure' => $heure, 'form' => $form); - } - - function Footer() - { - $txt = ''; - if ($this->footer_param['form']) $txt = (@HTML2PDF::textGET('pdf05')); - if ($this->footer_param['date'] && $this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf03')); - if ($this->footer_param['date'] && !$this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf01')); - if (!$this->footer_param['date'] && $this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf02')); - if ($this->footer_param['page']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf04')); - - $txt = str_replace('[[date_d]]', date('d'), $txt); - $txt = str_replace('[[date_m]]', date('m'), $txt); - $txt = str_replace('[[date_y]]', date('Y'), $txt); - $txt = str_replace('[[date_h]]', date('H'), $txt); - $txt = str_replace('[[date_i]]', date('i'), $txt); - $txt = str_replace('[[date_s]]', date('s'), $txt); - $txt = str_replace('[[current]]', $this->PageNo(), $txt); - $txt = str_replace('[[nb]]', '{nb}', $txt); - - if (strlen($txt)>0) - { - $this->SetY(-11); - $this->setOverline(false); - $this->setLinethrough(false); - $this->SetFont('Arial','I',8); - $this->Cell(0, 10, $txt, 0, 0, 'R'); - } - } - - // red�finition de la fonction Image de FPDF afin de rajouter la gestion des fichiers PHP - function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='') - { - //Put an image on the page - if(!isset($this->images[$file])) - { - //First use of this image, get info - if($type=='') - { - /* MODIFICATION HTML2PDF pour le support des images PHP */ - $type = explode('?', $file); - $type = pathinfo($type[0]); - if (!isset($type['extension']) || !$type['extension']) - $this->Error('Image file has no extension and no type was specified: '.$file); - - $type = $type['extension']; - /* FIN MODIFICATION */ - } - - $type=strtolower($type); - - /* MODIFICATION HTML2PDF pour le support des images PHP */ - if ($type=='php') - { - // identification des infos - $infos=@GetImageSize($file); - if (!$infos) $this->Error('Unsupported image : '.$file); - - // identification du type - $type = explode('/', $infos['mime']); - if ($type[0]!='image') $this->Error('Unsupported image : '.$file); - $type = $type[1]; - } - /* FIN MODIFICATION */ - - if($type=='jpeg') - $type='jpg'; - $mtd='_parse'.$type; - if(!method_exists($this,$mtd)) - $this->Error('Unsupported image type: '.$type); - $info=$this->$mtd($file); - $info['i']=count($this->images)+1; - $this->images[$file]=$info; - } - else - $info=$this->images[$file]; - //Automatic width and height calculation if needed - if($w==0 && $h==0) - { - //Put image at 72 dpi - $w=$info['w']/$this->k; - $h=$info['h']/$this->k; - } - elseif($w==0) - $w=$h*$info['w']/$info['h']; - elseif($h==0) - $h=$w*$info['h']/$info['w']; - //Flowing mode - if($y===null) - { - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x2=$this->x; - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x2; - } - $y=$this->y; - $this->y+=$h; - } - if($x===null) - $x=$this->x; - - $this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i'])); - if($link) - $this->Link($x,$y,$w,$h,$link); - } - - // Draw a polygon - // Auteur : Andrew Meier - // Licence : Freeware - function Polygon($points, $style='D') - { - if($style=='F') $op='f'; - elseif($style=='FD' or $style=='DF') $op='b'; - else $op='s'; - - $h = $this->h; - $k = $this->k; - - $points_string = ''; - for($i=0; $i_out($points_string . $op); - } - - function setOverline($value = true) - { - $this->overline = $value; - } - - function setLinethrough($value = true) - { - $this->linethrough = $value; - } - - // red�finition de la methode Text de FPDF afin de rajouter la gestion des overline et linethrough - function Text($x, $y, $txt) - { - //Output a string - $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); - - /* MODIFICATION HTML2PDF pour le support de underline, overline, linethrough */ - if ($txt!='') - { - if($this->underline) $s.=' '.$this->_dounderline($x,$y,$txt); - if($this->overline) $s.=' '.$this->_dooverline($x,$y,$txt); - if($this->linethrough) $s.=' '.$this->_dolinethrough($x,$y,$txt); - } - /* FIN MODIFICATION */ - - if($this->ColorFlag) - $s='q '.$this->TextColor.' '.$s.' Q'; - $this->_out($s); - } - - // red�finition de la methode Cell de FPDF afin de rajouter la gestion des overline et linethrough - function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') - { - //Output a cell - $k=$this->k; - if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) - { - //Automatic page break - $x=$this->x; - $ws=$this->ws; - if($ws>0) - { - $this->ws=0; - $this->_out('0 Tw'); - } - $this->AddPage($this->CurOrientation,$this->CurPageFormat); - $this->x=$x; - if($ws>0) - { - $this->ws=$ws; - $this->_out(sprintf('%.3F Tw',$ws*$k)); - } - } - if($w==0) - $w=$this->w-$this->rMargin-$this->x; - $s=''; - if($fill || $border==1) - { - if($fill) - $op=($border==1) ? 'B' : 'f'; - else - $op='S'; - $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); - } - if(is_string($border)) - { - $x=$this->x; - $y=$this->y; - if(strpos($border,'L')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); - if(strpos($border,'T')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); - if(strpos($border,'R')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - if(strpos($border,'B')!==false) - $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); - } - if($txt!=='') - { - if($align=='R') - $dx=$w-$this->cMargin-$this->GetStringWidth($txt); - elseif($align=='C') - $dx=($w-$this->GetStringWidth($txt))/2; - else - $dx=$this->cMargin; - if($this->ColorFlag) - $s.='q '.$this->TextColor.' '; - $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); - $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); - - /* MODIFICATION HTML2PDF pour le support de underline, overline, linethrough */ - if($this->underline) $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); - if($this->overline) $s.=' '.$this->_dooverline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); - if($this->linethrough) $s.=' '.$this->_dolinethrough($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); - /* FIN MODIFICATION */ - - if($this->ColorFlag) - $s.=' Q'; - if($link) - $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); - } - if($s) - $this->_out($s); - $this->lasth=$h; - if($ln>0) - { - //Go to next line - $this->y+=$h; - if($ln==1) - $this->x=$this->lMargin; - } - else - $this->x+=$w; - } - - function _dounderline($x, $y, $txt) - { - //Underline text - $up=$this->CurrentFont['up']; - $ut=$this->CurrentFont['ut']; - - $p_x = $x*$this->k; - $p_y = ($this->h-($y-$up/1000*$this->FontSize))*$this->k; - $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; - $p_h = -$ut/1000*$this->FontSizePt; - - return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); - } - - function _dooverline($x, $y, $txt) - { - //Overline text - $up=$this->CurrentFont['up']; - $ut=$this->CurrentFont['ut']; - - $p_x = $x*$this->k; - $p_y = ($this->h-($y-(1000+1.5*$up)/1000*$this->FontSize))*$this->k; - $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; - $p_h = -$ut/1000*$this->FontSizePt; - - return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); - } - - function _dolinethrough($x, $y, $txt) - { - //Linethrough text - $up=$this->CurrentFont['up']; - $ut=$this->CurrentFont['ut']; - - $p_x = $x*$this->k; - $p_y = ($this->h-($y-(1000+2.5*$up)/2000*$this->FontSize))*$this->k; - $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; - $p_h = -$ut/1000*$this->FontSizePt; - - return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); - } - - function clippingPathOpen($x = null, $y = null, $w = null, $h = null, $coin_TL=null, $coin_TR=null, $coin_BL=null, $coin_BR=null) - { - $path = ''; - if ($x!==null && $y!==null && $w!==null && $h!==null) - { - $x1 = $x*$this->k; - $y1 = ($this->h-$y)*$this->k; - - $x2 = ($x+$w)*$this->k; - $y2 = ($this->h-$y)*$this->k; - - $x3 = ($x+$w)*$this->k; - $y3 = ($this->h-$y-$h)*$this->k; - - $x4 = $x*$this->k; - $y4 = ($this->h-$y-$h)*$this->k; - - if ($coin_TL || $coin_TR || $coin_BL || $coin_BR) - { - if ($coin_TL) { $coin_TL[0] = $coin_TL[0]*$this->k; $coin_TL[1] =-$coin_TL[1]*$this->k; } - if ($coin_TR) { $coin_TR[0] = $coin_TR[0]*$this->k; $coin_TR[1] =-$coin_TR[1]*$this->k; } - if ($coin_BL) { $coin_BL[0] = $coin_BL[0]*$this->k; $coin_BL[1] =-$coin_BL[1]*$this->k; } - if ($coin_BR) { $coin_BR[0] = $coin_BR[0]*$this->k; $coin_BR[1] =-$coin_BR[1]*$this->k; } - - $MyArc = 4/3 * (sqrt(2) - 1); - - if ($coin_TL) - $path.= sprintf('%.2F %.2F m ', $x1+$coin_TL[0], $y1); - else - $path.= sprintf('%.2F %.2F m ', $x1, $y1); - - if ($coin_TR) - { - $xt1 = ($x2-$coin_TR[0])+$coin_TR[0]*$MyArc; - $yt1 = ($y2+$coin_TR[1])-$coin_TR[1]; - $xt2 = ($x2-$coin_TR[0])+$coin_TR[0]; - $yt2 = ($y2+$coin_TR[1])-$coin_TR[1]*$MyArc; - - $path.= sprintf('%.2F %.2F l ', $x2-$coin_TR[0], $y2); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x2, $y2+$coin_TR[1]); - } - else - $path.= sprintf('%.2F %.2F l ', $x2, $y2); - - if ($coin_BR) - { - $xt1 = ($x3-$coin_BR[0])+$coin_BR[0]; - $yt1 = ($y3-$coin_BR[1])+$coin_BR[1]*$MyArc; - $xt2 = ($x3-$coin_BR[0])+$coin_BR[0]*$MyArc; - $yt2 = ($y3-$coin_BR[1])+$coin_BR[1]; - - $path.= sprintf('%.2F %.2F l ', $x3, $y3-$coin_BR[1]); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x3-$coin_BR[0], $y3); - } - else - $path.= sprintf('%.2F %.2F l ', $x3, $y3); - - if ($coin_BL) - { - $xt1 = ($x4+$coin_BL[0])-$coin_BL[0]*$MyArc; - $yt1 = ($y4-$coin_BL[1])+$coin_BL[1]; - $xt2 = ($x4+$coin_BL[0])-$coin_BL[0]; - $yt2 = ($y4-$coin_BL[1])+$coin_BL[1]*$MyArc; - - $path.= sprintf('%.2F %.2F l ', $x4+$coin_BL[0], $y4); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x4, $y4-$coin_BL[1]); - } - else - $path.= sprintf('%.2F %.2F l ', $x4, $y4); - - if ($coin_TL) - { - $xt1 = ($x1+$coin_TL[0])-$coin_TL[0]; - $yt1 = ($y1+$coin_TL[1])-$coin_TL[1]*$MyArc; - $xt2 = ($x1+$coin_TL[0])-$coin_TL[0]*$MyArc; - $yt2 = ($y1+$coin_TL[1])-$coin_TL[1]; - - $path.= sprintf('%.2F %.2F l ', $x1, $y1+$coin_TL[1]); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x1+$coin_TL[0], $y1); - } - } - else - { - $path.= sprintf('%.2F %.2F m ', $x1, $y1); - $path.= sprintf('%.2F %.2F l ', $x2, $y2); - $path.= sprintf('%.2F %.2F l ', $x3, $y3); - $path.= sprintf('%.2F %.2F l ', $x4, $y4); - } - - $path.= ' h W n'; - } - $this->_out('q '.$path.' '); - } - - function clippingPathClose() - { - $this->_out(' Q'); - } - - function drawCourbe($ext1_x, $ext1_y, $ext2_x, $ext2_y, $int1_x, $int1_y, $int2_x, $int2_y, $cen_x, $cen_y) - { - $MyArc = 4/3 * (sqrt(2) - 1); - - $ext1_x = $ext1_x*$this->k; $ext1_y = ($this->h-$ext1_y)*$this->k; - $ext2_x = $ext2_x*$this->k; $ext2_y = ($this->h-$ext2_y)*$this->k; - $int1_x = $int1_x*$this->k; $int1_y = ($this->h-$int1_y)*$this->k; - $int2_x = $int2_x*$this->k; $int2_y = ($this->h-$int2_y)*$this->k; - $cen_x = $cen_x*$this->k; $cen_y = ($this->h-$cen_y) *$this->k; - - $path = ''; - - if ($ext1_x-$cen_x!=0) - { - $xt1 = $cen_x+($ext1_x-$cen_x); - $yt1 = $cen_y+($ext2_y-$cen_y)*$MyArc; - $xt2 = $cen_x+($ext1_x-$cen_x)*$MyArc; - $yt2 = $cen_y+($ext2_y-$cen_y); - } - else - { - $xt1 = $cen_x+($ext2_x-$cen_x)*$MyArc; - $yt1 = $cen_y+($ext1_y-$cen_y); - $xt2 = $cen_x+($ext2_x-$cen_x); - $yt2 = $cen_y+($ext1_y-$cen_y)*$MyArc; - - } - - $path.= sprintf('%.2F %.2F m ', $ext1_x, $ext1_y); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $ext2_x, $ext2_y); - - if ($int1_x-$cen_x!=0) - { - $xt1 = $cen_x+($int1_x-$cen_x)*$MyArc; - $yt1 = $cen_y+($int2_y-$cen_y); - $xt2 = $cen_x+($int1_x-$cen_x); - $yt2 = $cen_y+($int2_y-$cen_y)*$MyArc; - } - else - { - $xt1 = $cen_x+($int2_x-$cen_x); - $yt1 = $cen_y+($int1_y-$cen_y)*$MyArc; - $xt2 = $cen_x+($int2_x-$cen_x)*$MyArc; - $yt2 = $cen_y+($int1_y-$cen_y); - - } - - $path.= sprintf('%.2F %.2F l ', $int2_x, $int2_y); - $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $int1_x, $int1_y); - - $this->_out($path . 'f'); - } - } -} -?> \ No newline at end of file + PDF, utilise fpdf de Olivier PLATHEY + * Distribué sous la licence LGPL. + * + * @author Laurent MINGUET + * @version 3.26 - 16/11/2009 + */ + +if (!defined('__CLASS_MYPDF__')) +{ + define('__CLASS_MYPDF__', true); + + require_once(dirname(__FILE__).'/99_fpdf_protection.class.php'); // classe fpdf_protection + + class MyPDF extends FPDF_Protection + { + var $footer_param = array(); + + var $underline = false; + var $overline = false; + var $linethrough = false; + + function MyPDF($sens = 'P', $unit = 'mm', $format = 'A4') + { + $this->underline = false; + $this->overline = false; + $this->linethrough = false; + + $this->FPDF_Protection($sens, $unit, $format); + $this->AliasNbPages(); + $this->SetMyFooter(); + } + + function SetMyFooter($page = null, $date = null, $heure = null, $form = null) + { + if ($page===null) $page = null; + if ($date===null) $date = null; + if ($heure===null) $heure = null; + if ($form===null) $form = null; + + $this->footer_param = array('page' => $page, 'date' => $date, 'heure' => $heure, 'form' => $form); + } + + function Footer() + { + $txt = ''; + if ($this->footer_param['form']) $txt = (@HTML2PDF::textGET('pdf05')); + if ($this->footer_param['date'] && $this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf03')); + if ($this->footer_param['date'] && !$this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf01')); + if (!$this->footer_param['date'] && $this->footer_param['heure']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf02')); + if ($this->footer_param['page']) $txt.= ($txt ? ' - ' : '').(@HTML2PDF::textGET('pdf04')); + + $txt = str_replace('[[date_d]]', date('d'), $txt); + $txt = str_replace('[[date_m]]', date('m'), $txt); + $txt = str_replace('[[date_y]]', date('Y'), $txt); + $txt = str_replace('[[date_h]]', date('H'), $txt); + $txt = str_replace('[[date_i]]', date('i'), $txt); + $txt = str_replace('[[date_s]]', date('s'), $txt); + $txt = str_replace('[[current]]', $this->PageNo(), $txt); + $txt = str_replace('[[nb]]', '{nb}', $txt); + + if (strlen($txt)>0) + { + $this->SetY(-11); + $this->setOverline(false); + $this->setLinethrough(false); + $this->SetFont('Arial','I',8); + $this->Cell(0, 10, $txt, 0, 0, 'R'); + } + } + + // Draw a polygon + // Auteur : Andrew Meier + // Licence : Freeware + function Polygon($points, $style='D') + { + if($style=='F') $op='f'; + elseif($style=='FD' or $style=='DF') $op='b'; + else $op='s'; + + $h = $this->h; + $k = $this->k; + + $points_string = ''; + for($i=0; $i_out($points_string . $op); + } + + function setOverline($value = true) + { + $this->overline = $value; + } + + function setLinethrough($value = true) + { + $this->linethrough = $value; + } + + // redéfinition de la methode Text de FPDF afin de rajouter la gestion des overline et linethrough + function Text($x, $y, $txt) + { + //Output a string + $s=sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt)); + + /* MODIFICATION HTML2PDF pour le support de underline, overline, linethrough */ + if ($txt!='') + { + if($this->underline) $s.=' '.$this->_dounderline($x,$y,$txt); + if($this->overline) $s.=' '.$this->_dooverline($x,$y,$txt); + if($this->linethrough) $s.=' '.$this->_dolinethrough($x,$y,$txt); + } + /* FIN MODIFICATION */ + + if($this->ColorFlag) + $s='q '.$this->TextColor.' '.$s.' Q'; + $this->_out($s); + } + + // redéfinition de la methode Cell de FPDF afin de rajouter la gestion des overline et linethrough + function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') + { + //Output a cell + $k=$this->k; + if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak()) + { + //Automatic page break + $x=$this->x; + $ws=$this->ws; + if($ws>0) + { + $this->ws=0; + $this->_out('0 Tw'); + } + $this->AddPage($this->CurOrientation,$this->CurPageFormat); + $this->x=$x; + if($ws>0) + { + $this->ws=$ws; + $this->_out(sprintf('%.3F Tw',$ws*$k)); + } + } + if($w==0) + $w=$this->w-$this->rMargin-$this->x; + $s=''; + if($fill || $border==1) + { + if($fill) + $op=($border==1) ? 'B' : 'f'; + else + $op='S'; + $s=sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op); + } + if(is_string($border)) + { + $x=$this->x; + $y=$this->y; + if(strpos($border,'L')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k); + if(strpos($border,'T')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k); + if(strpos($border,'R')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + if(strpos($border,'B')!==false) + $s.=sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k); + } + if($txt!=='') + { + if($align=='R') + $dx=$w-$this->cMargin-$this->GetStringWidth($txt); + elseif($align=='C') + $dx=($w-$this->GetStringWidth($txt))/2; + else + $dx=$this->cMargin; + if($this->ColorFlag) + $s.='q '.$this->TextColor.' '; + $txt2=str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt))); + $s.=sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2); + + /* MODIFICATION HTML2PDF pour le support de underline, overline, linethrough */ + if($this->underline) $s.=' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->overline) $s.=' '.$this->_dooverline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + if($this->linethrough) $s.=' '.$this->_dolinethrough($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt); + /* FIN MODIFICATION */ + + if($this->ColorFlag) + $s.=' Q'; + if($link) + $this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link); + } + if($s) + $this->_out($s); + $this->lasth=$h; + if($ln>0) + { + //Go to next line + $this->y+=$h; + if($ln==1) + $this->x=$this->lMargin; + } + else + $this->x+=$w; + } + + function _dounderline($x, $y, $txt) + { + //Underline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + + $p_x = $x*$this->k; + $p_y = ($this->h-($y-$up/1000*$this->FontSize))*$this->k; + $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; + $p_h = -$ut/1000*$this->FontSizePt; + + return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); + } + + function _dooverline($x, $y, $txt) + { + //Overline text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + + $p_x = $x*$this->k; + $p_y = ($this->h-($y-(1000+1.5*$up)/1000*$this->FontSize))*$this->k; + $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; + $p_h = -$ut/1000*$this->FontSizePt; + + return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); + } + + function _dolinethrough($x, $y, $txt) + { + //Linethrough text + $up=$this->CurrentFont['up']; + $ut=$this->CurrentFont['ut']; + + $p_x = $x*$this->k; + $p_y = ($this->h-($y-(1000+2.5*$up)/2000*$this->FontSize))*$this->k; + $p_w = ($this->GetStringWidth($txt)+$this->ws*substr_count($txt,' '))*$this->k; + $p_h = -$ut/1000*$this->FontSizePt; + + return sprintf('%.2F %.2F %.2F %.2F re f',$p_x,$p_y,$p_w,$p_h); + } + + function clippingPathOpen($x = null, $y = null, $w = null, $h = null, $coin_TL=null, $coin_TR=null, $coin_BL=null, $coin_BR=null) + { + $path = ''; + if ($x!==null && $y!==null && $w!==null && $h!==null) + { + $x1 = $x*$this->k; + $y1 = ($this->h-$y)*$this->k; + + $x2 = ($x+$w)*$this->k; + $y2 = ($this->h-$y)*$this->k; + + $x3 = ($x+$w)*$this->k; + $y3 = ($this->h-$y-$h)*$this->k; + + $x4 = $x*$this->k; + $y4 = ($this->h-$y-$h)*$this->k; + + if ($coin_TL || $coin_TR || $coin_BL || $coin_BR) + { + if ($coin_TL) { $coin_TL[0] = $coin_TL[0]*$this->k; $coin_TL[1] =-$coin_TL[1]*$this->k; } + if ($coin_TR) { $coin_TR[0] = $coin_TR[0]*$this->k; $coin_TR[1] =-$coin_TR[1]*$this->k; } + if ($coin_BL) { $coin_BL[0] = $coin_BL[0]*$this->k; $coin_BL[1] =-$coin_BL[1]*$this->k; } + if ($coin_BR) { $coin_BR[0] = $coin_BR[0]*$this->k; $coin_BR[1] =-$coin_BR[1]*$this->k; } + + $MyArc = 4/3 * (sqrt(2) - 1); + + if ($coin_TL) + $path.= sprintf('%.2F %.2F m ', $x1+$coin_TL[0], $y1); + else + $path.= sprintf('%.2F %.2F m ', $x1, $y1); + + if ($coin_TR) + { + $xt1 = ($x2-$coin_TR[0])+$coin_TR[0]*$MyArc; + $yt1 = ($y2+$coin_TR[1])-$coin_TR[1]; + $xt2 = ($x2-$coin_TR[0])+$coin_TR[0]; + $yt2 = ($y2+$coin_TR[1])-$coin_TR[1]*$MyArc; + + $path.= sprintf('%.2F %.2F l ', $x2-$coin_TR[0], $y2); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x2, $y2+$coin_TR[1]); + } + else + $path.= sprintf('%.2F %.2F l ', $x2, $y2); + + if ($coin_BR) + { + $xt1 = ($x3-$coin_BR[0])+$coin_BR[0]; + $yt1 = ($y3-$coin_BR[1])+$coin_BR[1]*$MyArc; + $xt2 = ($x3-$coin_BR[0])+$coin_BR[0]*$MyArc; + $yt2 = ($y3-$coin_BR[1])+$coin_BR[1]; + + $path.= sprintf('%.2F %.2F l ', $x3, $y3-$coin_BR[1]); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x3-$coin_BR[0], $y3); + } + else + $path.= sprintf('%.2F %.2F l ', $x3, $y3); + + if ($coin_BL) + { + $xt1 = ($x4+$coin_BL[0])-$coin_BL[0]*$MyArc; + $yt1 = ($y4-$coin_BL[1])+$coin_BL[1]; + $xt2 = ($x4+$coin_BL[0])-$coin_BL[0]; + $yt2 = ($y4-$coin_BL[1])+$coin_BL[1]*$MyArc; + + $path.= sprintf('%.2F %.2F l ', $x4+$coin_BL[0], $y4); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x4, $y4-$coin_BL[1]); + } + else + $path.= sprintf('%.2F %.2F l ', $x4, $y4); + + if ($coin_TL) + { + $xt1 = ($x1+$coin_TL[0])-$coin_TL[0]; + $yt1 = ($y1+$coin_TL[1])-$coin_TL[1]*$MyArc; + $xt2 = ($x1+$coin_TL[0])-$coin_TL[0]*$MyArc; + $yt2 = ($y1+$coin_TL[1])-$coin_TL[1]; + + $path.= sprintf('%.2F %.2F l ', $x1, $y1+$coin_TL[1]); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $x1+$coin_TL[0], $y1); + } + } + else + { + $path.= sprintf('%.2F %.2F m ', $x1, $y1); + $path.= sprintf('%.2F %.2F l ', $x2, $y2); + $path.= sprintf('%.2F %.2F l ', $x3, $y3); + $path.= sprintf('%.2F %.2F l ', $x4, $y4); + } + + $path.= ' h W n'; + } + $this->_out('q '.$path.' '); + } + + function clippingPathClose() + { + $this->_out(' Q'); + } + + function drawCourbe($ext1_x, $ext1_y, $ext2_x, $ext2_y, $int1_x, $int1_y, $int2_x, $int2_y, $cen_x, $cen_y) + { + $MyArc = 4/3 * (sqrt(2) - 1); + + $ext1_x = $ext1_x*$this->k; $ext1_y = ($this->h-$ext1_y)*$this->k; + $ext2_x = $ext2_x*$this->k; $ext2_y = ($this->h-$ext2_y)*$this->k; + $int1_x = $int1_x*$this->k; $int1_y = ($this->h-$int1_y)*$this->k; + $int2_x = $int2_x*$this->k; $int2_y = ($this->h-$int2_y)*$this->k; + $cen_x = $cen_x*$this->k; $cen_y = ($this->h-$cen_y) *$this->k; + + $path = ''; + + if ($ext1_x-$cen_x!=0) + { + $xt1 = $cen_x+($ext1_x-$cen_x); + $yt1 = $cen_y+($ext2_y-$cen_y)*$MyArc; + $xt2 = $cen_x+($ext1_x-$cen_x)*$MyArc; + $yt2 = $cen_y+($ext2_y-$cen_y); + } + else + { + $xt1 = $cen_x+($ext2_x-$cen_x)*$MyArc; + $yt1 = $cen_y+($ext1_y-$cen_y); + $xt2 = $cen_x+($ext2_x-$cen_x); + $yt2 = $cen_y+($ext1_y-$cen_y)*$MyArc; + + } + + $path.= sprintf('%.2F %.2F m ', $ext1_x, $ext1_y); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $ext2_x, $ext2_y); + + if ($int1_x-$cen_x!=0) + { + $xt1 = $cen_x+($int1_x-$cen_x)*$MyArc; + $yt1 = $cen_y+($int2_y-$cen_y); + $xt2 = $cen_x+($int1_x-$cen_x); + $yt2 = $cen_y+($int2_y-$cen_y)*$MyArc; + } + else + { + $xt1 = $cen_x+($int2_x-$cen_x); + $yt1 = $cen_y+($int1_y-$cen_y)*$MyArc; + $xt2 = $cen_x+($int2_x-$cen_x)*$MyArc; + $yt2 = $cen_y+($int1_y-$cen_y); + + } + + $path.= sprintf('%.2F %.2F l ', $int2_x, $int2_y); + $path.= sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $xt1, $yt1, $xt2, $yt2, $int1_x, $int1_y); + + $this->_out($path . 'f'); + } + + function startTransform() + { + $this->_out('q'); + } + + function stopTransform() + { + $this->_out('Q'); + } + + function setTranslate($t_x, $t_y) + { + // matrice de transformation + $tm[0]=1; + $tm[1]=0; + $tm[2]=0; + $tm[3]=1; + $tm[4]=$t_x*$this->k; + $tm[5]=-$t_y*$this->k; + + $this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F cm', $tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5])); + } + + + function setRotation($angle, $x='', $y='') + { + if($x === '') $x=$this->x; + if($y === '') $y=$this->y; + + $y=($this->h-$y)*$this->k; + $x*=$this->k; + + // matrice de transformation + $tm[0]=cos(deg2rad($angle)); + $tm[1]=sin(deg2rad($angle)); + $tm[2]=-$tm[1]; + $tm[3]=$tm[0]; + $tm[4]=$x+$tm[1]*$y-$tm[0]*$x; + $tm[5]=$y-$tm[0]*$y-$tm[1]*$x; + + $this->_out(sprintf('%.3F %.3F %.3F %.3F %.3F %.3F cm', $tm[0],$tm[1],$tm[2],$tm[3],$tm[4],$tm[5])); + } + + function setMyDrawColor($c) + { + $c = $this->setMyColor($c, true); + if (!$c) return false; + + $this->DrawColor=$c; + if($this->page>0) $this->_out($this->DrawColor); + } + + function setMyFillColor($c) + { + $c = $this->setMyColor($c); + if (!$c) return false; + + $this->FillColor=$c; + $this->ColorFlag=($this->FillColor!=$this->TextColor); + if($this->page>0) $this->_out($this->FillColor); + } + + function setMyTextColor($c) + { + $c = $this->setMyColor($c); + if (!$c) return false; + + $this->TextColor=$c; + $this->ColorFlag=($this->FillColor!=$this->TextColor); + } + + function setMyColor($c, $mode = false) + { + if (!is_array($c)) return sprintf('%.3F ',$c).($mode ? 'G' : 'g'); + elseif (count($c)==3) return sprintf('%.3F %.3F %.3F ',$c[0],$c[1],$c[2]).($mode ? 'RG' : 'rg'); + elseif (count($c)==4) return sprintf('%.3F %.3F %.3F %.3F ',$c[0],$c[1],$c[2],$c[3]).($mode ? 'K' : 'k'); + return null; + } + + function SetX($x) + { + $this->x=$x; + } + + function SetY($y) + { + $this->x=$this->lMargin; + $this->y=$y; + } + + function SetXY($x, $y) + { + $this->x=$x; + $this->y=$y; + } + } +} diff --git a/main/inc/lib/html2pdf/html2pdf.class.php b/main/inc/lib/html2pdf/html2pdf.class.php index 75ec856e9e..d415531977 100755 --- a/main/inc/lib/html2pdf/html2pdf.class.php +++ b/main/inc/lib/html2pdf/html2pdf.class.php @@ -1,60 +1,33 @@ PDF, utilise fpdf de Olivier PLATHEY - * Distribu� sous la licence LGPL. + * + * Convertisseur HTML => PDF, utilise fpdf de Olivier PLATHEY + * Distribué sous la licence LGPL. * * @author Laurent MINGUET - * @version 3.24 - 05/08/2009 + * @version 3.26 - 16/11/2009 */ + /** -* Author: Juan Carlos Ra�a. +* Author: Juan Carlos Raña Trabado * forced to read first because another similar library (but different version) can be found elsewhere in the system */ $configurationPearPath = $configuration['root_sys'].'/main/inc/lib/html2pdf'; ini_set('include_path', $configurationPearPath); + if (!defined('__CLASS_HTML2PDF__')) { - define('__CLASS_HTML2PDF__', '3.24'); - - // vous pouvez utiliser cette fonction de debug comme suit - // pour voir le temps et la m�moire utilis�s (sous linux) pour la conversion : - // echo HTML2PDFgetTimerDebug(); - // $html2pdf->WriteHTML($content); - // echo HTML2PDFgetTimerDebug(); - function HTML2PDFgetTimerDebug($debug=false) - { - global $TIMER_ACTION_LAST; - list($usec, $sec) = explode(" ", microtime()); - $time = (float)$sec + (float)$usec; - $mem = HTML2PDFgetMem(); - - if (!$TIMER_ACTION_LAST) - { - if ($debug) $ret = null; - else $ret = 'Debug : init'."
\n"; - } - else - { - $aff_time = $time-$TIMER_ACTION_LAST[0]; - $aff_mem = $mem; - if ($debug) $ret = array($aff_time, $aff_mem); - else $ret = 'Timer : '.number_format($aff_time, 3, '.', '').'s - Memory used '.$aff_mem.' Ko'."
\n"; - } - $TIMER_ACTION_LAST = array($time, $mem); - return $ret; - } - function HTML2PDFgetMem() { return function_exists('memory_get_usage') ? floor(memory_get_usage()/1024) : 0; } + define('__CLASS_HTML2PDF__', '3.26'); - require_once(dirname(__FILE__).'/_mypdf/mypdf.class.php'); // classe mypdf d�riv� de fpdf de Olivier PLATHEY + require_once(dirname(__FILE__).'/_mypdf/mypdf.class.php'); // classe mypdf dérivé de fpdf de Olivier PLATHEY require_once(dirname(__FILE__).'/parsingHTML.class.php'); // classe de parsing HTML require_once(dirname(__FILE__).'/styleHTML.class.php'); // classe de gestion des styles - global $HTML2PDF_TABLEAU; $HTML2PDF_TABLEAU = array(); // tableau global necessaire � la gestion des tables imbriqu�es + global $HTML2PDF_TABLEAU; $HTML2PDF_TABLEAU = array(); // tableau global necessaire à la gestion des tables imbriquées class HTML2PDF { @@ -63,49 +36,61 @@ if (!defined('__CLASS_HTML2PDF__')) var $format = 'A4'; // format de la page : A4, A3, ... var $background = array(); // informations sur le background var $testTDin1page = true; // activer le test de TD ne devant pas depasser une page - + var $testIsImage = true; // test si les images existes ou non + var $style = null; // objet de style var $parsing = null; // objet de parsing var $parse_pos = 0; // position du parsing var $temp_pos = 0; // position temporaire pour multi tableau - + var $page = 0; // numero de la page courante + var $sub_html = null; // sous html var $sub_part = false; // indicateur de sous html var $isSubPart = false; // indique que le convertisseur courant est un sous html - + var $pdf = null; // objet PDF var $maxX = 0; // zone maxi X var $maxY = 0; // zone maxi Y var $FirstPage = true; // premier page - + var $defaultLeft = 0; // marges par default de la page var $defaultTop = 0; var $defaultRight = 0; var $defaultBottom = 0; - - var $margeLeft = 0; //marges r�elles de la page + + var $margeLeft = 0; //marges réelles de la page var $margeTop = 0; var $margeRight = 0; var $margeBottom = 0; var $marges = array(); var $Maxs = array(); - - var $maxH = 0; // plus grande hauteur dans la ligne, pour saut de ligne � corriger - var $inLink = ''; // indique si on est � l'interieur d'un lien - var $lstAncre = array(); // liste des ancres d�tect�es ou cr��es + + var $maxH = 0; // plus grande hauteur dans la ligne, pour saut de ligne à corriger + var $inLink = ''; // indique si on est à l'interieur d'un lien + var $lstAncre = array(); // liste des ancres détectées ou créées var $subHEADER = array(); // tableau des sous commandes pour faire l'HEADER var $subFOOTER = array(); // tableau des sous commandes pour faire le FOOTER - var $subSTATES = array(); // tableau de sauvegarde de certains param�tres + var $subSTATES = array(); // tableau de sauvegarde de certains paramètres var $defLIST = array(); // tableau de sauvegarde de l'etat des UL et OL - + var $lstChamps = array(); // liste des champs var $lstSelect = array(); // options du select en cours var $previousCall = null; // dernier appel + var $pageMarges = array(); // marges spécifiques dues aux floats var $isInTfoot = false; // indique si on est dans un tfoot - var $pageMarges = array(); // marges sp�cifiques dues aux floats + var $isInOverflow = false; // indique si on est dans une div overflow var $isAfterFloat = false; // indique si on est apres un float var $forOneLine = false; // indique si on est dans un sous HTML ne servant qu'a calculer la taille de la prochaine ligne + var $encoding = 'ISO-8859-15'; // encodage utilisé pour les entites html + + var $DEBUG_actif = false; // indique si on est en mode debug + var $DEBUG_ok_usage = false; // indique l'existance de la fonction memory_get_usage + var $DEBUG_ok_peak = false; // indique l'existance de la fonction memory_get_peak_usage + var $DEBUG_level = 0; // niveau du debug + var $DEBUG_start_time = 0; // + var $DEBUG_last_time = 0; // + var $defaultFont = null; // fonte par défaut si la fonte demandée n'existe pas /** * Constructeur @@ -114,35 +99,41 @@ if (!defined('__CLASS_HTML2PDF__')) * @param string format A4, A5, ... * @param string langue : fr, en, it... * @param array marges par defaut, dans l'ordre (left, top, right, bottom) - * @param boolean forcer la cr�ation de la premiere page, ne pas utiliser, c'est utilis� en interne pour la gestion des tableaux + * @param boolean forcer la création de la premiere page, ne pas utiliser, c'est utilisé en interne pour la gestion des tableaux * @return null */ function HTML2PDF($sens = 'P', $format = 'A4', $langue='fr', $marges = array(5, 5, 5, 8), $force_page = false) { - // sauvegarde des param�tres + // sauvegarde des paramètres + $this->page = 0; $this->sens = $sens; $this->format = $format; $this->FirstPage = true; $this->langue = strtolower($langue); - $this->setTestTdInOnePage(true); - + // chargement du fichier de langue $this->textLOAD($this->langue); - - // cr�ation de l' objet PDF + + // création de l' objet PDF $this->pdf = new MyPDF($sens, 'mm', $format); // initialisation des styles $this->style = new styleHTML($this->pdf); $this->style->FontSet(); $this->defLIST = array(); - + + // initialisations diverses + $this->setTestTdInOnePage(true); + $this->setTestIsImage(true); + $this->setDefaultFont(null); + // initialisation du parsing $this->parsing = new parsingHTML(); - $this->sub_html = null; + $this->sub_html = null; $this->sub_part = false; - + // initialisation des marges + if (!is_array($marges)) $marges = array($marges, $marges, $marges, $marges); $this->setDefaultMargins($marges[0], $marges[1], $marges[2], $marges[3]); $this->setMargins(); $this->marges = array(); @@ -150,10 +141,79 @@ if (!defined('__CLASS_HTML2PDF__')) // initialisation des champs de formulaire $this->lstChamps = array(); - // premier page forc�e - if ($force_page) $this->setNewPage($this->sens); + // premier page forcée + if ($force_page) $this->setNewPage($this->format, $this->sens); } - + + /** + * activer le debug mode + * + * @return null + */ + function setModeDebug() + { + list($usec, $sec) = explode(' ', microtime()); + + $this->DEBUG_actif = true; + $this->DEBUG_ok_usage = function_exists('memory_get_usage'); + $this->DEBUG_ok_peak = function_exists('memory_get_peak_usage'); + $this->DEBUG_start_time = (float)$sec + (float)$usec; + $this->DEBUG_last_time = (float)$sec + (float)$usec; + + $this->DEBUG_stepline('step', 'time', 'delta', 'memory', 'peak'); + $this->DEBUG_add('Init debug'); + } + + /** + * rajouter une ligne de debug + * + * @param string nom de l'etape + * @param boolean true=monter d'un niveau, false=descendre d'un niveau, null : ne rien faire + * @return null + */ + function DEBUG_add($nom, $level=null) + { + list($usec, $sec) = explode(' ', microtime()); + if ($level===true) $this->DEBUG_level++; + + $nom = str_repeat(' ',$this->DEBUG_level). $nom.($level===true ? ' Begin' : ($level===false ? ' End' : '')); + $time = (float)$sec + (float)$usec; + $usage = ($this->DEBUG_ok_usage ? memory_get_usage() : 0); + $peak = ($this->DEBUG_ok_peak ? memory_get_peak_usage() : 0); + + $this->DEBUG_stepline( + $nom, + number_format(($time - $this->DEBUG_start_time)*1000, 1, '.', ' ').' ms', + number_format(($time - $this->DEBUG_last_time)*1000, 1, '.', ' ').' ms', + number_format($usage/1024, 1, '.', ' ').' Ko', + number_format($peak/1024, 1, '.', ' ').' Ko'); + + $this->DEBUG_last_time = $time; + if ($level===false) $this->DEBUG_level--; + return true; + } + + /** + * affiche une ligne de debug + * + * @param string nom de l'etape + * @param string valeur 1 + * @param string valeur 2 + * @param string valeur 3 + * @param string valeur 4 + * @return null + */ + function DEBUG_stepline($nom, $val1, $val2, $val3, $val4) + { + $txt = str_pad($nom, 30, ' ', STR_PAD_RIGHT). + str_pad($val1, 12, ' ', STR_PAD_LEFT). + str_pad($val2, 12, ' ', STR_PAD_LEFT). + str_pad($val3, 15, ' ', STR_PAD_LEFT). + str_pad($val4, 15, ' ', STR_PAD_LEFT); + + echo '
'.$txt.'
'; + } + /** * activer ou desactiver le test de TD ne devant pas depasser une page * @@ -163,14 +223,52 @@ if (!defined('__CLASS_HTML2PDF__')) function setTestTdInOnePage($mode = true) { $old = $this->testTDin1page; - $this->testTDin1page = $mode ? true : false; - return $old; } - + + /** + * renseigner l'encoding à utiliser + * + * @param string nouvel encoding + * @return string ancien encoding + */ + function setEncoding($encoding = 'ISO-8859-15') + { + $old = $this->encoding; + $this->encoding = $encoding; + return $old; + } + + /** + * activer ou desactiver le test sur la présence des images + * + * @param boolean nouvel etat + * @return boolean ancien etat + */ + function setTestIsImage($mode = true) + { + $old = $this->testIsImage; + $this->testIsImage = $mode ? true : false; + return $old; + } + + /** + * définit la fonte par défaut si aucun fonte n'est spécifiée, ou si la fonte demandée n'existe pas + * + * @param string nom de la fonte par defaut. si null : Arial pour fonte non spécifiée, et erreur pour fonte non existante + * @return string nom de l'ancienne fonte par defaut + */ + function setDefaultFont($default = null) + { + $old = $this->defaultFont; + $this->defaultFont = $default; + $this->style->setDefaultFont($default); + return $old; + } + /** - * d�finir les marges par d�fault + * définir les marges par défault * * @param int en mm, marge left * @param int en mm, marge top @@ -182,7 +280,7 @@ if (!defined('__CLASS_HTML2PDF__')) { if ($right===null) $right = $left; if ($bottom===null) $bottom = 8; - + $this->defaultLeft = $this->style->ConvertToMM($left.'mm'); $this->defaultTop = $this->style->ConvertToMM($top.'mm'); $this->defaultRight = $this->style->ConvertToMM($right.'mm'); @@ -190,7 +288,7 @@ if (!defined('__CLASS_HTML2PDF__')) } /** - * d�finir les marges r�elles, fonctions de la balise page + * définir les marges réelles, fonctions de la balise page * * @return null */ @@ -200,12 +298,12 @@ if (!defined('__CLASS_HTML2PDF__')) $this->margeRight = $this->defaultRight + (isset($this->background['right']) ? $this->background['right'] : 0); $this->margeTop = $this->defaultTop + (isset($this->background['top']) ? $this->background['top'] : 0); $this->margeBottom = $this->defaultBottom + (isset($this->background['bottom']) ? $this->background['bottom'] : 0); - + $this->pdf->SetMargins($this->margeLeft, $this->margeTop, $this->margeRight); $this->pdf->cMargin = 0; $this->pdf->SetAutoPageBreak(false, $this->margeBottom); } - + /** * recuperer les positions x minimales et maximales en fonction d'une hauteur * @@ -216,13 +314,13 @@ if (!defined('__CLASS_HTML2PDF__')) { $y = floor($y*100); $x = array($this->pdf->lMargin, $this->pdf->w-$this->pdf->rMargin); - + foreach($this->pageMarges as $m_y => $m_x) if ($m_y<=$y) $x = $m_x; - + return $x; } - + /** * ajouter une marge suite a un float * @@ -237,30 +335,30 @@ if (!defined('__CLASS_HTML2PDF__')) { $old1 = $this->getMargins($y1); $old2 = $this->getMargins($y2); - if ($float=='left') $old1[0] = $x2; + if ($float=='left') $old1[0] = $x2; if ($float=='right') $old1[1] = $x1; - + $y1 = floor($y1*100); $y2 = floor($y2*100); foreach($this->pageMarges as $m_y => $m_x) { - if ($m_y<$y1) continue; - if ($m_y>$y2) break; - if ($float=='left' && $this->pageMarges[$m_y][0]<$x2) unset($this->pageMarges[$m_y]); + if ($m_y<$y1) continue; + if ($m_y>$y2) break; + if ($float=='left' && $this->pageMarges[$m_y][0]<$x2) unset($this->pageMarges[$m_y]); if ($float=='right' && $this->pageMarges[$m_y][1]>$x1) unset($this->pageMarges[$m_y]); } $this->pageMarges[$y1] = $old1; $this->pageMarges[$y2] = $old2; - + ksort($this->pageMarges); - + $this->isAfterFloat = true; } - + /** - * d�finir des nouvelles marges et sauvegarder les anciennes + * définir des nouvelles marges et sauvegarder les anciennes * * @param float marge left * @param float marge top @@ -275,9 +373,9 @@ if (!defined('__CLASS_HTML2PDF__')) $this->pageMarges = array(); $this->pageMarges[floor($mt*100)] = array($ml, $this->pdf->w-$mr); } - + /** - * r�cuperer les derni�res marches sauv�es + * récuperer les dernières marches sauvées * * @return null */ @@ -298,11 +396,11 @@ if (!defined('__CLASS_HTML2PDF__')) $mr = $this->margeRight; $mP = array($mt => array($ml, $this->pdf->w-$mr)); } - + $this->pdf->SetMargins($ml, $mt, $mr); $this->pageMarges = $mP; } - + /** * permet d'ajouter une fonte. * @@ -315,9 +413,9 @@ if (!defined('__CLASS_HTML2PDF__')) { $this->pdf->AddFont($family, $style, $file); } - + /** - * sauvegarder l'�tat actuelle des maximums + * sauvegarder l'état actuelle des maximums * * @return null */ @@ -325,9 +423,9 @@ if (!defined('__CLASS_HTML2PDF__')) { $this->Maxs[] = array($this->maxX, $this->maxY, $this->maxH); } - + /** - * charger le dernier �tat sauv� des maximums + * charger le dernier état sauvé des maximums * * @return null */ @@ -348,7 +446,7 @@ if (!defined('__CLASS_HTML2PDF__')) $this->maxH = 0; } } - + /** * afficher l'header contenu dans page_header * @@ -360,11 +458,11 @@ if (!defined('__CLASS_HTML2PDF__')) $OLD_parse_pos = $this->parse_pos; $OLD_parse_code = $this->parsing->code; - + $this->parse_pos = 0; $this->parsing->code = $this->subHEADER; $this->MakeHTMLcode(); - + $this->parse_pos = $OLD_parse_pos; $this->parsing->code = $OLD_parse_code; } @@ -380,112 +478,111 @@ if (!defined('__CLASS_HTML2PDF__')) $OLD_parse_pos = $this->parse_pos; $OLD_parse_code = $this->parsing->code; - + $this->parse_pos = 0; $this->parsing->code = $this->subFOOTER; $this->MakeHTMLcode(); - + $this->parse_pos = $OLD_parse_pos; $this->parsing->code = $OLD_parse_code; } - + /** - * saut de ligne avec une hauteur sp�cifique + * saut de ligne avec une hauteur spécifique * * @param float hauteur de la ligne - * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte + * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte * @return null */ function setNewLine($h, $curr = null) { $this->pdf->Ln($h); - + $this->setNewPositionForNewLine($curr); } - + /** - * cr�ation d'une nouvelle page avec une orientation particuliere + * création d'une nouvelle page avec le format et l'orientation spécifies * + * @param mixed format de la page : A5, A4, array(width, height) * @param string sens P=portrait ou L=landscape - * @param array tableau des propri�t�s du fond de la page - * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte + * @param array tableau des propriétés du fond de la page + * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte * @return null */ - function setNewPage($orientation = '', $background = null, $curr = null) + function setNewPage($format = null, $orientation = '', $background = null, $curr = null) { -/* - if (!$this->FirstPage) - { - $info = debug_backtrace(); foreach($info as $k => $v) { unset($info[$k]['object']); unset($info[$k]['type']); unset($info[$k]['args']);} - echo '
'.print_r($info, true).'

'; - } -*/ $this->FirstPage = false; + $this->format = $format ? $format : $this->format; $this->sens = $orientation ? $orientation : $this->sens; $this->background = $background!==null ? $background : $this->background; - $this->maxY = 0; + $this->maxY = 0; $this->maxX = 0; - + $this->maxH = 0; + $this->pdf->lMargin = $this->defaultLeft; $this->pdf->rMargin = $this->defaultRight; $this->pdf->tMargin = $this->defaultTop; - $this->pdf->AddPage($this->sens); - + $this->pdf->AddPage($this->sens, $this->format); + $this->page++; + if (!$this->sub_part && !$this->isSubPart) { if (is_array($this->background)) { if (isset($this->background['color']) && $this->background['color']) { - $this->pdf->SetFillColor($this->background['color'][0], $this->background['color'][1], $this->background['color'][2]); + $this->pdf->setMyFillColor($this->background['color']); $this->pdf->Rect(0, 0, $this->pdf->w, $this->pdf->h, 'F'); } if (isset($this->background['img']) && $this->background['img']) $this->pdf->Image($this->background['img'], $this->background['posX'], $this->background['posY'], $this->background['width']); - } - + } + $this->SetPageHeader(); $this->SetPageFooter(); } - + $this->SetMargins(); $this->pdf->y = $this->margeTop; - + $this->setNewPositionForNewLine($curr); + $this->maxH = 0; } - + /** * calcul de la position de debut de la prochaine ligne en fonction de l'alignement voulu * - * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte + * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte * @return null */ function setNewPositionForNewLine($curr = null) { list($lx, $rx) = $this->getMargins($this->pdf->y); $this->pdf->x=$lx; - + if ( - $this->style->value['text-align']!='right' && - $this->style->value['text-align']!='center' + $this->style->value['text-align']!='right' && + $this->style->value['text-align']!='center' && + $this->style->value['text-align']!='justify' ) return null; $sub = null; $this->CreateSubHTML($sub); - $sub->saveMargin(0, 0, $sub->pdf->w-$rx+$lx); + $sub->saveMargin(0, 0, $sub->pdf->w-$rx+$lx); $sub->forOneLine = true; $sub->parse_pos = $this->parse_pos; $sub->parsing->code = $this->parsing->code; - + if ($curr!==null && $sub->parsing->code[$this->parse_pos]['name']=='write') $sub->parsing->code[$this->parse_pos]['param']['txt'] = substr($sub->parsing->code[$this->parse_pos]['param']['txt'], $curr); else $sub->parse_pos++; - - // pour chaque element identifi� par le parsing + + // pour chaque element identifié par le parsing for($sub->parse_pos; $sub->parse_posparsing->code); $sub->parse_pos++) { $todo = $sub->parsing->code[$sub->parse_pos]; @@ -494,62 +591,71 @@ if (!defined('__CLASS_HTML2PDF__')) $w = $sub->maxX; - unset($sub); + $this->DestroySubHTML($sub); if ($this->style->value['text-align']=='center') $this->pdf->x+= ($rx-$this->pdf->x-$w)*0.5-0.01; - else + elseif ($this->style->value['text-align']=='right') $this->pdf->x = $rx-$w-0.01; + else + $this->pdf->x = $lx; } - - /** - * r�cup�ration du PDF - * - * @param string nom du fichier PDF - * @param boolean destination - * @return string contenu �ventuel du pdf + + /** + * récupération du PDF + * + * @param string nom du fichier PDF + * @param boolean destination + * @return string contenu éventuel du pdf + * * - * - * Destination o� envoyer le document. Le param�tre peut prendre les valeurs suivantes : - * true : equivalent � I - * false : equivalent � S - * I : envoyer en inline au navigateur. Le plug-in est utilis� s'il est install�. Le nom indiqu� dans name est utilis� lorsque l'on s�lectionne "Enregistrer sous" sur le lien g�n�rant le PDF. - * D : envoyer au navigateur en for�ant le t�l�chargement, avec le nom indiqu� dans name. - * F : sauver dans un fichier local, avec le nom indiqu� dans name (peut inclure un r�pertoire). - * S : renvoyer le document sous forme de cha�ne. name est ignor�. + * Destination où envoyer le document. Le paramètre peut prendre les valeurs suivantes : + * true : equivalent à I + * false : equivalent à S + * I : envoyer en inline au navigateur. Le plug-in est utilisé s'il est installé. Le nom indiqué dans name est utilisé lorsque l'on sélectionne "Enregistrer sous" sur le lien générant le PDF. + * D : envoyer au navigateur en forçant le téléchargement, avec le nom indiqué dans name. + * F : sauver dans un fichier local, avec le nom indiqué dans name (peut inclure un répertoire). + * S : renvoyer le document sous forme de chaîne. name est ignoré. */ function Output($name = '', $dest = false) { + if ($this->DEBUG_actif) + { + $this->DEBUG_add('Before output'); + $this->pdf->Close(); + exit; + } + // nettoyage global $HTML2PDF_TABLEAU; $HTML2PDF_TABLEAU = array(); - // interpretation des param�tres + // interpretation des paramètres if ($dest===false) $dest = 'I'; if ($dest===true) $dest = 'S'; if ($dest==='') $dest = 'I'; if ($name=='') $name='document.pdf'; - + // verification de la destination $dest = strtoupper($dest); if (!in_array($dest, array('I', 'D', 'F', 'S'))) $dest = 'I'; - + // verification du nom if (strtolower(substr($name, -4))!='.pdf') { echo 'ERROR : The output document name "'.$name.'" is not a PDF name'; exit; } - + return $this->pdf->Output($name, $dest); } - + /** - * cr�ation d'un sous HTML2PDF pour la gestion des tableaux imbriqu�s + * création d'un sous HTML2PDF pour la gestion des tableaux imbriqués * - * @param HTML2PDF futur sous HTML2PDF pass� en r�f�rence pour cr�ation + * @param HTML2PDF futur sous HTML2PDF passé en référence pour création * @param integer marge eventuelle de l'objet si simulation d'un TD * @return null - */ + */ function CreateSubHTML(&$sub_html, $cellmargin=0) { // initialisation du sous objet @@ -561,8 +667,10 @@ if (!defined('__CLASS_HTML2PDF__')) true ); $sub_html->isSubPart = true; + $sub_html->setEncoding($this->encoding); $sub_html->setTestTdInOnePage($this->testTDin1page); - + $sub_html->setTestIsImage($this->testIsImage); + $sub_html->setDefaultFont($this->defaultFont); $sub_html->style->css = $this->style->css; $sub_html->style->css_keys = $this->style->css_keys; $sub_html->style->table = $this->style->table; @@ -570,7 +678,7 @@ if (!defined('__CLASS_HTML2PDF__')) $sub_html->style->value['text-align'] = 'left'; $sub_html->defLIST = $this->defLIST; $sub_html->style->onlyLeft = true; - + // initialisation de la largeur if ($this->style->value['width']) { @@ -581,7 +689,7 @@ if (!defined('__CLASS_HTML2PDF__')) } else $marge = $this->margeLeft+$this->margeRight; - + $sub_html->saveMargin(0, 0, $marge); // initialisation des fontes @@ -590,30 +698,30 @@ if (!defined('__CLASS_HTML2PDF__')) $sub_html->pdf->diffs = &$this->pdf->diffs; // initialisation des positions et autre + $sub_html->page = $this->page; $sub_html->maxX = 0; $sub_html->maxY = 0; $sub_html->maxH = 0; - $sub_html->pdf->setX(0); - $sub_html->pdf->setY(0); + $sub_html->pdf->setXY(0, 0); $sub_html->style->FontSet(); } - + /** - * destruction d'un sous HTML2PDF pour la gestion des tableaux imbriqu�s + * destruction d'un sous HTML2PDF pour la gestion des tableaux imbriqués * * @return null - */ - function DestroySubHTML() + */ + function DestroySubHTML(&$sub_html) { - - unset($this->sub_html); - $this->sub_html = null; + $sub_html->pdf->Close(); + unset($sub_html); + $sub_html = null; } - + /** * Convertir un nombre arabe en nombre romain * - * @param integer nombre � convertir + * @param integer nombre à convertir * @return string nombre converti */ function listeArab2Rom($nb_ar) @@ -658,7 +766,7 @@ if (!defined('__CLASS_HTML2PDF__')) } return $nb_ro; } - + /** * Ajouter un LI au niveau actuel * @@ -675,7 +783,7 @@ if (!defined('__CLASS_HTML2PDF__')) /** * Recuperer le LI du niveau actuel * - * @return string chaine � afficher + * @return string chaine à afficher */ function listeGetLi() { @@ -683,32 +791,32 @@ if (!defined('__CLASS_HTML2PDF__')) $st = $this->defLIST[count($this->defLIST)-1]['style']; $nb = $this->defLIST[count($this->defLIST)-1]['nb']; $up = (substr($st, 0, 6)=='upper-'); - + if ($im) return array(false, false, $im); - + switch($st) { case 'none': return array('arial', true, ' '); - + case 'upper-alpha': case 'lower-alpha': $str = ''; while($nb>26) { - $str = chr(96+$nb%26).$str; - $nb = floor($nb/26); + $str = chr(96+$nb%26).$str; + $nb = floor($nb/26); } - $str = chr(96+$nb).$str; - + $str = chr(96+$nb).$str; + return array('arial', false, ($up ? strtoupper($str) : $str).'.'); case 'upper-roman': case 'lower-roman': $str = $this->listeArab2Rom($nb); - + return array('arial', false, ($up ? strtoupper($str) : $str).'.'); - + case 'decimal': return array('arial', false, $nb.'.'); @@ -723,7 +831,7 @@ if (!defined('__CLASS_HTML2PDF__')) return array('zapfdingbats', true, chr(108)); } } - + /** * Ajouter un niveau de liste * @@ -742,10 +850,10 @@ if (!defined('__CLASS_HTML2PDF__')) } else $img = null; - + if (!in_array($type, array('ul', 'ol'))) $type = 'ul'; if (!in_array($style, array('lower-alpha', 'upper-alpha', 'upper-roman', 'lower-roman', 'decimal', 'square', 'circle', 'disc', 'none'))) $style = ''; - + if (!$style) { if ($type=='ul') $style = 'disc'; @@ -753,7 +861,7 @@ if (!defined('__CLASS_HTML2PDF__')) } $this->defLIST[count($this->defLIST)] = array('style' => $style, 'nb' => 0, 'img' => $img); } - + /** * Supprimer un niveau de liste * @@ -767,18 +875,22 @@ if (!defined('__CLASS_HTML2PDF__')) $this->defLIST = array_values($this->defLIST); } } - + /** * traitement d'un code HTML * - * @param string code HTML � convertir + * @param string code HTML à convertir * @param boolean afficher en pdf (false) ou en html (true) * @return null - */ + */ function WriteHTML($html, $vue = false) { + // si c'est une vrai page HTML, une conversion s'impose + if (preg_match('/getHtmlFromPage($html); + $html = str_replace('[[page_nb]]', '{nb}', $html); - + $html = str_replace('[[date_y]]', date('Y'), $html); $html = str_replace('[[date_m]]', date('m'), $html); $html = str_replace('[[date_d]]', date('d'), $html); @@ -786,9 +898,9 @@ if (!defined('__CLASS_HTML2PDF__')) $html = str_replace('[[date_h]]', date('H'), $html); $html = str_replace('[[date_i]]', date('i'), $html); $html = str_replace('[[date_s]]', date('s'), $html); - - // si on veut voir le r�sultat en HTML => on appelle la fonction - if ($vue) $this->vueHTML($html); + + // si on veut voir le résultat en HTML => on appelle la fonction + if ($vue) $this->vueHTML($html); // sinon, traitement pour conversion en PDF : // parsing @@ -798,25 +910,50 @@ if (!defined('__CLASS_HTML2PDF__')) $this->parsing->parse(); $this->MakeHTMLcode(); } - + + function getHtmlFromPage($html) + { + $html = str_replace(''; + + // extraction des balises link + preg_match_all('/]*)>/isU', $html, $match); + foreach($match[0] as $src) + $content = $src.''.$content; + + // extraction des balises style + preg_match_all('/]*>(.*)<\/style[^>]*>/isU', $html, $match); + foreach($match[0] as $src) + $content = $src.$content; + + return $content; + } + function MakeHTMLcode() { - // pour chaque element identifi� par le parsing + // pour chaque element identifié par le parsing for($this->parse_pos=0; $this->parse_posparsing->code); $this->parse_pos++) { - // r�cup�ration de l'�l�ment + // récupération de l'élément $todo = $this->parsing->code[$this->parse_pos]; - + // si c'est une ouverture de tableau if (in_array($todo['name'], array('table', 'ul', 'ol')) && !$todo['close']) { - // on va cr�er un sous HTML, et on va travailler sur une position temporaire + // on va créer un sous HTML, et on va travailler sur une position temporaire $tag_open = $todo['name']; $this->sub_part = true; $this->temp_pos = $this->parse_pos; - - // pour tous les �l�ments jusqu'� la fermeture de la table afin de pr�parer les dimensions + + // pour tous les éléments jusqu'à la fermeture de la table afin de préparer les dimensions while(isset($this->parsing->code[$this->temp_pos]) && !($this->parsing->code[$this->temp_pos]['name']==$tag_open && $this->parsing->code[$this->temp_pos]['close'])) { $this->loadAction($this->parsing->code[$this->temp_pos]); @@ -825,20 +962,20 @@ if (!defined('__CLASS_HTML2PDF__')) if (isset($this->parsing->code[$this->temp_pos])) $this->loadAction($this->parsing->code[$this->temp_pos]); $this->sub_part = false; } - - // chargement de l'action correspondant � l'�l�ment + + // chargement de l'action correspondant à l'élément $this->loadAction($todo); - } - } - + } + } + /** * affichage en mode HTML du contenu * * @param string contenu * @return null - */ + */ function vueHTML($content) { $content = preg_replace('/]*)>/isU', '
'.@HTML2PDF::textGET('vue01').' : $1
', $content); @@ -847,7 +984,11 @@ if (!defined('__CLASS_HTML2PDF__')) $content = preg_replace('/<\/page([^>]*)>/isU', '
', $content); $content = preg_replace('/]*)>/isU', '
bookmark : $1
', $content); $content = preg_replace('/<\/bookmark([^>]*)>/isU', '', $content); - + $content = preg_replace('/]*)>/isU', '
barcode : $1
', $content); + $content = preg_replace('/<\/barcode([^>]*)>/isU', '', $content); + $content = preg_replace('/]*)>/isU', '
qrcode : $1
', $content); + $content = preg_replace('/<\/qrcode([^>]*)>/isU', '', $content); + echo ' @@ -858,29 +999,29 @@ if (!defined('__CLASS_HTML2PDF__')) '.$content.' '; - exit; + exit; } /** - * chargement de l'action correspondante � un element de parsing + * chargement de l'action correspondante à un element de parsing * - * @param array �l�ment de parsing + * @param array élément de parsing * @return null - */ + */ function loadAction($row) { // nom de l'action $fnc = ($row['close'] ? 'c_' : 'o_').strtoupper($row['name']); - + // parametres de l'action $param = $row['param']; - - // si aucune page n'est cr��, on la cr�� + + // si aucune page n'est créé, on la créé if ($fnc!='o_PAGE' && $this->FirstPage) { $this->setNewPage(); } - + // lancement de l'action if (is_callable(array(&$this, $fnc))) { @@ -890,44 +1031,56 @@ if (!defined('__CLASS_HTML2PDF__')) } else { - @HTML2PDF::makeError(1, __FILE__, __LINE__, strtoupper($row['name'])); + @HTML2PDF::makeError(1, __FILE__, __LINE__, strtoupper($row['name']), $this->parsing->getHtmlErrorCode($row['html_pos'])); return false; } } - + /** * balise : PAGE * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_PAGE($param) { if ($this->forOneLine) return false; + if ($this->DEBUG_actif) $this->DEBUG_add('PAGE n°'.($this->page+1), true); $newPageSet= (!isset($param['pageset']) || $param['pageset']!='old'); - + $this->maxH = 0; if ($newPageSet) { $this->subHEADER = array(); $this->subFOOTER = array(); - - // identification de l'orientation demand�e + + // identification de l'orientation demandée $orientation = ''; if (isset($param['orientation'])) { $param['orientation'] = strtolower($param['orientation']); if ($param['orientation']=='p') $orientation = 'P'; if ($param['orientation']=='portrait') $orientation = 'P'; - + if ($param['orientation']=='l') $orientation = 'L'; if ($param['orientation']=='paysage') $orientation = 'L'; if ($param['orientation']=='landscape') $orientation = 'L'; } - - // identification des propri�t�s du background + + // identification de l'orientation demandée + $format = null; + if (isset($param['format'])) + { + $format = strtolower($param['format']); + if (preg_match('/^([0-9]+)x([0-9]+)$/isU', $format, $match)) + { + $format = array(intval($match[1]), intval($match[2])); + } + } + + // identification des propriétés du background $background = array(); if (isset($param['backimg'])) { @@ -935,8 +1088,8 @@ if (!defined('__CLASS_HTML2PDF__')) $background['posX'] = isset($param['backimgx']) ? $param['backimgx'] : 'center'; // position horizontale de l'image $background['posY'] = isset($param['backimgy']) ? $param['backimgy'] : 'middle'; // position verticale de l'image $background['width'] = isset($param['backimgw']) ? $param['backimgw'] : '100%'; // taille de l'image (100% = largueur de la feuille) - - // conversion du nom de l'image, en cas de param�tres en _GET + + // conversion du nom de l'image, en cas de paramètres en _GET $background['img'] = str_replace('&', '&', $background['img']); // conversion des positions if ($background['posX']=='left') $background['posX'] = '0%'; @@ -945,31 +1098,31 @@ if (!defined('__CLASS_HTML2PDF__')) if ($background['posY']=='top') $background['posY'] = '0%'; if ($background['posY']=='middle') $background['posY'] = '50%'; if ($background['posY']=='bottom') $background['posY'] = '100%'; - - - // si il y a une image de pr�cis� - if ($background['img']) + + + // si il y a une image de précisé + if ($background['img']) { // est-ce que c'est une image ? $infos=@GetImageSize($background['img']); if (count($infos)>1) { - // taille de l'image, en fonction de la taille sp�cifi�e. + // taille de l'image, en fonction de la taille spécifiée. $Wi = $this->style->ConvertToMM($background['width'], $this->pdf->w); $Hi = $Wi*$infos[1]/$infos[0]; - - // r�cup�ration des dimensions et positions de l'image - $background['width'] = $Wi; + + // récupération des dimensions et positions de l'image + $background['width'] = $Wi; $background['posX'] = $this->style->ConvertToMM($background['posX'], $this->pdf->w - $Wi); $background['posY'] = $this->style->ConvertToMM($background['posY'], $this->pdf->h - $Hi); } else - $background = array(); + $background = array(); } else $background = array(); } - + // marges TOP et BOTTOM pour le texte. $background['top'] = isset($param['backtop']) ? $param['backtop'] : '0'; $background['bottom'] = isset($param['backbottom']) ? $param['backbottom'] : '0'; @@ -987,17 +1140,17 @@ if (!defined('__CLASS_HTML2PDF__')) $background['right'] = $this->style->ConvertToMM($background['right'], $this->pdf->w); $res = false; - $background['color'] = isset($param['backcolor']) ? $this->style->ConvertToRVB($param['backcolor'], $res) : null; + $background['color'] = isset($param['backcolor']) ? $this->style->ConvertToColor($param['backcolor'], $res) : null; if (!$res) $background['color'] = null; $this->style->save(); $this->style->analyse('PAGE', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + // nouvelle page - $this->setNewPage($orientation, $background); - + $this->setNewPage($format, $orientation, $background); + // footer automatique if (isset($param['footer'])) { @@ -1023,20 +1176,20 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('PAGE', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $this->setNewPage(); - } - + } + return true; } /** * balise : PAGE * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_PAGE($param) { if ($this->forOneLine) return false; @@ -1045,11 +1198,13 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->load(); $this->style->FontSet(); - + + if ($this->DEBUG_actif) $this->DEBUG_add('PAGE n°'.$this->page, false); + return true; } - - + + function o_PAGE_HEADER($param) { if ($this->forOneLine) return false; @@ -1064,10 +1219,10 @@ if (!defined('__CLASS_HTML2PDF__')) } $this->SetPageHeader(); - + return true; } - + function o_PAGE_FOOTER($param) { if ($this->forOneLine) return false; @@ -1080,9 +1235,9 @@ if (!defined('__CLASS_HTML2PDF__')) $this->subFOOTER[] = $todo; if (strtolower($todo['name'])=='page_footer_sub' && $todo['close']) break; } - + $this->SetPageFooter(); - + return true; } @@ -1090,33 +1245,40 @@ if (!defined('__CLASS_HTML2PDF__')) { if ($this->forOneLine) return false; + // sauvegarde de l'état $this->subSTATES = array(); $this->subSTATES['x'] = $this->pdf->x; $this->subSTATES['y'] = $this->pdf->y; $this->subSTATES['s'] = $this->style->value; $this->subSTATES['t'] = $this->style->table; - $this->subSTATES['ml'] = $this->pdf->lMargin; - $this->subSTATES['mr'] = $this->pdf->rMargin; - $this->subSTATES['mt'] = $this->pdf->tMargin; - $this->subSTATES['mb'] = $this->pdf->bMargin; - - $this->pdf->x = $this->defaultLeft; - $this->pdf->y = $this->defaultTop; + $this->subSTATES['ml'] = $this->margeLeft; + $this->subSTATES['mr'] = $this->margeRight; + $this->subSTATES['mt'] = $this->margeTop; + $this->subSTATES['mb'] = $this->margeBottom; + $this->subSTATES['mp'] = $this->pageMarges; + + // nouvel etat pour le footer + $this->pageMarges = array(); + $this->margeLeft = $this->defaultLeft; + $this->margeRight = $this->defaultRight; + $this->margeTop = $this->defaultTop; + $this->margeBottom = $this->defaultBottom; + $this->pdf->SetMargins($this->margeLeft, $this->margeTop, $this->margeRight); + $this->pdf->bMargin = $this->margeBottom; + $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; + $this->pdf->x = $this->defaultLeft; + $this->pdf->y = $this->defaultTop; + $this->style->initStyle(); $this->style->resetStyle(); $this->style->value['width'] = $this->pdf->w - $this->defaultLeft - $this->defaultRight; $this->style->table = array(); - $this->pdf->lMargin = $this->defaultLeft; - $this->pdf->rMargin = $this->defaultRight; - $this->pdf->tMargin = $this->defaultTop; - $this->pdf->bMargin = $this->defaultBottom; - $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; $this->style->save(); $this->style->analyse('page_header_sub', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $this->setNewPositionForNewLine(); return true; } @@ -1126,21 +1288,25 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->load(); - $this->pdf->x = $this->subSTATES['x']; - $this->pdf->y = $this->subSTATES['y']; - $this->style->value = $this->subSTATES['s']; - $this->style->table = $this->subSTATES['t']; - $this->pdf->lMargin = $this->subSTATES['ml']; - $this->pdf->rMargin = $this->subSTATES['mr']; - $this->pdf->tMargin = $this->subSTATES['mt']; - $this->pdf->bMargin = $this->subSTATES['mb']; - $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; - - $this->style->FontSet(); - + // retablissement de l'etat + $this->style->value = $this->subSTATES['s']; + $this->style->table = $this->subSTATES['t']; + $this->pageMarges = $this->subSTATES['mp']; + $this->margeLeft = $this->subSTATES['ml']; + $this->margeRight = $this->subSTATES['mr']; + $this->margeTop = $this->subSTATES['mt']; + $this->margeBottom = $this->subSTATES['mb']; + $this->pdf->SetMargins($this->margeLeft, $this->margeTop, $this->margeRight); + $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; + $this->pdf->x = $this->subSTATES['x']; + $this->pdf->y = $this->subSTATES['y']; + + $this->style->FontSet(); + $this->maxH = 0; + return true; } - + function o_PAGE_FOOTER_SUB($param) { if ($this->forOneLine) return false; @@ -1150,38 +1316,46 @@ if (!defined('__CLASS_HTML2PDF__')) $this->subSTATES['y'] = $this->pdf->y; $this->subSTATES['s'] = $this->style->value; $this->subSTATES['t'] = $this->style->table; - $this->subSTATES['ml'] = $this->pdf->lMargin; - $this->subSTATES['mr'] = $this->pdf->rMargin; - $this->subSTATES['mt'] = $this->pdf->tMargin; - $this->subSTATES['mb'] = $this->pdf->bMargin; - - $this->pdf->x = $this->defaultLeft; - $this->pdf->y = $this->defaultTop; + $this->subSTATES['ml'] = $this->margeLeft; + $this->subSTATES['mr'] = $this->margeRight; + $this->subSTATES['mt'] = $this->margeTop; + $this->subSTATES['mb'] = $this->margeBottom; + $this->subSTATES['mp'] = $this->pageMarges; + + // nouvel etat pour le footer + $this->pageMarges = array(); + $this->margeLeft = $this->defaultLeft; + $this->margeRight = $this->defaultRight; + $this->margeTop = $this->defaultTop; + $this->margeBottom = $this->defaultBottom; + $this->pdf->SetMargins($this->margeLeft, $this->margeTop, $this->margeRight); + $this->pdf->bMargin = $this->margeBottom; + $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; + $this->pdf->x = $this->defaultLeft; + $this->pdf->y = $this->defaultTop; + + $this->style->initStyle(); $this->style->resetStyle(); $this->style->value['width'] = $this->pdf->w - $this->defaultLeft - $this->defaultRight; - $this->style->table = array(); - $this->pdf->lMargin = $this->defaultLeft; - $this->pdf->rMargin = $this->defaultRight; - $this->pdf->tMargin = $this->defaultTop; - $this->pdf->bMargin = $this->defaultBottom; - $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; - - // on en cr�� un sous HTML que l'on transforme en PDF - // pour r�cup�rer la hauteur + $this->style->table = array(); + + // on en créé un sous HTML que l'on transforme en PDF + // pour récupérer la hauteur // on extrait tout ce qui est contenu dans le FOOTER $sub = null; $res = $this->parsing->getLevel($this->parse_pos); $this->CreateSubHTML($sub); $sub->writeHTML($res[1]); $this->pdf->y = $this->pdf->h - $sub->maxY - $this->defaultBottom - 0.01; - unset($sub); - - $this->style->save(); + $this->DestroySubHTML($sub); + + $this->style->save(); $this->style->analyse('page_footer_sub', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $this->setNewPositionForNewLine(); + return true; } @@ -1191,26 +1365,29 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->load(); - $this->pdf->x = $this->subSTATES['x']; - $this->pdf->y = $this->subSTATES['y']; - $this->style->value = $this->subSTATES['s']; - $this->style->table = $this->subSTATES['t']; - $this->pdf->lMargin = $this->subSTATES['ml']; - $this->pdf->rMargin = $this->subSTATES['mr']; - $this->pdf->tMargin = $this->subSTATES['mt']; - $this->pdf->bMargin = $this->subSTATES['mb']; - $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; - - $this->style->FontSet(); + $this->style->value = $this->subSTATES['s']; + $this->style->table = $this->subSTATES['t']; + $this->pageMarges = $this->subSTATES['mp']; + $this->margeLeft = $this->subSTATES['ml']; + $this->margeRight = $this->subSTATES['mr']; + $this->margeTop = $this->subSTATES['mt']; + $this->margeBottom = $this->subSTATES['mb']; + $this->pdf->SetMargins($this->margeLeft, $this->margeTop, $this->margeRight); + $this->pdf->PageBreakTrigger = $this->pdf->h - $this->pdf->bMargin; + $this->pdf->x = $this->subSTATES['x']; + $this->pdf->y = $this->subSTATES['y']; + $this->style->FontSet(); + $this->maxH = 0; + return true; } - + /** * balise : NOBREAK * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null */ function o_NOBREAK($param) @@ -1221,56 +1398,57 @@ if (!defined('__CLASS_HTML2PDF__')) // on extrait tout ce qui est contenu dans le NOBREAK $res = $this->parsing->getLevel($this->parse_pos); - // on en cr�� un sous HTML que l'on transforme en PDF + // on en créé un sous HTML que l'on transforme en PDF // pour analyse les dimensions // et voir si ca rentre $sub = null; $this->CreateSubHTML($sub); $sub->writeHTML($res[1]); - + $y = $this->pdf->getY(); if ( $sub->maxY < ($this->pdf->h - $this->pdf->tMargin-$this->pdf->bMargin) && $y + $sub->maxY>=($this->pdf->h - $this->pdf->bMargin) ) $this->setNewPage(); - unset($sub); - + $this->DestroySubHTML($sub); + return true; } - + /** * balise : NOBREAK * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_NOBREAK($param) { if ($this->forOneLine) return false; $this->maxH = 0; - + return true; } - + /** * balise : DIV * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_DIV($param, $other = 'div') { if ($this->forOneLine) return false; - + if ($this->DEBUG_actif) $this->DEBUG_add('DIV', true); + $this->style->save(); $this->style->analyse($other, $param); $this->style->FontSet(); - + $align_object = null; if ($this->style->value['margin-auto']) $align_object = 'center'; @@ -1279,68 +1457,142 @@ if (!defined('__CLASS_HTML2PDF__')) $marge['r'] = $this->style->value['border']['r']['width'] + $this->style->value['padding']['r']+0.03; $marge['t'] = $this->style->value['border']['t']['width'] + $this->style->value['padding']['t']+0.03; $marge['b'] = $this->style->value['border']['b']['width'] + $this->style->value['padding']['b']+0.03; - + // on extrait tout ce qui est contenu dans la DIV $res = $this->parsing->getLevel($this->parse_pos); - // on en cr�� un sous HTML que l'on transforme en PDF + // on en créé un sous HTML que l'on transforme en PDF // pour analyse les dimensions $w = 0; $h = 0; if (trim($res[1])) { $sub = null; $this->CreateSubHTML($sub); - $sub->writeHTML($res[1]); + $sub->writeHTML($res[1]); $w = $sub->maxX; $h = $sub->maxY; - unset($sub); + $this->DestroySubHTML($sub); } - if (($w==0 && $this->style->value['width']==0) || $this->style->value['position']=='absolute') - { + $w_reel = $w; + $h_reel = $h; + +// if (($w==0 && $this->style->value['width']==0) || ($w>$this->style->value['width']) || $this->style->value['position']=='absolute') $w+= $marge['l']+$marge['r']+0.001; - } - $h+= $marge['t']+$marge['b']+0.001; - $this->style->value['width'] = max($w, $this->style->value['width']); - $this->style->value['height'] = max($h, $this->style->value['height']); + $h+= $marge['t']+$marge['b']+0.001; + + if ($this->style->value['overflow']=='hidden') + { + $over_w = max($w, $this->style->value['width']); + $over_h = max($h, $this->style->value['height']); + $overflow = true; + $this->style->value['old_maxX'] = $this->maxX; + $this->style->value['old_maxY'] = $this->maxY; + $this->style->value['old_maxH'] = $this->maxH; + $this->style->value['old_overflow'] = $this->isInOverflow; + $this->isInOverflow = true; + } + else + { + $over_w = null; + $over_h = null; + $overflow = false; + $this->style->value['width'] = max($w, $this->style->value['width']); + $this->style->value['height'] = max($h, $this->style->value['height']); + } + + switch($this->style->value['rotate']) + { + case 90: + $tmp = $over_h; $over_h = $over_w; $over_w = $tmp; + $tmp = $h_reel; $h_reel = $w_reel; $w_reel = $tmp; + unset($tmp); + $w = $this->style->value['height']; + $h = $this->style->value['width']; + $t_x =-$h; + $t_y = 0; + break; + + case 180: + $w = $this->style->value['width']; + $h = $this->style->value['height']; + $t_x = -$w; + $t_y = -$h; + break; + + case 270: + $tmp = $over_h; $over_h = $over_w; $over_w = $tmp; + $tmp = $h_reel; $h_reel = $w_reel; $w_reel = $tmp; + unset($tmp); + $w = $this->style->value['height']; + $h = $this->style->value['width']; + $t_x = 0; + $t_y =-$w; + break; + + default: + $w = $this->style->value['width']; + $h = $this->style->value['height']; + $t_x = 0; + $t_y = 0; + break; + } + if (!$this->style->value['position']) { if ( - $this->style->value['width'] < ($this->pdf->w - $this->pdf->lMargin-$this->pdf->rMargin) && - $this->pdf->x + $this->style->value['width']>=($this->pdf->w - $this->pdf->rMargin) + $w < ($this->pdf->w - $this->pdf->lMargin-$this->pdf->rMargin) && + $this->pdf->x + $w>=($this->pdf->w - $this->pdf->rMargin) ) $this->o_BR(array()); - + if ( - $this->style->value['height'] < ($this->pdf->h - $this->pdf->tMargin-$this->pdf->bMargin) && - $this->pdf->y + $this->style->value['height']>=($this->pdf->h - $this->pdf->bMargin) + ($h < ($this->pdf->h - $this->pdf->tMargin-$this->pdf->bMargin)) && + ($this->pdf->y + $h>=($this->pdf->h - $this->pdf->bMargin)) && + !$this->isInOverflow ) $this->setNewPage(); - + // en cas d'alignement => correction - $w = $this->style->value['width']; $old = isset($this->style->table[count($this->style->table)-1]) ? $this->style->table[count($this->style->table)-1] : $this->style->value; $parent_w = $old['width'] ? $old['width'] : $this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin; - + if ($parent_w>$w) - { + { if ($align_object=='center') $this->pdf->x = $this->pdf->x + ($parent_w-$w)*0.5; else if ($align_object=='right') $this->pdf->x = $this->pdf->x + $parent_w-$w; } - + $this->style->setPosition($this->pdf->x, $this->pdf->y); } else { + // en cas d'alignement => correction + $old = isset($this->style->table[count($this->style->table)-1]) ? $this->style->table[count($this->style->table)-1] : $this->style->value; + $parent_w = $old['width'] ? $old['width'] : $this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin; + + if ($parent_w>$w) + { + if ($align_object=='center') $this->pdf->x = $this->pdf->x + ($parent_w-$w)*0.5; + else if ($align_object=='right') $this->pdf->x = $this->pdf->x + $parent_w-$w; + } + $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->saveMax(); $this->saveX = 0; $this->saveY = 0; $this->saveH = 0; + } + + if ($this->style->value['rotate']) + { + $this->pdf->startTransform(); + $this->pdf->setRotation($this->style->value['rotate']); + $this->pdf->setTranslate($t_x, $t_y); } - - // initialisation du style des bordures de la premiere partie de tableau + + // initialisation du style des bordures de la div $this->Rectangle( $this->style->value['x'], $this->style->value['y'], @@ -1352,81 +1604,123 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->value['background'] ); - + $marge = array(); $marge['l'] = $this->style->value['border']['l']['width'] + $this->style->value['padding']['l']+0.03; $marge['r'] = $this->style->value['border']['r']['width'] + $this->style->value['padding']['r']+0.03; $marge['t'] = $this->style->value['border']['t']['width'] + $this->style->value['padding']['t']+0.03; $marge['b'] = $this->style->value['border']['b']['width'] + $this->style->value['padding']['b']+0.03; - $this->style->value['width'] = $this->style->value['width']-$marge['l']-$marge['r']; - $this->style->value['height'] = $this->style->value['height']-$marge['r']-$marge['b']; - - // limitation des marges aux dimensions de la div - $mL = $this->style->value['x']+$marge['l']; - $mR = $this->pdf->w - $mL - $this->style->value['width']; - $this->saveMargin($mL, 0, $mR); - - // positionnement en fonction - $h_corr = $this->style->value['height']; - $h_reel = $h-$marge['b']-$marge['t']; - switch($this->style->value['vertical-align']) + $this->style->value['width'] -= $marge['l']+$marge['r']; + $this->style->value['height']-= $marge['t']+$marge['b']; + + // positionnement en fonction des alignements + $x_corr = 0; + $y_corr = 0; + if (!$this->sub_part && !$this->isSubPart) { - case 'bottom': - $y_corr = $h_corr-$h_reel; - break; - - case 'middle': - $y_corr = ($h_corr-$h_reel)*0.5; - break; - - case 'top': - default: - $y_corr = 0; - break; + switch($this->style->value['text-align']) + { + case 'right': $x_corr = ($this->style->value['width']-$w_reel); break; + case 'center': $x_corr = ($this->style->value['width']-$w_reel)*0.5; break; + } + if ($x_corr>0) $x_corr=0; + switch($this->style->value['vertical-align']) + { + case 'bottom': $y_corr = ($this->style->value['height']-$h_reel); break; + case 'middle': $y_corr = ($this->style->value['height']-$h_reel)*0.5; break; + } } + + if ($overflow) + { + $over_w-= $marge['l']+$marge['r']; + $over_h-= $marge['t']+$marge['b']; + $this->pdf->clippingPathOpen( + $this->style->value['x']+$marge['l'], + $this->style->value['y']+$marge['t'], + $this->style->value['width'], + $this->style->value['height'] + ); - $this->pdf->setX($this->style->value['x']+$marge['l']); - $this->pdf->setY($this->style->value['y']+$marge['t']+$y_corr); - + $this->style->value['x']+= $x_corr; + // limitation des marges aux dimensions du contenu + $mL = $this->style->value['x']+$marge['l']; + $mR = $this->pdf->w - $mL - $over_w; + } + else + { + // limitation des marges aux dimensions de la div + $mL = $this->style->value['x']+$marge['l']; + $mR = $this->pdf->w - $mL - $this->style->value['width']; + } + + $x = $this->style->value['x']+$marge['l']; + $y = $this->style->value['y']+$marge['t']+$y_corr; + $this->saveMargin($mL, 0, $mR); + $this->pdf->setXY($x, $y); + $this->setNewPositionForNewLine(); - + return true; } function o_BLOCKQUOTE($param) { return $this->o_DIV($param, 'blockquote'); } - + /** * balise : DIV * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_DIV($param) { if ($this->forOneLine) return false; + + if ($this->style->value['overflow']=='hidden') + { + $this->maxX = $this->style->value['old_maxX']; + $this->maxY = $this->style->value['old_maxY']; + $this->maxH = $this->style->value['old_maxH']; + $this->isInOverflow = $this->style->value['old_overflow']; + $this->pdf->clippingPathClose(); + } + + if ($this->style->value['rotate']) + $this->pdf->stopTransform(); + $marge = array(); $marge['l'] = $this->style->value['border']['l']['width'] + $this->style->value['padding']['l']+0.03; $marge['r'] = $this->style->value['border']['r']['width'] + $this->style->value['padding']['r']+0.03; $marge['t'] = $this->style->value['border']['t']['width'] + $this->style->value['padding']['t']+0.03; $marge['b'] = $this->style->value['border']['b']['width'] + $this->style->value['padding']['b']+0.03; - + $x = $this->style->value['x']; $y = $this->style->value['y']; - $w = $this->style->value['width']+$marge['l']+$marge['r']; - $h = $this->style->value['height']+$marge['t']+$marge['b']; + $w = $this->style->value['width']+$marge['l']+$marge['r']+$this->style->value['margin']['r']; + $h = $this->style->value['height']+$marge['t']+$marge['b']+$this->style->value['margin']['b']; + switch($this->style->value['rotate']) + { + case 90: + $t = $w; $w = $h; $h = $t; + break; + + case 270: + $t = $w; $w = $h; $h = $t; + break; + + default: + break; + } - // correction pour les margins - $w+= $this->style->value['margin']['r']; - $h+= $this->style->value['margin']['b']; if ($this->style->value['position']!='absolute') { // position - $this->pdf->x = $x+$w; + $this->pdf->x = $x+$w; $this->pdf->y = $y; - + // position MAX $this->maxX = max($this->maxX, $x+$w); $this->maxY = max($this->maxY, $y+$h); @@ -1435,55 +1729,55 @@ if (!defined('__CLASS_HTML2PDF__')) else { // position - $this->pdf->x = $this->style->value['xc']; + $this->pdf->x = $this->style->value['xc']; $this->pdf->y = $this->style->value['yc']; - + $this->loadMax(); } - + $block = ($this->style->value['display']!='inline' && $this->style->value['position']!='absolute'); - + $this->style->load(); $this->style->FontSet(); $this->loadMargin(); - + if ($block) $this->o_BR(array()); - + if ($this->DEBUG_actif) $this->DEBUG_add('DIV', false); + return true; } function c_BLOCKQUOTE($param) { return $this->c_DIV($param); } - + /** * balise : BARCODE * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_BARCODE($param) { - + $lst_barcode = array( 'EAN13' => '0.35mm', 'UPC_A' => '0.35mm', 'CODE39' => '1.00mm', ); if (isset($param['type'])) $param['type'] = strtoupper($param['type']); - + if (!isset($param['type']) || !isset($lst_barcode[$param['type']])) $param['type']=='CODE39'; if (!isset($param['value'])) $param['value'] = 0; if (!isset($param['bar_w'])) $param['bar_w'] = $lst_barcode[$param['type']]; if (!isset($param['bar_h'])) $param['bar_h'] = '10mm'; - + if (!isset($param['style']['color'])) $param['style']['color'] = '#000000'; $param['style']['background-color'] = $param['style']['color']; - + $this->style->save(); $this->style->analyse('barcode', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - - + $x = $this->pdf->getX(); $y = $this->pdf->getY(); $w = $this->style->ConvertToMM($param['bar_w']); @@ -1495,75 +1789,153 @@ if (!defined('__CLASS_HTML2PDF__')) $this->maxX = max($this->maxX, $x+$infos[0]); $this->maxY = max($this->maxY, $y+$infos[1]); $this->maxH = max($this->maxH, $infos[1]); - + $this->pdf->setX($x+$infos[0]); - + $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : BARCODE * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_BARCODE($param) { // completement inutile - + return true; } - + + + /** + * balise : QRCODE + * mode : OUVERTURE + * + * @param array paramètres de l'élément de parsing + * @return null + */ + function o_QRCODE($param) + { + if ($this->DEBUG_actif) $this->DEBUG_add('QRCODE', true); + if (!isset($param['value'])) $param['value'] = ''; + if (!isset($param['ec'])) $param['ec'] = 'H'; + if (!isset($param['size'])) $param['size'] = '0.6mm'; + if (!isset($param['style']['color'])) $param['style']['color'] = '#000000'; + if (!isset($param['style']['background-color'])) $param['style']['background-color'] = '#FFFFFF'; + + if ($param['value']==='') return true; + + $noborder = isset($param['noborder']); + + $this->style->save(); + $this->style->analyse('qrcode', $param); + $this->style->setPosition($this->pdf->x, $this->pdf->y); + $this->style->FontSet(); + + $x = $this->pdf->getX(); + $y = $this->pdf->getY(); + $s = $this->style->ConvertToMM($param['size']); + $ec = $param['ec']; if (!in_array($ec, array('L', 'M', 'Q', 'H'))) $ec = 'H'; + + $color = $this->style->value['color']; + if (count($color)==4) $color = array(0, 0, 0); + $color[0] = floor($color[0]*255.); + $color[1] = floor($color[1]*255.); + $color[2] = floor($color[2]*255.); + + $background = $this->style->value['background']['color']; + if (count($background)==4) $background = array(0, 0, 0); + $background[0] = floor($background[0]*255.); + $background[1] = floor($background[1]*255.); + $background[2] = floor($background[2]*255.); + + require_once(dirname(__FILE__).'/qrcode/qrcode.class.php'); + $qrcode = new QRcode($param['value'], $ec); + if ($noborder) $qrcode->disableBorder(); + if (!$this->sub_part && !$this->isSubPart) + $qrcode->displayFPDF($this->pdf, $x, $y, $s, $background, $color); + $size = $s*$qrcode->getQrSize(); + unset($qrcode); + + // position maximale globale + $this->maxX = max($this->maxX, $x+$size); + $this->maxY = max($this->maxY, $y+$size); + $this->maxH = max($this->maxH, $size); + + $this->pdf->setX($x+$size); + + $this->style->load(); + $this->style->FontSet(); + + return true; + } + /** + * balise : QRCODE + * mode : FERMETURE + * + * @param array paramètres de l'élément de parsing + * @return null + */ + function c_QRCODE($param) + { + if ($this->DEBUG_actif) $this->DEBUG_add('QRCODE', false); + // completement inutile + return true; + } + /** * balise : BOOKMARK * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_BOOKMARK($param) { $titre = isset($param['title']) ? trim($param['title']) : ''; $level = isset($param['level']) ? floor($param['level']) : 0; - + if ($level<0) $level = 0; if ($titre) $this->pdf->Bookmark($titre, $level, -1); - + return true; } - + /** * balise : BOOKMARK * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_BOOKMARK($param) { // completement inutile - + return true; } - + /** * balise : WRITE * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_WRITE($param) { $fill = ($this->style->value['background']['color']!==null && $this->style->value['background']['image']===null); - - // r�cup�ration du texte � �crire, et conversion + if (in_array($this->style->getParentBalise(), array('div', 'table', 'tr', 'td'))) $fill = false; + + // récupération du texte à écrire, et conversion $txt = $param['txt']; - $txt = str_replace('€', '�', $txt); + $txt = str_replace('€', '€', $txt); if ($this->isAfterFloat) { @@ -1571,39 +1943,49 @@ if (!defined('__CLASS_HTML2PDF__')) $this->isAfterFloat = false; } - $txt = html_entity_decode($txt, ENT_QUOTES, 'ISO-8859-15'); - - $txt = str_replace('[[page_cu]]', $this->pdf->PageNo(), $txt); + $txt = html_entity_decode($txt, ENT_QUOTES, $this->encoding); + $txt = str_replace('[[page_cu]]', $this->page, $txt); + + if ($this->style->value['text-transform']!='none') + { + if ($this->style->value['text-transform']=='capitalize') + $txt = ucwords($txt); + else if ($this->style->value['text-transform']=='uppercase') + $txt = strtoupper($txt); + else if ($this->style->value['text-transform']=='lowercase') + $txt = strtolower($txt); + } + // tailles du texte $h = 1.08*$this->style->value['font-size']; $dh = $h*$this->style->value['mini-decal']; - + $w = $this->pdf->GetStringWidth($txt); // identification de l'alignement - $align = 'L'; + $align = 'L'; if ($this->style->value['text-align']=='li_right') { - $w = $this->style->value['width']; + $w = $this->style->value['width']; $align = 'R'; } $curr_max = strlen($txt); // taille maxi du texte - $maxX = 0; // plus grande largeur du texte apres retour � la ligne + $maxX = 0; // plus grande largeur du texte apres retour à la ligne $x = $this->pdf->getX(); // position du texte $y = $this->pdf->getY(); $w = $this->pdf->GetStringWidth($txt); // largeur du texte list($left, $right) = $this->getMargins($y); // marges autorisees - $nb = 0; // nbr de lignes d�coup�es - - // tant que ca ne rentre pas sur la ligne et qu'on a du texte => on d�coupe + $nb = 0; // nbr de lignes découpées + + // tant que ca ne rentre pas sur la ligne et qu'on a du texte => on découpe while($x+$w>$right && $x<$right && strlen($txt)) { // liste des mots $lst = explode(' ', $txt); - - // trouver une phrase qui rentre dans la largeur, en ajoutant les mots 1 � 1 + + // trouver une phrase qui rentre dans la largeur, en ajoutant les mots 1 à 1 $i=0; $old = ''; $str = $lst[0]; @@ -1616,15 +1998,15 @@ if (!defined('__CLASS_HTML2PDF__')) $str.= ' '.$lst[$i]; } $str = $old; - + // si rien de rentre, et que le premier mot ne rentre de toute facon pas dans une ligne, on le force... if ($i==0 && (($left+$this->pdf->GetStringWidth($lst[0]))>=$right)) { $str = $lst[0]; unset($lst[0]); } - - // r�cup�ration des mots restant, et calcul de la largeur + + // récupération des mots restant, et calcul de la largeur $txt = implode(' ', $lst); $w = $this->pdf->GetStringWidth($str); @@ -1633,8 +2015,8 @@ if (!defined('__CLASS_HTML2PDF__')) if ($right - $left<$wc) $wc = $right - $left; if (strlen($str)) $this->pdf->Cell($wc, $h+$dh, $str, 0, 0, $align, $fill, $this->inLink); $this->maxH = max($this->maxH, $this->style->getLineHeight()); - - // d�termination de la largeur max + + // détermination de la largeur max $maxX = max($maxX, $this->pdf->getX()); // nouvelle position et nouvelle largeur pour la boucle @@ -1642,7 +2024,7 @@ if (!defined('__CLASS_HTML2PDF__')) $y = $this->pdf->getY(); $x = $this->pdf->getX(); - // si il reste du text � afficher + // si il reste du text à afficher if (strlen($txt)) { if ($this->forOneLine) @@ -1650,48 +2032,51 @@ if (!defined('__CLASS_HTML2PDF__')) $this->maxX = max($this->maxX, $maxX); return false; } - - // retour � la ligne + + // retour à la ligne $this->o_BR(array('style' => ''), $curr_max - strlen($txt)); $y = $this->pdf->getY(); $x = $this->pdf->getX(); - - // si la prochaine ligne ne rentre pas dans la page => nouvelle page - if ($y + $h>$this->pdf->h - $this->pdf->bMargin) $this->setNewPage('', null, $curr_max - strlen($txt)); - - // ligne supl�mentaire. au bout de 1000 : trop long => erreur + + // si la prochaine ligne ne rentre pas dans la page => nouvelle page + if ($y + $h>$this->pdf->h - $this->pdf->bMargin) + if (!$this->isInOverflow) + $this->setNewPage(null, '', null, $curr_max - strlen($txt)); + + + // ligne suplémentaire. au bout de 1000 : trop long => erreur $nb++; - if ($nb>1000) @HTML2PDF::makeError(2, __FILE__, __LINE__, array($txt, $right-$left, $this->pdf->GetStringWidth($txt))); + if ($nb>1000) @HTML2PDF::makeError(2, __FILE__, __LINE__, array($txt, $right-$left, $this->pdf->GetStringWidth($txt))); list($left, $right) = $this->getMargins($y); // marges autorisees } } - // si il reste du text apres d�coupe, c'est qu'il rentre direct => on l'affiche + // si il reste du text apres découpe, c'est qu'il rentre direct => on l'affiche if (strlen($txt)) { $this->pdf->Cell(($align=='L' ? $w : $this->style->value['width']), $h+$dh, $txt, 0, 0, $align, $fill, $this->inLink); $this->maxH = max($this->maxH, $this->style->getLineHeight()); } - - // d�termination des positions MAX + + // détermination des positions MAX $maxX = max($maxX, $this->pdf->getX()); $maxY = $this->pdf->getY()+$h; // position maximale globale $this->maxX = max($this->maxX, $maxX); $this->maxY = max($this->maxY, $maxY); - + return true; } /** * tracer une image - * + * * @param string nom du fichier source * @return null - */ + */ function Image($src, $sub_li=false) { // est-ce que c'est une image ? @@ -1699,15 +2084,20 @@ if (!defined('__CLASS_HTML2PDF__')) if (count($infos)<2) { - @HTML2PDF::makeError(6, __FILE__, __LINE__, $src); - return false; + if ($this->testIsImage) + { + @HTML2PDF::makeError(6, __FILE__, __LINE__, $src); + return false; + } + $src = null; + $infos = array(16, 16); } - - // r�cup�ration des dimensions dans l'unit� du PDF + + // récupération des dimensions dans l'unité du PDF $wi = $infos[0]/$this->pdf->k; $hi = $infos[1]/$this->pdf->k; - - // d�termination des dimensions d'affichage en fonction du style + + // détermination des dimensions d'affichage en fonction du style if ($this->style->value['width'] && $this->style->value['height']) { $w = $this->style->value['width']; @@ -1717,7 +2107,7 @@ if (!defined('__CLASS_HTML2PDF__')) { $w = $this->style->value['width']; $h = $hi*$w/$wi; - + } else if ($this->style->value['height']) { @@ -1727,9 +2117,9 @@ if (!defined('__CLASS_HTML2PDF__')) else { $w = 72./96.*$wi; - $h = 72./96.*$hi; + $h = 72./96.*$hi; } - + // detection du float $float = $this->style->getFloat(); if ($float && $this->maxH) $this->o_BR(array()); @@ -1737,9 +2127,9 @@ if (!defined('__CLASS_HTML2PDF__')) // position d'affichage $x = $this->pdf->getX(); $y = $this->pdf->getY(); - - // si l'image ne rentre pas dans la ligne => nouvelle ligne - if (!$float && ($x + $w>$this->pdf->w - $this->pdf->rMargin)) + + // si l'image ne rentre pas dans la ligne => nouvelle ligne + if (!$float && ($x + $w>$this->pdf->w - $this->pdf->rMargin) && $this->maxH) { $hnl = $this->style->getLineHeight(); $hnl = max($this->maxH, $hnl); @@ -1747,9 +2137,12 @@ if (!defined('__CLASS_HTML2PDF__')) $x = $this->pdf->getX(); $y = $this->pdf->getY(); } - - // si l'image ne rentre pas dans la page => nouvelle page - if ($y + $h>$this->pdf->h - $this->pdf->bMargin) + + // si l'image ne rentre pas dans la page => nouvelle page + if ( + ($y + $h>$this->pdf->h - $this->pdf->bMargin) && + !$this->isInOverflow + ) { $this->setNewPage(); $x = $this->pdf->getX(); @@ -1765,7 +2158,7 @@ if (!defined('__CLASS_HTML2PDF__')) $yc = $y-$this->style->value['margin']['t']; - // d�termination de la position r�elle d'affichage en fonction du text-align du parent + // détermination de la position réelle d'affichage en fonction du text-align du parent $old = isset($this->style->table[count($this->style->table)-1]) ? $this->style->table[count($this->style->table)-1] : $this->style->value; if ( $old['width']) @@ -1778,7 +2171,7 @@ if (!defined('__CLASS_HTML2PDF__')) $parent_w = $this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin; $parent_x = $this->pdf->lMargin; } - + if ($float) { list($lx, $rx) = $this->getMargins($yc); @@ -1790,9 +2183,17 @@ if (!defined('__CLASS_HTML2PDF__')) { if ($float=='right' || $this->style->value['text-align']=='li_right') $x = $parent_x + $parent_w - $w-$this->style->value['margin']['r']-$this->style->value['margin']['l']; } - - // affichage de l'image, et positionnement � la suite - if (!$this->sub_part && !$this->isSubPart) $this->pdf->Image($src, $x, $y, $w, $h, '', $this->inLink); + + // affichage de l'image, et positionnement à la suite + if (!$this->sub_part && !$this->isSubPart) + { + if ($src) $this->pdf->Image($src, $x, $y, $w, $h, '', $this->inLink); + else + { + $this->pdf->setMyFillColor(array(0.94, 0.86, 0.86)); + $this->pdf->Rect($x, $y, $w, $h, 'F'); + } + } $x-= $this->style->value['margin']['l']; $y-= $this->style->value['margin']['t']; @@ -1808,7 +2209,7 @@ if (!defined('__CLASS_HTML2PDF__')) list($lx, $rx) = $this->getMargins($yc); $this->pdf->x = $lx; - $this->pdf->y = $yc; + $this->pdf->y = $yc; } else if ($float=='right') { @@ -1823,76 +2224,76 @@ if (!defined('__CLASS_HTML2PDF__')) } else { - $this->pdf->SetX($x+$w); + $this->pdf->setX($x+$w); $this->maxX = max($this->maxX, $x+$w); $this->maxY = max($this->maxY, $y+$h); $this->maxH = max($this->maxH, $h); } } - + /** * Tracer un rectanble - * + * * @param float position X * @param float position Y * @param float Largeur * @param float Hauteur - * @param array Tableau de style de d�finition des borders - * @param float padding - marge int�rieur au rectangle => non utile mais on le passe en param�tre + * @param array Tableau de style de définition des borders + * @param float padding - marge intérieur au rectangle => non utile mais on le passe en paramètre * @param float margin - marge exterieur au rectangle - * @param array Tableau de style de d�finition du background + * @param array Tableau de style de définition du background * @return null - */ + */ function Rectangle($x, $y, $w, $h, $border, $padding, $margin, $background) { if ($this->sub_part || $this->isSubPart) return false; if ($h===null) return false; - + $x+= $margin; $y+= $margin; $w-= $margin*2; $h-= $margin*2; - - // r�cup�ration des radius + + // récupération des radius $radius_h = $border['radius'][0]; $radius_v = $border['radius'][1]; - + // verification des coins en radius $coin_TL = ($radius_h && $radius_v && $radius_v>$border['t']['width'] && $radius_h>$border['l']['width']) ? array($radius_h, $radius_v) : null; $coin_TR = ($radius_h && $radius_v && $radius_v>$border['t']['width'] && $radius_h>$border['r']['width']) ? array($radius_h, $radius_v) : null; $coin_BL = ($radius_h && $radius_v && $radius_v>$border['b']['width'] && $radius_h>$border['l']['width']) ? array($radius_h, $radius_v) : null; $coin_BR = ($radius_h && $radius_v && $radius_v>$border['b']['width'] && $radius_h>$border['r']['width']) ? array($radius_h, $radius_v) : null; - + // traitement de la couleur de fond $STYLE = ''; if ($background['color']) { - $this->pdf->SetFillColor($background['color'][0], $background['color'][1], $background['color'][2]); - $STYLE.= 'F'; + $this->pdf->setMyFillColor($background['color']); + $STYLE.= 'F'; } - + if ($STYLE) { - $this->pdf->clippingPathOpen($x, $y, $w, $h, $coin_TL,$coin_TR, $coin_BL, $coin_BR); + $this->pdf->clippingPathOpen($x, $y, $w, $h, $coin_TL,$coin_TR, $coin_BL, $coin_BR); $this->pdf->Rect($x, $y, $w, $h, $STYLE); - $this->pdf->clippingPathClose(); + $this->pdf->clippingPathClose(); } - + // traitement de l'image de fond if ($background['image']) { $i_name = $background['image']; $i_position = $background['position']!==null ? $background['position'] : array(0, 0); $i_repeat = $background['repeat']!==null ? $background['repeat'] : array(true, true); - + // taile du fond (il faut retirer les borders $b_x = $x; $b_y = $y; $b_w = $w; $b_h = $h; - + if ($border['b']['width']) { $b_h-= $border['b']['width']; } if ($border['l']['width']) { $b_w-= $border['l']['width']; $b_x+= $border['l']['width']; } if ($border['t']['width']) { $b_h-= $border['t']['width']; $b_y+= $border['t']['width']; } @@ -1900,77 +2301,82 @@ if (!defined('__CLASS_HTML2PDF__')) // est-ce que c'est une image ? $i_infos=@GetImageSize($i_name); - + if (count($i_infos)<2) { - @HTML2PDF::makeError(6, __FILE__, __LINE__, $i_name); - return false; - } - - // r�cup�ration des dimensions dans l'unit� du PDF - $i_width = 72./96.*$i_infos[0]/$this->pdf->k; - $i_height = 72./96.*$i_infos[1]/$this->pdf->k; - - if ($i_repeat[0]) $i_position[0] = $b_x; - else if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[0], $match)) $i_position[0] = $b_x + $match[1]*($b_w-$i_width)/100; - else $i_position[0] = $b_x+$i_position[0]; - - if ($i_repeat[1]) $i_position[1] = $b_y; - else if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[1], $match)) $i_position[1] = $b_y + $match[1]*($b_h-$i_height)/100; - else $i_position[1] = $b_y+$i_position[1]; - - $i_x_min = $b_x; - $i_x_max = $b_x+$b_w; - $i_y_min = $b_y; - $i_y_max = $b_y+$b_h; - - if (!$i_repeat[0] && !$i_repeat[1]) - { - $i_x_min = $i_position[0]; $i_x_max = $i_position[0]+$i_width; - $i_y_min = $i_position[1]; $i_y_max = $i_position[1]+$i_height; - } - else if ($i_repeat[0] && !$i_repeat[1]) - { - $i_y_min = $i_position[1]; $i_y_max = $i_position[1]+$i_height; - } - elseif (!$i_repeat[0] && $i_repeat[1]) - { - $i_x_min = $i_position[0]; $i_x_max = $i_position[0]+$i_width; + if ($this->testIsImage) + { + @HTML2PDF::makeError(6, __FILE__, __LINE__, $i_name); + return false; + } } - - if (is_array($coin_TL)) { $coin_TL[0]-= $border['l']['width']; $coin_TL[1]-= $border['t']['width']; } - if (is_array($coin_TR)) { $coin_TR[0]-= $border['r']['width']; $coin_TR[1]-= $border['t']['width']; } - if (is_array($coin_BL)) { $coin_BL[0]-= $border['l']['width']; $coin_BL[1]-= $border['b']['width']; } - if (is_array($coin_BR)) { $coin_BR[0]-= $border['r']['width']; $coin_BR[1]-= $border['b']['width']; } - - $this->pdf->clippingPathOpen($b_x, $b_y, $b_w, $b_h, $coin_TL, $coin_TR, $coin_BL, $coin_BR); - for ($i_y=$i_y_min; $i_y<$i_y_max; $i_y+=$i_height) + else { - for ($i_x=$i_x_min; $i_x<$i_x_max; $i_x+=$i_width) + // récupération des dimensions dans l'unité du PDF + $i_width = 72./96.*$i_infos[0]/$this->pdf->k; + $i_height = 72./96.*$i_infos[1]/$this->pdf->k; + + if ($i_repeat[0]) $i_position[0] = $b_x; + else if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[0], $match)) $i_position[0] = $b_x + $match[1]*($b_w-$i_width)/100; + else $i_position[0] = $b_x+$i_position[0]; + + if ($i_repeat[1]) $i_position[1] = $b_y; + else if(preg_match('/^([-]?[0-9\.]+)%/isU', $i_position[1], $match)) $i_position[1] = $b_y + $match[1]*($b_h-$i_height)/100; + else $i_position[1] = $b_y+$i_position[1]; + + $i_x_min = $b_x; + $i_x_max = $b_x+$b_w; + $i_y_min = $b_y; + $i_y_max = $b_y+$b_h; + + if (!$i_repeat[0] && !$i_repeat[1]) { - $c_x = null; - $c_y = null; - $c_w = $i_width; - $c_h = $i_height; - if ($i_y_max-$i_y<$i_height) - { - $c_x = $i_x; - $c_y = $i_y; - $c_h = $i_y_max-$i_y; - } - if ($i_x_max-$i_x<$i_width) + $i_x_min = $i_position[0]; $i_x_max = $i_position[0]+$i_width; + $i_y_min = $i_position[1]; $i_y_max = $i_position[1]+$i_height; + } + else if ($i_repeat[0] && !$i_repeat[1]) + { + $i_y_min = $i_position[1]; $i_y_max = $i_position[1]+$i_height; + } + elseif (!$i_repeat[0] && $i_repeat[1]) + { + $i_x_min = $i_position[0]; $i_x_max = $i_position[0]+$i_width; + } + + if (is_array($coin_TL)) { $coin_TL[0]-= $border['l']['width']; $coin_TL[1]-= $border['t']['width']; } + if (is_array($coin_TR)) { $coin_TR[0]-= $border['r']['width']; $coin_TR[1]-= $border['t']['width']; } + if (is_array($coin_BL)) { $coin_BL[0]-= $border['l']['width']; $coin_BL[1]-= $border['b']['width']; } + if (is_array($coin_BR)) { $coin_BR[0]-= $border['r']['width']; $coin_BR[1]-= $border['b']['width']; } + + $this->pdf->clippingPathOpen($b_x, $b_y, $b_w, $b_h, $coin_TL, $coin_TR, $coin_BL, $coin_BR); + for ($i_y=$i_y_min; $i_y<$i_y_max; $i_y+=$i_height) + { + for ($i_x=$i_x_min; $i_x<$i_x_max; $i_x+=$i_width) { - $c_x = $i_x; - $c_y = $i_y; - $c_w = $i_x_max-$i_x; + $c_x = null; + $c_y = null; + $c_w = $i_width; + $c_h = $i_height; + if ($i_y_max-$i_y<$i_height) + { + $c_x = $i_x; + $c_y = $i_y; + $c_h = $i_y_max-$i_y; + } + if ($i_x_max-$i_x<$i_width) + { + $c_x = $i_x; + $c_y = $i_y; + $c_w = $i_x_max-$i_x; + } + + $this->pdf->Image($i_name, $i_x, $i_y, $i_width, $i_height, '', ''); } - - $this->pdf->Image($i_name, $i_x, $i_y, $i_width, $i_height, '', ''); } + $this->pdf->clippingPathClose(); } - $this->pdf->clippingPathClose(); } - + $x-= 0.01; $y-= 0.01; $w+= 0.02; @@ -1979,7 +2385,7 @@ if (!defined('__CLASS_HTML2PDF__')) if ($border['l']['width']) $border['l']['width']+= 0.02; if ($border['t']['width']) $border['t']['width']+= 0.02; if ($border['r']['width']) $border['r']['width']+= 0.02; - + if ($border['b']['width'] && $border['b']['color'][0]!==null) { $pt = array(); @@ -1989,8 +2395,8 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[] = $x; $pt[] = $y+$h; $pt[] = $x+$border['l']['width']; $pt[] = $y+$h-$border['b']['width']; $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$h-$border['b']['width']; - - $bord = 3; + + $bord = 3; if (is_array($coin_BL)) { $bord-=2; @@ -2012,7 +2418,7 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[2] -= $radius_h-$border['r']['width']; $pt[10]-= $radius_h-$border['r']['width']; unset($pt[0]);unset($pt[1]); - + } $pt = array_values($pt); @@ -2029,7 +2435,7 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[] = $x+$border['l']['width']; $pt[] = $y+$border['t']['width']; $pt[] = $x+$border['l']['width']; $pt[] = $y+$h-$border['b']['width']; - $bord = 3; + $bord = 3; if (is_array($coin_BL)) { $courbe = array(); @@ -2039,10 +2445,10 @@ if (!defined('__CLASS_HTML2PDF__')) $courbe[] = $x+$border['l']['width']; $courbe[] = $y+$h-$radius_v; $courbe[] = $x+$radius_h; $courbe[] = $y+$h-$radius_v; $this->Courbe($courbe, $border['l']['color']); - + $bord-=1; $pt[3] -= $radius_v-$border['b']['width']; - $pt[11]-= $radius_v-$border['b']['width']; + $pt[11]-= $radius_v-$border['b']['width']; unset($pt[0]);unset($pt[1]); } if (is_array($coin_TL)) @@ -2052,11 +2458,11 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[9] += $radius_v-$border['t']['width']; unset($pt[6]);unset($pt[7]); } - + $pt = array_values($pt); $this->Line($pt, $border['l']['color'], $border['l']['type'], $border['l']['width'], $bord); } - + if ($border['t']['width'] && $border['t']['color'][0]!==null) { $pt = array(); @@ -2067,7 +2473,7 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$border['t']['width']; $pt[] = $x+$border['l']['width']; $pt[] = $y+$border['t']['width']; - $bord = 3; + $bord = 3; if (is_array($coin_TL)) { $courbe = array(); @@ -2090,7 +2496,7 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[8] -= $radius_h-$border['r']['width']; unset($pt[6]);unset($pt[7]); } - + $pt = array_values($pt); $this->Line($pt, $border['t']['color'], $border['t']['type'], $border['t']['width'], $bord); } @@ -2104,8 +2510,8 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[] = $x+$w; $pt[] = $y+$h; $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$h-$border['b']['width']; $pt[] = $x+$w-$border['r']['width']; $pt[] = $y+$border['t']['width']; - - $bord = 3; + + $bord = 3; if (is_array($coin_TR)) { $courbe = array(); @@ -2128,40 +2534,43 @@ if (!defined('__CLASS_HTML2PDF__')) $pt[9] -= $radius_v-$border['b']['width']; unset($pt[6]);unset($pt[7]); } - + $pt = array_values($pt); $this->Line($pt, $border['r']['color'], $border['r']['type'], $border['r']['width'], $bord); } - if ($background) $this->pdf->SetFillColor($background['color'][0], $background['color'][1], $background['color'][2]); + if ($background['color']) + { + $this->pdf->setMyFillColor($background['color']); + } } - + function Courbe($pt, $color) { - $this->pdf->SetFillColor($color[0], $color[1], $color[2]); - + $this->pdf->setMyFillColor($color); + $this->pdf->drawCourbe($pt[0], $pt[1], $pt[2], $pt[3], $pt[4], $pt[5], $pt[6], $pt[7], $pt[8], $pt[9]); } - + /** - * Tracer une ligne epaisse d�fini par ses points avec des extreminites en biseau - * + * Tracer une ligne epaisse défini par ses points avec des extreminites en biseau + * * @param array liste des points definissant le tour de la ligne * @param float couleur RVB * @param string type de ligne * @param float largeur de la ligne * @return null - */ + */ function Line($pt, $color, $type, $width, $bord=3) { - $this->pdf->SetFillColor($color[0], $color[1], $color[2]); + $this->pdf->setMyFillColor($color); if ($type=='dashed' || $type=='dotted') { if ($bord==1) { $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; $this->pdf->Polygon($tmp, 'F'); - + $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; $pt = $tmp; } @@ -2169,22 +2578,22 @@ if (!defined('__CLASS_HTML2PDF__')) { $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $this->pdf->Polygon($tmp, 'F'); - + $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; - $pt = $tmp; + $pt = $tmp; } else if ($bord==3) { $tmp = array(); $tmp[]=$pt[0]; $tmp[]=$pt[1]; $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[10]; $tmp[]=$pt[11]; $this->pdf->Polygon($tmp, 'F'); - + $tmp = array(); $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[6]; $tmp[]=$pt[7]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; $this->pdf->Polygon($tmp, 'F'); - + $tmp = array(); $tmp[]=$pt[2]; $tmp[]=$pt[3]; $tmp[]=$pt[4]; $tmp[]=$pt[5]; $tmp[]=$pt[8]; $tmp[]=$pt[9]; $tmp[]=$pt[10]; $tmp[]=$pt[11]; $pt = $tmp; } - + if ($pt[2]==$pt[0]) { $l = abs(($pt[3]-$pt[1])*0.5); @@ -2197,7 +2606,7 @@ if (!defined('__CLASS_HTML2PDF__')) { $l = abs(($pt[2]-$pt[0])*0.5); $px = $width; - $py = 0; + $py = 0; $x1 = ($pt[2]+$pt[0])*0.5; $y1 = $pt[1]; $x2 = ($pt[6]+$pt[4])*0.5; $y2 = $pt[7]; } @@ -2207,7 +2616,7 @@ if (!defined('__CLASS_HTML2PDF__')) $py = $py*3.; } $mode = ($l/($px+$py)<.5); - + for($i=0; $l-($px+$py)*($i-0.5)>0; $i++) { if (($i%2)==$mode) @@ -2217,67 +2626,69 @@ if (!defined('__CLASS_HTML2PDF__')) $ly1 = $py*($j); if ($ly1<-$l) $ly1 =-$l; $lx2 = $px*($j+1); if ($lx2>$l) $lx2 = $l; $ly2 = $py*($j+1); if ($ly2>$l) $ly2 = $l; - + $tmp = array(); - $tmp[] = $x1+$lx1; $tmp[] = $y1+$ly1; - $tmp[] = $x1+$lx2; $tmp[] = $y1+$ly2; - $tmp[] = $x2+$lx2; $tmp[] = $y2+$ly2; + $tmp[] = $x1+$lx1; $tmp[] = $y1+$ly1; + $tmp[] = $x1+$lx2; $tmp[] = $y1+$ly2; + $tmp[] = $x2+$lx2; $tmp[] = $y2+$ly2; $tmp[] = $x2+$lx1; $tmp[] = $y2+$ly1; - $this->pdf->Polygon($tmp, 'F'); + $this->pdf->Polygon($tmp, 'F'); if ($j>0) { $tmp = array(); - $tmp[] = $x1-$lx1; $tmp[] = $y1-$ly1; - $tmp[] = $x1-$lx2; $tmp[] = $y1-$ly2; - $tmp[] = $x2-$lx2; $tmp[] = $y2-$ly2; + $tmp[] = $x1-$lx1; $tmp[] = $y1-$ly1; + $tmp[] = $x1-$lx2; $tmp[] = $y1-$ly2; + $tmp[] = $x2-$lx2; $tmp[] = $y2-$ly2; $tmp[] = $x2-$lx1; $tmp[] = $y2-$ly1; - $this->pdf->Polygon($tmp, 'F'); + $this->pdf->Polygon($tmp, 'F'); } } - } + } } else if ($type=='solid') { $this->pdf->Polygon($pt, 'F'); } } - + /** * balise : BR * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte + * + * @param array paramètres de l'élément de parsing + * @param integer position reelle courante si saut de ligne pendant l'ecriture d'un texte * @return null - */ + */ function o_BR($param, $curr = null) { if ($this->forOneLine) return false; - + $h = $this->style->getLineHeight(); $h = max($this->maxH, $h); $y = $this->pdf->getY(); - // si la ligne est vide, la position maximale n'a pas �t� mise � jour => on la met � jour + // si la ligne est vide, la position maximale n'a pas été mise à jour => on la met à jour if ($this->maxH==0) $this->maxY = max($this->maxY, $y+$h); - + // si le saut de ligne rentre => on le prend en compte, sinon nouvelle page - if ($y+$h<$this->pdf->h - $this->pdf->bMargin) $this->setNewLine($h, $curr); - else $this->setNewPage('', null, $curr); - + if (($y+$h<$this->pdf->h - $this->pdf->bMargin) || $this->isInOverflow) + $this->setNewLine($h, $curr); + else + $this->setNewPage(null, '', null, $curr); + $this->maxH = 0; - + return true; } - + /** * balise : HR * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_HR($param) { if ($this->forOneLine) return false; @@ -2285,20 +2696,20 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->value['text-align'] = 'left'; if ($this->maxH) $this->o_BR($param); - + $f_size = $this->style->value['font-size']; $this->style->value['font-size']=$f_size*0.5; $this->o_BR($param); $this->style->value['font-size']=0; - + $param['style']['width'] = '100%'; - + $this->style->save(); $this->style->value['height']=$this->style->ConvertToMM('1mm'); $this->style->analyse('hr', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $h = $this->style->value['height']; if ($h) $h-= $this->style->value['border']['t']['width']+$this->style->value['border']['b']['width']; if ($h<=0) $h = $this->style->value['border']['t']['width']+$this->style->value['border']['b']['width']; @@ -2308,7 +2719,7 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->load(); $this->style->FontSet(); - + $this->o_BR($param); $this->style->value['font-size']=$f_size*0.5; $this->o_BR($param); @@ -2316,17 +2727,17 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->value['text-align'] = $old_align; $this->setNewPositionForNewLine(); - + return true; } /** * balise : B * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_B($param, $other = 'b') { $this->style->save(); @@ -2334,34 +2745,34 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } function o_STRONG($param) { return $this->o_B($param, 'strong'); } - + /** * balise : B * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_B($param) { $this->style->load(); $this->style->FontSet(); - + return true; } function c_STRONG($param) { return $this->c_B($param); } - + /** * balise : I * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_I($param, $other = 'i') { $this->style->save(); @@ -2369,9 +2780,9 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; - } + } function o_ADDRESS($param) { return $this->o_I($param, 'address'); } function o_CITE($param) { return $this->o_I($param, 'cite'); } function o_EM($param) { return $this->o_I($param, 'em'); } @@ -2380,17 +2791,17 @@ if (!defined('__CLASS_HTML2PDF__')) /** * balise : I * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_I($param) { $this->style->load(); $this->style->FontSet(); - + return true; - } + } function c_ADDRESS($param) { return $this->c_I($param); } function c_CITE($param) { return $this->c_I($param); } function c_EM($param) { return $this->c_I($param); } @@ -2399,409 +2810,220 @@ if (!defined('__CLASS_HTML2PDF__')) /** * balise : S * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ - function o_S($param) + */ + function o_S($param, $other = 's') { $this->style->save(); $this->style->value['font-linethrough'] = true; - $this->style->analyse('s', $param); + $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; - } - + } + function o_DEL($param) { return $this->o_S($param, 'del'); } + /** * balise : S * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_S($param) { $this->style->load(); $this->style->FontSet(); - + return true; } - + function c_DEL($param) { return $this->c_S($param); } + /** * balise : U * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ - function o_U($param) + */ + function o_U($param, $other='u') { $this->style->save(); $this->style->value['font-underline'] = true; - $this->style->analyse('u', $param); + $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; - } - + } + function o_INS($param) { return $this->o_U($param, 'ins'); } + /** * balise : U * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_U($param) { $this->style->load(); $this->style->FontSet(); - + return true; } - + function c_INS($param) { return $this->c_U($param); } + /** * balise : A * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_A($param) { $this->inLink = str_replace('&', '&', isset($param['href']) ? $param['href'] : ''); - + if (isset($param['name'])) { $nom = $param['name']; if (!isset($this->lstAncre[$nom])) $this->lstAncre[$nom] = array($this->pdf->AddLink(), false); - + if (!$this->lstAncre[$nom][1]) { $this->lstAncre[$nom][1] = true; $this->pdf->SetLink($this->lstAncre[$nom][0], -1, -1); } } - + if (preg_match('/^#([^#]+)$/isU', $this->inLink, $match)) { $nom = $match[1]; if (!isset($this->lstAncre[$nom])) $this->lstAncre[$nom] = array($this->pdf->AddLink(), false); - + $this->inLink = $this->lstAncre[$nom][0]; } - + $this->style->save(); $this->style->value['font-underline'] = true; - $this->style->value['color'] = array(20, 20, 250); + $this->style->value['color'] = array(0.08, 0.08, 0.98); $this->style->analyse('a', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - - return true; + + return true; } /** * balise : A * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_A($param) { $this->inLink = ''; $this->style->load(); - $this->style->FontSet(); - + $this->style->FontSet(); + return true; } /** * balise : H1 * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ - function o_H1($param) + */ + function o_H1($param, $other = 'h1') { if ($this->forOneLine) return false; - - $this->o_BR(array()); + + if ($this->maxH) $this->o_BR(array()); $this->style->save(); $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('28px'); - $this->style->analyse('h1', $param); + + $size = array('h1' => '28px', 'h2' => '24px', 'h3' => '20px', 'h4' => '16px', 'h5' => '12px', 'h6' => '9px'); + $this->style->value['margin']['l'] = 0; + $this->style->value['margin']['r'] = 0; + $this->style->value['margin']['t'] = $this->style->ConvertToMM('16px'); + $this->style->value['margin']['b'] = $this->style->ConvertToMM('16px'); + $this->style->value['font-size'] = $this->style->ConvertToMM($size[$other]); + + $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); $this->setNewPositionForNewLine(); - + return true; } - + function o_H2($param) { return $this->o_H1($param, 'h2'); } + function o_H3($param) { return $this->o_H1($param, 'h3'); } + function o_H4($param) { return $this->o_H1($param, 'h4'); } + function o_H5($param) { return $this->o_H1($param, 'h5'); } + function o_H6($param) { return $this->o_H1($param, 'h6'); } + + /** * balise : H1 * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_H1($param) { if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->load(); - $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - - /** - * balise : H2 - * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function o_H2($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->save(); - $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('24px'); - $this->style->analyse('h2', $param); - $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - $this->setNewPositionForNewLine(); - - return true; - } - - /** - * balise : H2 - * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function c_H2($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->load(); - $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - - /** - * balise : H3 - * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function o_H3($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->save(); - $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('20px'); - $this->style->analyse('h3', $param); - $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - $this->setNewPositionForNewLine(); - - return true; - } - - /** - * balise : H3 - * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function c_H3($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->load(); - $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - - /** - * balise : H4 - * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function o_H4($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->save(); - $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('16px'); - $this->style->analyse('h4', $param); - $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - $this->setNewPositionForNewLine(); - - return true; - } - - /** - * balise : H4 - * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function c_H4($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->load(); - $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - - /** - * balise : H5 - * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function o_H5($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->save(); - $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('12px'); - $this->style->analyse('h5', $param); - $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - $this->setNewPositionForNewLine(); - - return true; - } - - /** - * balise : H5 - * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function c_H5($param) - { - if ($this->forOneLine) return false; - + $this->maxH+= $this->style->value['margin']['b']; $this->o_BR(array()); $this->style->load(); $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - - /** - * balise : H6 - * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function o_H6($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->save(); - $this->style->value['font-bold'] = true; - $this->style->value['font-size'] = $this->style->ConvertToMM('9px'); - $this->style->analyse('h6', $param); - $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - $this->setNewPositionForNewLine(); - + return true; } - - /** - * balise : H6 - * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing - * @return null - */ - function c_H6($param) - { - if ($this->forOneLine) return false; - - $this->o_BR(array()); - $this->style->load(); - $this->style->FontSet(); - $this->o_BR(array()); - - return true; - } - + function c_H2($param) { return $this->c_H1($param); } + function c_H3($param) { return $this->c_H1($param); } + function c_H4($param) { return $this->c_H1($param); } + function c_H5($param) { return $this->c_H1($param); } + function c_H6($param) { return $this->c_H1($param); } + /** * balise : SPAN * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_SPAN($param, $other = 'span') { $this->style->save(); $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); - $this->style->FontSet(); - + $this->style->FontSet(); + return true; - } + } function o_FONT($param) { return $this->o_SPAN($param, 'font'); } /** * balise : SPAN * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_SPAN($param) { $this->style->restorePosition($this->pdf->x, $this->pdf->y); $this->style->load(); $this->style->FontSet(); - + return true; } function c_FONT($param) { return $this->c_SPAN($param); } @@ -2810,10 +3032,10 @@ if (!defined('__CLASS_HTML2PDF__')) /** * balise : P * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_P($param) { if ($this->forOneLine) return false; @@ -2823,24 +3045,24 @@ if (!defined('__CLASS_HTML2PDF__')) if ($this->maxH) $this->o_BR(array()); $this->o_BR(array()); } - + $this->style->save(); $this->style->analyse('p', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + if ($this->style->value['text-indent']>0) $this->pdf->x+= $this->style->value['text-indent']; - + return true; } - + /** * balise : P * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_P($param) { if ($this->forOneLine) return false; @@ -2849,21 +3071,21 @@ if (!defined('__CLASS_HTML2PDF__')) $this->o_BR(array()); $this->style->load(); $this->style->FontSet(); - + return true; } - + /** * balise : PRE * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_PRE($param, $other = 'pre') { if ($other=='pre' && $this->maxH) $this->o_BR(array()); - + $this->style->save(); $this->style->value['font-family'] = 'courier'; $this->style->analyse($other, $param); @@ -2871,18 +3093,18 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->FontSet(); if ($other=='pre') return $this->o_DIV($param, $other); - + return true; } function o_CODE($param) { return $this->o_PRE($param, 'code'); } - + /** * balise : PRE * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_PRE($param, $other = 'pre') { if ($other=='pre') @@ -2894,18 +3116,18 @@ if (!defined('__CLASS_HTML2PDF__')) } $this->style->load(); $this->style->FontSet(); - + return true; } function c_CODE($param) { return $this->c_PRE($param, 'code'); } - + /** * balise : BIG * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_BIG($param) { $this->style->save(); @@ -2914,32 +3136,32 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('big', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } /** * balise : BIG * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_BIG($param) { $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : SMALL * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_SMALL($param) { $this->style->save(); @@ -2948,22 +3170,22 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('small', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } - + /** * balise : SMALL * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_SMALL($param) { $this->style->load(); $this->style->FontSet(); - + return true; } @@ -2971,10 +3193,10 @@ if (!defined('__CLASS_HTML2PDF__')) /** * balise : SUP * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_SUP($param) { $this->style->save(); @@ -2983,32 +3205,32 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('sup', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } - + /** * balise : SUP * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_SUP($param) { $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : SUB * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_SUB($param) { $this->style->save(); @@ -3018,32 +3240,32 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); $this->inSub = 1; - + return true; } - + /** * balise : SUB * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_SUB($param) { $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : UL * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_UL($param, $other = 'ul') { if ($this->forOneLine) return false; @@ -3053,25 +3275,25 @@ if (!defined('__CLASS_HTML2PDF__')) if ($this->maxH) $this->o_BR(array()); if (!count($this->defLIST)) $this->o_BR(array()); } - + if (!isset($param['style']['width'])) $param['allwidth'] = true; $param['cellspacing'] = 0; - // une liste est trait�e comme un tableau + // une liste est traitée comme un tableau $this->o_TABLE($param, $other); // ajouter un niveau de liste $this->listeAddLevel($other, $this->style->value['list-style-type'], $this->style->value['list-style-image']); - + return true; } - function o_OL($param) { return $this->o_UL($param, 'ol'); } - + function o_OL($param) { return $this->o_UL($param, 'ol'); } + /** * balise : UL * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null */ function c_UL($param) @@ -3080,7 +3302,7 @@ if (!defined('__CLASS_HTML2PDF__')) // fin du tableau $this->c_TABLE($param); - + // enlever un niveau de liste $this->listeDelLevel(); @@ -3088,7 +3310,7 @@ if (!defined('__CLASS_HTML2PDF__')) { if (!count($this->defLIST)) $this->o_BR(array()); } - + return true; } function c_OL($param) { return $this->c_UL($param); } @@ -3096,8 +3318,8 @@ if (!defined('__CLASS_HTML2PDF__')) /** * balise : LI * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null */ function o_LI($param) @@ -3111,7 +3333,7 @@ if (!defined('__CLASS_HTML2PDF__')) // preparation du style de la puce $paramPUCE = $param; - + $inf = $this->listeGetLi(); if ($inf[0]) { @@ -3131,18 +3353,18 @@ if (!defined('__CLASS_HTML2PDF__')) $paramPUCE['src'] = $inf[2]; $paramPUCE['sub_li'] = true; } - + // nouvelle ligne $this->o_TR($param, 'li'); $this->style->save(); - + if ($inf[1]) { $this->style->value['mini-decal']+= $this->style->value['mini-size']*0.25; $this->style->value['mini-size'] *= 0.75; } - + // si on est dans un sub_html => preparation, sinon affichage classique if ($this->sub_part) { @@ -3175,18 +3397,18 @@ if (!defined('__CLASS_HTML2PDF__')) } $this->style->load(); - + // td pour le contenu $this->o_TD($param, 'li'); - + return true; } /** * balise : LI * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null */ function c_LI($param) @@ -3195,20 +3417,20 @@ if (!defined('__CLASS_HTML2PDF__')) // fin du contenu $this->c_TD($param, 'li'); - + // fin de la ligne $this->c_TR($param, 'li'); - + return true; } - + /** * balise : TBODY * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TBODY($param) { if ($this->forOneLine) return false; @@ -3217,50 +3439,50 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('tbody', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; - } + } /** * balise : TBODY * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TBODY($param) { if ($this->forOneLine) return false; $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : THEAD * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_THEAD($param) { if ($this->forOneLine) return false; global $HTML2PDF_TABLEAU; - + $this->style->save(); $this->style->analyse('thead', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - - // si on est en mode sub_html : sauvegarde du num�ro du TR + + // si on est en mode sub_html : sauvegarde du numéro du TR if ($this->sub_part) { $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0] = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']; - $HTML2PDF_TABLEAU[$param['num']]['thead']['code'] = array(); + $HTML2PDF_TABLEAU[$param['num']]['thead']['code'] = array(); for($pos=$this->temp_pos; $posparsing->code); $pos++) { $todo = $this->parsing->code[$pos]; @@ -3275,17 +3497,17 @@ if (!defined('__CLASS_HTML2PDF__')) $this->parse_pos = $res[0]-1; $HTML2PDF_TABLEAU[$param['num']]['tr_curr']+= count($HTML2PDF_TABLEAU[$param['num']]['thead']['tr']); } - + return true; - } + } /** * balise : THEAD * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_THEAD($param) { if ($this->forOneLine) return false; @@ -3293,41 +3515,41 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->load(); $this->style->FontSet(); - // si on est en mode sub_html : sauvegarde du num�ro du TR + // si on est en mode sub_html : sauvegarde du numéro du TR if ($this->sub_part) { - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; $min = $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0]; - $max = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1; + $max = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1; $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'] = range($min, $max); } - + return true; } /** * balise : TFOOT * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TFOOT($param) { if ($this->forOneLine) return false; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; $this->style->save(); $this->style->analyse('tfoot', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - - // si on est en mode sub_html : sauvegarde du num�ro du TR + + // si on est en mode sub_html : sauvegarde du numéro du TR if ($this->sub_part) { $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0] = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']; - $HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'] = array(); + $HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'] = array(); for($pos=$this->temp_pos; $posparsing->code); $pos++) { $todo = $this->parsing->code[$pos]; @@ -3342,44 +3564,44 @@ if (!defined('__CLASS_HTML2PDF__')) $this->parse_pos = $res[0]; $HTML2PDF_TABLEAU[$param['num']]['tr_curr']+= count($HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr']); } - + return true; - } + } /** * balise : TFOOT * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TFOOT($param) { if ($this->forOneLine) return false; $this->style->load(); $this->style->FontSet(); - - // si on est en mode sub_html : sauvegarde du num�ro du TR + + // si on est en mode sub_html : sauvegarde du numéro du TR if ($this->sub_part) { global $HTML2PDF_TABLEAU; - + $min = $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0]; - $max = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1; + $max = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1; $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'] = range($min, $max); } - + return true; } /** * balise : THEAD_SUB * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_THEAD_SUB($param) { if ($this->forOneLine) return false; @@ -3388,34 +3610,34 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('thead', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } - + /** * balise : THEAD_SUB * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_THEAD_SUB($param) { if ($this->forOneLine) return false; $this->style->load(); $this->style->FontSet(); - + return true; } /** * balise : TFOOT_SUB * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TFOOT_SUB($param) { if ($this->forOneLine) return false; @@ -3424,78 +3646,79 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('tfoot', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; } - + /** * balise : TFOOT_SUB * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TFOOT_SUB($param) { if ($this->forOneLine) return false; $this->style->load(); $this->style->FontSet(); - + return true; } - + /** * balise : FORM * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_FORM($param) { $this->style->save(); $this->style->analyse('form', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + return true; - } + } /** * balise : FORM * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_FORM($param) { $this->style->load(); $this->style->FontSet(); - + return true; } - + /** * balise : TABLE * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TABLE($param, $other = 'table') { if ($this->forOneLine) return false; - + if ($this->maxH) $this->o_BR(array()); + $this->maxH = 0; - // utilisation du tableau des param�tres des tables - global $HTML2PDF_TABLEAU; + // utilisation du tableau des paramétres des tables + global $HTML2PDF_TABLEAU; $align_object = isset($param['align']) ? strtolower($param['align']) : 'left'; if (isset($param['align'])) unset($param['align']); if (!in_array($align_object, array('left', 'center', 'right'))) $align_object = 'left'; - + // lecture et initialisation du style $this->style->save(); $this->style->analyse($other, $param); @@ -3505,11 +3728,11 @@ if (!defined('__CLASS_HTML2PDF__')) if ($this->style->value['margin-auto']) $align_object = 'center'; // est-on en collapse - $collapse = false; + $collapse = false; if ($other=='table') $collapse = isset($this->style->value['border']['collapse']) ? $this->style->value['border']['collapse'] : false; - // si oui il faut adapt� les borders + // si oui il faut adapté les borders if ($collapse) { $param['style']['border'] = 'none'; @@ -3519,15 +3742,19 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->value['border']['r'] = $none; $this->style->value['border']['b'] = $none; $this->style->value['border']['l'] = $none; - } - - // si on est en mode sub_html : initialisation des dimensions et autres + } + + // si on est en mode sub_html : initialisation des dimensions et autres if ($this->sub_part) { + if ($this->DEBUG_actif) $this->DEBUG_add('Table n°'.$param['num'], true); $HTML2PDF_TABLEAU[$param['num']] = array(); $HTML2PDF_TABLEAU[$param['num']]['cellpadding'] = $this->style->ConvertToMM(isset($param['cellpadding']) ? $param['cellpadding'] : '1px'); // cellpadding du tableau $HTML2PDF_TABLEAU[$param['num']]['cellspacing'] = $this->style->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px'); // cellspacing du tableau - $HTML2PDF_TABLEAU[$param['num']]['cases'] = array(); // liste des propri�t�s des cases + $HTML2PDF_TABLEAU[$param['num']]['cases'] = array(); // liste des propriétés des cases + $HTML2PDF_TABLEAU[$param['num']]['corr'] = array(); // tableau de correlation pour les colspan et rowspan + $HTML2PDF_TABLEAU[$param['num']]['corr_x'] = 0; // position dans le tableau de correlation + $HTML2PDF_TABLEAU[$param['num']]['corr_y'] = 0; // position dans le tableau de correlation $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0; // colonne courante $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = 0; // ligne courante $HTML2PDF_TABLEAU[$param['num']]['curr_x'] = $this->pdf->getX(); // position courante X @@ -3551,20 +3778,20 @@ if (!defined('__CLASS_HTML2PDF__')) $HTML2PDF_TABLEAU[$param['num']]['tfoot']['height'] = 0; // hauteur du tfoot $HTML2PDF_TABLEAU[$param['num']]['thead']['code'] = array(); // contenu HTML du thead $HTML2PDF_TABLEAU[$param['num']]['tfoot']['code'] = array(); // contenu HTML du tfoot - + $HTML2PDF_TABLEAU[$param['num']]['cols'] = array(); // definition via les balises col $this->saveMargin($this->pdf->lMargin, $this->pdf->tMargin, $this->pdf->rMargin); - + // adaptation de la largeur en fonction des marges du tableau $this->style->value['width']-= $HTML2PDF_TABLEAU[$param['num']]['marge']['l'] + $HTML2PDF_TABLEAU[$param['num']]['marge']['r']; } else { - // on repart � la premiere page du tableau et � la premiere case + // on repart à la premiere page du tableau et à la premiere case $HTML2PDF_TABLEAU[$param['num']]['page'] = 0; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0; $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = 0; $HTML2PDF_TABLEAU[$param['num']]['td_x'] = $HTML2PDF_TABLEAU[$param['num']]['marge']['l']+$HTML2PDF_TABLEAU[$param['num']]['curr_x']; - $HTML2PDF_TABLEAU[$param['num']]['td_y'] = $HTML2PDF_TABLEAU[$param['num']]['marge']['t']+$HTML2PDF_TABLEAU[$param['num']]['curr_y']; + $HTML2PDF_TABLEAU[$param['num']]['td_y'] = $HTML2PDF_TABLEAU[$param['num']]['marge']['t']+$HTML2PDF_TABLEAU[$param['num']]['curr_y']; // initialisation du style des bordures de la premiere partie de tableau $this->Rectangle( @@ -3580,33 +3807,33 @@ if (!defined('__CLASS_HTML2PDF__')) $HTML2PDF_TABLEAU[$param['num']]['style_value'] = $this->style->value; } - + return true; } /** * balise : TABLE * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TABLE($param) { if ($this->forOneLine) return false; $this->maxH = 0; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; // restauration du style $this->style->load(); $this->style->FontSet(); - // si on est en mode sub_html : initialisation des dimensions et autres + // si on est en mode sub_html : initialisation des dimensions et autres if ($this->sub_part) { // ajustement de la taille des cases - $this->calculTailleCases($HTML2PDF_TABLEAU[$param['num']]['cases']); + $this->calculTailleCases($HTML2PDF_TABLEAU[$param['num']]['cases'], $HTML2PDF_TABLEAU[$param['num']]['corr']); // calcul de la hauteur du THEAD et du TFOOT $lst = array('thead', 'tfoot'); @@ -3620,7 +3847,7 @@ if (!defined('__CLASS_HTML2PDF__')) for($i=0; $ipdf->h - $this->pdf->bMargin; // max de hauteur par page $y = $HTML2PDF_TABLEAU[$param['num']]['curr_y']; // position Y actuelle $height = $h0; - - // on va lire les hauteurs de chaque ligne, une � une, et voir si ca rentre sur la page. + + // on va lire les hauteurs de chaque ligne, une à une, et voir si ca rentre sur la page. for($k=0; $k la hauteur sur cette page est trouv�e, et on passe � la page d'apres + // => la hauteur sur cette page est trouvée, et on passe à la page d'apres if ($y+$h+$height>$max) { if ($height==$h0) $height = null; $HTML2PDF_TABLEAU[$param['num']]['height'][] = $height; - $height = $h0; + $height = $h0; $y = $this->margeTop; } $height+= $th; } - // rajout du reste de tableau (si il existe) � la derniere page + // rajout du reste de tableau (si il existe) à la derniere page if ($height!=$h0 || $k==0) $HTML2PDF_TABLEAU[$param['num']]['height'][] = $height; } else @@ -3695,75 +3922,95 @@ if (!defined('__CLASS_HTML2PDF__')) $tmp_td = $HTML2PDF_TABLEAU[$param['num']]['td_curr']; $OLD_parse_pos = $this->parse_pos; $OLD_parse_code = $this->parsing->code; - + $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0]; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0; $this->parse_pos = 0; $this->parsing->code = $HTML2PDF_TABLEAU[$param['num']]['tfoot']['code']; $this->MakeHTMLcode(); - + $this->parse_pos = $OLD_parse_pos; $this->parsing->code = $OLD_parse_code; $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = $tmp_td; } - - // determination des coordonn�es de sortie du tableau + + // determination des coordonnées de sortie du tableau $x = $HTML2PDF_TABLEAU[$param['num']]['curr_x'] + $HTML2PDF_TABLEAU[$param['num']]['width']; if (count($HTML2PDF_TABLEAU[$param['num']]['height'])>1) $y = $this->margeTop+$HTML2PDF_TABLEAU[$param['num']]['height'][count($HTML2PDF_TABLEAU[$param['num']]['height'])-1]; else if (count($HTML2PDF_TABLEAU[$param['num']]['height'])==1) $y = $HTML2PDF_TABLEAU[$param['num']]['curr_y']+$HTML2PDF_TABLEAU[$param['num']]['height'][count($HTML2PDF_TABLEAU[$param['num']]['height'])-1]; else - $y = $HTML2PDF_TABLEAU[$param['num']]['curr_y']; + $y = $HTML2PDF_TABLEAU[$param['num']]['curr_y']; - // restauration des marges - $this->loadMargin(); - - // position de sortie du tableau - $this->pdf->setX($x); - $this->pdf->setY($y); + // taille du tableau $this->maxX = max($this->maxX, $x); $this->maxY = max($this->maxY, $y); + + + // nouvelle position apres le tableau + $this->pdf->setXY($this->pdf->lMargin, $y); + + // restauration des marges + $this->loadMargin(); + + if ($this->DEBUG_actif) $this->DEBUG_add('Table n°'.$param['num'], false); } - + return true; } + + /** + * balise : COL + * mode : OUVERTURE (pas de fermeture) + * + * @param array paramètres de l'élément de parsing + * @return null + */ + function o_COL($param) + { + global $HTML2PDF_TABLEAU; + $span = isset($param['span']) ? $param['span'] : 1; + for($k=0; $k<$span; $k++) + $HTML2PDF_TABLEAU[$param['num']]['cols'][] = $param; + } + /** * balise : TR * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TR($param, $other = 'tr') { if ($this->forOneLine) return false; $this->maxH = 0; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; // analyse du style $this->style->save(); $this->style->analyse($other, $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + // positionnement dans le tableau $HTML2PDF_TABLEAU[$param['num']]['tr_curr']++; $HTML2PDF_TABLEAU[$param['num']]['td_curr']= 0; - + // si on est pas dans un sub_html if (!$this->sub_part) { // Y courant apres la ligne $ty=null; for($ii=0; $ii nouvelle page if (!$this->isInTfoot && $HTML2PDF_TABLEAU[$param['num']]['td_y'] + $HTML2PDF_TABLEAU[$param['num']]['marge']['b'] + $ty +$hfoot> $this->pdf->h - $this->pdf->bMargin) { @@ -3773,7 +4020,7 @@ if (!defined('__CLASS_HTML2PDF__')) $tmp_td = $HTML2PDF_TABLEAU[$param['num']]['td_curr']; $OLD_parse_pos = $this->parse_pos; $OLD_parse_code = $this->parsing->code; - + $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $HTML2PDF_TABLEAU[$param['num']]['tfoot']['tr'][0]; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0; $this->parse_pos = 0; @@ -3781,13 +4028,13 @@ if (!defined('__CLASS_HTML2PDF__')) $this->isInTfoot = true; $this->MakeHTMLcode(); $this->isInTfoot = false; - + $this->parse_pos = $OLD_parse_pos; $this->parsing->code = $OLD_parse_code; $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = $tmp_td; } - + $HTML2PDF_TABLEAU[$param['num']]['new_page'] = true; $this->setNewPage(); @@ -3795,7 +4042,7 @@ if (!defined('__CLASS_HTML2PDF__')) $HTML2PDF_TABLEAU[$param['num']]['curr_y'] = $this->pdf->getY(); $HTML2PDF_TABLEAU[$param['num']]['td_y'] = $HTML2PDF_TABLEAU[$param['num']]['curr_y']+$HTML2PDF_TABLEAU[$param['num']]['marge']['t']; - // si la hauteur de cette partie a bien �t� calcul�e, on trace le cadre + // si la hauteur de cette partie a bien été calculée, on trace le cadre if (isset($HTML2PDF_TABLEAU[$param['num']]['height'][$HTML2PDF_TABLEAU[$param['num']]['page']])) { $old = $this->style->value; @@ -3812,11 +4059,11 @@ if (!defined('__CLASS_HTML2PDF__')) $HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5, $this->style->value['background'] ); - + $this->style->value = $old; } } - + if ($HTML2PDF_TABLEAU[$param['num']]['new_page'] && count($HTML2PDF_TABLEAU[$param['num']]['thead']['code'])) { $HTML2PDF_TABLEAU[$param['num']]['new_page'] = false; @@ -3824,13 +4071,13 @@ if (!defined('__CLASS_HTML2PDF__')) $tmp_td = $HTML2PDF_TABLEAU[$param['num']]['td_curr']; $OLD_parse_pos = $this->parse_pos; $OLD_parse_code = $this->parsing->code; - + $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $HTML2PDF_TABLEAU[$param['num']]['thead']['tr'][0]; $HTML2PDF_TABLEAU[$param['num']]['td_curr'] = 0; $this->parse_pos = 0; $this->parsing->code = $HTML2PDF_TABLEAU[$param['num']]['thead']['code']; $this->MakeHTMLcode(); - + $this->parse_pos = $OLD_parse_pos; $this->parsing->code = $OLD_parse_code; $HTML2PDF_TABLEAU[$param['num']]['tr_curr'] = $tmp_tr; @@ -3841,28 +4088,34 @@ if (!defined('__CLASS_HTML2PDF__')) else { $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1] = array(); - } - + if (!isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']])) + $HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']] = array(); + + $HTML2PDF_TABLEAU[$param['num']]['corr_x']=0; + while(isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']][$HTML2PDF_TABLEAU[$param['num']]['corr_x']])) + $HTML2PDF_TABLEAU[$param['num']]['corr_x']++; + } + return true; } /** * balise : TR * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TR($param) { if ($this->forOneLine) return false; $this->maxH = 0; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; // restauration du style $this->style->load(); - $this->style->FontSet(); + $this->style->FontSet(); // si on est pas dans un sub_html if (!$this->sub_part) @@ -3871,34 +4124,38 @@ if (!defined('__CLASS_HTML2PDF__')) $ty=null; for($ii=0; $iiforOneLine) return false; $this->maxH = 0; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; $param['cellpadding'] = $HTML2PDF_TABLEAU[$param['num']]['cellpadding'].'mm'; $param['cellspacing'] = $HTML2PDF_TABLEAU[$param['num']]['cellspacing'].'mm'; - + if ($other=='li') { $special_li = true; @@ -3917,10 +4174,62 @@ if (!defined('__CLASS_HTML2PDF__')) } } - // est-on en collapse + // est-on en collapse, et egalement y-a-t'il des definitions de colonne + $x = $HTML2PDF_TABLEAU[$param['num']]['td_curr']; + $y = $HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1; + $colspan = isset($param['colspan']) ? $param['colspan'] : 1; + $rowspan = isset($param['rowspan']) ? $param['rowspan'] : 1; $collapse = false; if (in_array($other, array('td', 'th'))) + { + $num_col = isset($HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr']) ? $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr'] : $HTML2PDF_TABLEAU[$param['num']]['corr_x']; + + // si une definition de colonne est presente + if (isset($HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col])) + { + // on la recupere + $col_param = $HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col]; + + // pour les colspan, on recupere toutes les largeurs + $col_param['style']['width'] = array(); + for($k=0; $k<$colspan; $k++) + { + if (isset($HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col+$k]['style']['width'])) + $col_param['style']['width'][] = $HTML2PDF_TABLEAU[$param['num']]['cols'][$num_col+$k]['style']['width']; + } + + // on les somme + $total = ''; + $last = $this->style->getLastWidth(); + if (count($col_param['style']['width'])) + { + $total = $col_param['style']['width'][0]; unset($col_param['style']['width'][0]); + foreach($col_param['style']['width'] as $width) + { + if (substr($total, -1)=='%' && substr($width, -1)=='%') + $total = (str_replace('%', '', $total)+str_replace('%', '', $width)).'%'; + else + $total = ($this->style->ConvertToMM($total, $last) + $this->style->ConvertToMM($width, $last)).'mm'; + } + } + + // et on recupere la largeur finale + if ($total) + $col_param['style']['width'] = $total; + else + unset($col_param['style']['width']); + + + // on merge les 2 styles (col + td) + $param['style'] = array_merge($col_param['style'], $param['style']); + + // si une classe est définie, on la merge egalement + if (isset($col_param['class'])) + $param['class'] = $col_param['class'].(isset($param['class']) ? ' '.$param['class'] : ''); + } + $collapse = isset($this->style->value['border']['collapse']) ? $this->style->value['border']['collapse'] : false; + } // analyse du style @@ -3934,20 +4243,20 @@ if (!defined('__CLASS_HTML2PDF__')) } $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + // si on est en collapse : modification du style if ($collapse) { if (!$this->sub_part) { if ($HTML2PDF_TABLEAU[$param['num']]['tr_curr']>1 && !$HTML2PDF_TABLEAU[$param['num']]['new_page']) - $this->style->value['border']['t'] = $this->style->readBorder('none'); + $this->style->value['border']['t'] = $this->style->readBorder('none'); } - + if ($HTML2PDF_TABLEAU[$param['num']]['td_curr']>0) - $this->style->value['border']['l'] = $this->style->readBorder('none'); - } - + $this->style->value['border']['l'] = $this->style->readBorder('none'); + } + $marge = array(); $marge['t'] = $this->style->value['padding']['t']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['t']['width']; $marge['r'] = $this->style->value['padding']['r']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['r']['width']; @@ -3959,19 +4268,34 @@ if (!defined('__CLASS_HTML2PDF__')) { // on se positionne dans le tableau $HTML2PDF_TABLEAU[$param['num']]['td_curr']++; - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1] = array(); - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w'] = 0; - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['h'] = 0; - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['dw'] = 0; - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['colspan'] = isset($param['colspan']) ? $param['colspan'] : 1; - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['rowspan'] = isset($param['rowspan']) ? $param['rowspan'] : 1; - - // on extrait tout ce qui est contenu dans le TD - $res = $this->parsing->getLevel($this->temp_pos); + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x] = array(); + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'] = 0; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h'] = 0; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['dw'] = 0; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['colspan'] = $colspan; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['rowspan'] = $rowspan; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Xr'] = $HTML2PDF_TABLEAU[$param['num']]['corr_x']; + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['Yr'] = $HTML2PDF_TABLEAU[$param['num']]['corr_y']; + + for($j=0; $j<$rowspan; $j++) + { + for($i=0; $i<$colspan; $i++) + { + $HTML2PDF_TABLEAU[$param['num']]['corr'] + [$HTML2PDF_TABLEAU[$param['num']]['corr_y']+$j] + [$HTML2PDF_TABLEAU[$param['num']]['corr_x']+$i] = ($i+$j>0) ? '' : array($x,$y,$colspan,$rowspan); + } + } + $HTML2PDF_TABLEAU[$param['num']]['corr_x']+= $colspan; + while(isset($HTML2PDF_TABLEAU[$param['num']]['corr'][$HTML2PDF_TABLEAU[$param['num']]['corr_y']][$HTML2PDF_TABLEAU[$param['num']]['corr_x']])) + $HTML2PDF_TABLEAU[$param['num']]['corr_x']++; - // on en cr�� un sous HTML que l'on transforme en PDF + // on extrait tout ce qui est contenu dans le TD + $res = $this->parsing->getLevel($this->temp_pos); + + // on en créé un sous HTML que l'on transforme en PDF // pour analyse les dimensions - // et les r�cup�rer dans le tableau global. + // et les récupérer dans le tableau global. $this->CreateSubHTML($this->sub_html); $this->sub_html->writeHTML($res[1]); $this->temp_pos = $res[0]-2; @@ -3980,70 +4304,71 @@ if (!defined('__CLASS_HTML2PDF__')) { // on se positionne dans le tableau $HTML2PDF_TABLEAU[$param['num']]['td_curr']++; - $HTML2PDF_TABLEAU[$param['num']]['td_x']+= $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['dw']; - + $HTML2PDF_TABLEAU[$param['num']]['td_x']+= $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['dw']; + // initialisation du style des bordures de la premiere partie de tableau $this->Rectangle( $HTML2PDF_TABLEAU[$param['num']]['td_x'], $HTML2PDF_TABLEAU[$param['num']]['td_y'], - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w'], - $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['h'], + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'], + $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h'], $this->style->value['border'], $this->style->value['padding'], $HTML2PDF_TABLEAU[$param['num']]['cellspacing']*0.5, $this->style->value['background'] ); + - - $this->style->value['width'] = $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w'] - $marge['l'] - $marge['r']; + $this->style->value['width'] = $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['w'] - $marge['l'] - $marge['r']; // limitation des marges aux dimensions de la case $mL = $HTML2PDF_TABLEAU[$param['num']]['td_x']+$marge['l']; $mR = $this->pdf->w - $mL - $this->style->value['width']; $this->saveMargin($mL, 0, $mR); - + // positionnement en fonction - $h_corr = $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['h']; - $h_reel = $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['real_h']; + $h_corr = $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['h']; + $h_reel = $HTML2PDF_TABLEAU[$param['num']]['cases'][$y][$x]['real_h']; switch($this->style->value['vertical-align']) { case 'bottom': $y_corr = $h_corr-$h_reel; break; - + case 'middle': $y_corr = ($h_corr-$h_reel)*0.5; break; - + case 'top': default: $y_corr = 0; - break; + break; } - $this->pdf->setX($HTML2PDF_TABLEAU[$param['num']]['td_x']+$marge['l']); - $this->pdf->setY($HTML2PDF_TABLEAU[$param['num']]['td_y']+$marge['t']+$y_corr); + $x = $HTML2PDF_TABLEAU[$param['num']]['td_x']+$marge['l']; + $y = $HTML2PDF_TABLEAU[$param['num']]['td_y']+$marge['t']+$y_corr; + $this->pdf->setXY($x, $y); $this->setNewPositionForNewLine(); } - + return true; } /** * balise : TD * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TD($param) { if ($this->forOneLine) return false; $this->maxH = 0; - global $HTML2PDF_TABLEAU; + global $HTML2PDF_TABLEAU; - // r�cup�ration de la marge + // récupération de la marge $marge = array(); $marge['t'] = $this->style->value['padding']['t']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['t']['width']; $marge['r'] = $this->style->value['padding']['r']+0.5*$HTML2PDF_TABLEAU[$param['num']]['cellspacing']+$this->style->value['border']['r']['width']; @@ -4057,16 +4382,16 @@ if (!defined('__CLASS_HTML2PDF__')) // si on est dans un sub_html if ($this->sub_part) { - if ($this->testTDin1page && $this->sub_html->pdf->page>1) @HTML2PDF::makeError(7, __FILE__, __LINE__); - + if ($this->testTDin1page && $this->sub_html->pdf->page>1) @HTML2PDF::makeError(7, __FILE__, __LINE__); + // dimentions de cette case $w0 = $this->sub_html->maxX + $marge['l'] + $marge['r']; $h0 = $this->sub_html->maxY + $marge['t'] + $marge['b']; - - // dimensions impos�es par le style + + // dimensions imposées par le style $w2 = $this->style->value['width'] + $marge['l'] + $marge['r']; $h2 = $this->style->value['height'] + $marge['t'] + $marge['b']; - + // dimension finale de la case = max des 2 ci-dessus $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['w'] = max(array($w0, $w2)); $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['h'] = max(array($h0, $h2)); @@ -4075,7 +4400,7 @@ if (!defined('__CLASS_HTML2PDF__')) $HTML2PDF_TABLEAU[$param['num']]['cases'][$HTML2PDF_TABLEAU[$param['num']]['tr_curr']-1][$HTML2PDF_TABLEAU[$param['num']]['td_curr']-1]['real_h'] = $h0; // suppresion du sous_html - $this->DestroySubHTML(); + $this->DestroySubHTML($this->sub_html); } else { @@ -4086,22 +4411,22 @@ if (!defined('__CLASS_HTML2PDF__')) // restauration du style $this->style->load(); - $this->style->FontSet(); - + $this->style->FontSet(); + return true; } - - function calculTailleCases(&$cases) + + function calculTailleCases(&$cases, &$corr) { - // construction d'un tableau de correlation +/* // construction d'un tableau de correlation $corr = array(); - // on fait correspondre chaque case d'un tableau norm� aux cases r�elles, en prennant en compte les colspan et rowspan + // on fait correspondre chaque case d'un tableau normé aux cases réelles, en prennant en compte les colspan et rowspan $Yr=0; for($y=0; $y r�gle de 3 pour adapter + + // si la somme est inférieure à la taille necessaire => règle de 3 pour adapter if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']) for($i=0; $i<$corr[$y][$x][2]; $i++) $sw[$x+$i] = $sw[$x+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['w']; @@ -4169,7 +4494,7 @@ if (!defined('__CLASS_HTML2PDF__')) } } - // on d�termine, pour les cases sans rowspan, la hauteur maximale de chaque colone + // on détermine, pour les cases sans rowspan, la hauteur maximale de chaque colone $sh = array(); for($y=0; $y r�gle de 3 pour adapter + + // si la somme est inférieure à la taille necessaire => règle de 3 pour adapter if ($s>0 && $s<$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']) for($i=0; $i<$corr[$y][$x][3]; $i++) $sh[$y+$i] = $sh[$y+$i]/$s*$cases[$corr[$y][$x][1]][$corr[$y][$x][0]]['h']; } } } - + // on applique les nouvelles hauteurs for($y=0; $yforOneLine) return false; $this->maxH = 0; - // identique � TD mais en gras + // identique à TD mais en gras if (!isset($param['style']['font-weight'])) $param['style']['font-weight'] = 'bold'; $this->o_TD($param, 'th'); - + return true; - } + } /** * balise : TH * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TH($param) { if ($this->forOneLine) return false; $this->maxH = 0; - // identique � TD - $this->c_TD($param); - + // identique à TD + $this->c_TD($param); + return true; } /** * balise : IMG * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_IMG($param) { // analyse du style - $src = str_replace('&', '&', $param['src']); + $src = str_replace('&', '&', $param['src']); $this->style->save(); $this->style->value['width'] = 0; @@ -4298,40 +4623,40 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - // affichage de l'image + // affichage de l'image $this->Image($src, isset($param['sub_li'])); // restauration du style $this->style->load(); - $this->style->FontSet(); - + $this->style->FontSet(); + return true; } - + /** * balise : SELECT * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_SELECT($param) { // preparation du champs if (!isset($param['name'])) $param['name'] = 'champs_pdf_'.(count($this->lstChamps)+1); - + $param['name'] = strtolower($param['name']); - + if (isset($this->champs[$param['name']])) $this->champs[$param['name']]++; else $this->champs[$param['name']] = 1; - + $this->style->save(); $this->style->analyse('select', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $this->lstSelect = array(); $this->lstSelect['name'] = $param['name']; $this->lstSelect['multi'] = isset($param['multiple']) ? true : false; @@ -4339,17 +4664,17 @@ if (!defined('__CLASS_HTML2PDF__')) $this->lstSelect['options'] = array(); if ($this->lstSelect['multi'] && $this->lstSelect['size']<3) $this->lstSelect['size'] = 3; - + return true; } - + /** * balise : OPTION * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_OPTION($param) { // on extrait tout ce qui est contenu dans l'option @@ -4357,28 +4682,28 @@ if (!defined('__CLASS_HTML2PDF__')) $this->parse_pos = $res[0]-2; $texte = $res[1]; $value = isset($param['value']) ? $param['value'] : 'auto_opt_'.(count($this->lstSelect)+1); - + $this->lstSelect['options'][$value] = $texte; - + return true; } - + /** * balise : OPTION * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_OPTION($param) { return true; } - + /** * balise : SELECT * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_SELECT() { // position d'affichage @@ -4386,44 +4711,44 @@ if (!defined('__CLASS_HTML2PDF__')) $y = $this->pdf->getY(); $f = 1.08*$this->style->value['font-size']; - $w = $this->style->value['width']; if (!$w) $w = 50; + $w = $this->style->value['width']; if (!$w) $w = 50; $h = ($f*1.07*$this->lstSelect['size'] + 1); $prop = array(); if ($this->lstSelect['multi']) $prop['multipleSelection'] = true; $this->pdf->form_Select($this->lstSelect['name'], $x, $y, $w, $h, $this->lstSelect['options'], $this->lstSelect['size']>1, $prop); - + $this->maxX = max($this->maxX, $x+$w); $this->maxY = max($this->maxY, $y+$h); $this->maxH = max($this->maxH, $h); $this->pdf->setX($x+$w); - + $this->style->load(); $this->style->FontSet(); - + $this->lstSelect = array(); - + return true; } /** * balise : TEXTAREA * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_TEXTAREA($param) { // preparation du champs if (!isset($param['name'])) $param['name'] = 'champs_pdf_'.(count($this->lstChamps)+1); - + $param['name'] = strtolower($param['name']); - + if (isset($this->champs[$param['name']])) $this->champs[$param['name']]++; else $this->champs[$param['name']] = 1; - + $this->style->save(); $this->style->analyse('textarea', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); @@ -4440,55 +4765,55 @@ if (!defined('__CLASS_HTML2PDF__')) $this->parse_pos = $res[0]-2; $texte = $res[1]; - $w = $fx*(isset($param['cols']) ? $param['cols'] : 22)+1; + $w = $fx*(isset($param['cols']) ? $param['cols'] : 22)+1; $h = $fy*1.07*(isset($param['rows']) ? $param['rows'] : 3)+3; - + // if ($this->style->value['width']) $w = $this->style->value['width']; // if ($this->style->value['height']) $h = $this->style->value['height']; - + $prop = array(); $prop['value'] = $texte; $prop['multiline'] = true; - + $this->pdf->form_InputText($param['name'], $x, $y, $w, $h, $prop); - + $this->maxX = max($this->maxX, $x+$w); $this->maxY = max($this->maxY, $y+$h); $this->maxH = max($this->maxH, $h); $this->pdf->setX($x+$w); - + return true; } - + /** * balise : TEXTAREA * mode : FERMETURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function c_TEXTAREA() { $this->style->load(); $this->style->FontSet(); - + return true; } - + /** * balise : INPUT * mode : OUVERTURE - * - * @param array param�tres de l'�l�ment de parsing + * + * @param array paramètres de l'élément de parsing * @return null - */ + */ function o_INPUT($param) { // preparation du champs if (!isset($param['name'])) $param['name'] = 'champs_pdf_'.(count($this->lstChamps)+1); if (!isset($param['value'])) $param['value'] = ''; if (!isset($param['type'])) $param['type'] = 'text'; - + $param['name'] = strtolower($param['name']); $param['type'] = strtolower($param['type']); @@ -4503,14 +4828,14 @@ if (!defined('__CLASS_HTML2PDF__')) $this->style->analyse('input', $param); $this->style->setPosition($this->pdf->x, $this->pdf->y); $this->style->FontSet(); - + $name = $param['name']; - + // position d'affichage $x = $this->pdf->getX(); $y = $this->pdf->getY(); $f = 1.08*$this->style->value['font-size']; - + switch($param['type']) { case 'checkbox': @@ -4519,22 +4844,22 @@ if (!defined('__CLASS_HTML2PDF__')) if ($h<$f) $y+= ($f-$h)*0.5; $this->pdf->form_InputCheckBox($name, $x, $y, $w, isset($param['checked'])); break; - + case 'radio': $w = 3; $h = $w; if ($h<$f) $y+= ($f-$h)*0.5; $this->pdf->form_InputRadio($name, $x, $y, $w); break; - + case 'hidden': $w = 0; $h = 0; $this->pdf->form_InputHidden($name, $param['value']); break; - + case 'text': - $w = $this->style->value['width']; if (!$w) $w = 40; + $w = $this->style->value['width']; if (!$w) $w = 40; $h = $f*1.3; $prop = array(); $prop['value'] = $param['value']; @@ -4545,34 +4870,34 @@ if (!defined('__CLASS_HTML2PDF__')) case 'reset': case 'button': $action = isset($param['onclick']) ? $param['onclick'] : ''; - $w = $this->style->value['width']; if (!$w) $w = 40; + $w = $this->style->value['width']; if (!$w) $w = 40; $h = $this->style->value['height']; if (!$h) $h = $f*1.3; $prop = array(); $this->pdf->form_InputButton($name, $x, $y, $w, $h, $param['value'], $action, $prop); break; - + default: $w = 0; $h = 0; break; } - + $this->maxX = max($this->maxX, $x+$w); $this->maxY = max($this->maxY, $y+$h); $this->maxH = max($this->maxH, $h); $this->pdf->setX($x+$w); - + $this->style->load(); $this->style->FontSet(); - + return true; } - + function CreateIndex($titre = 'Index', $size_title = 20, $size_bookmark = 15, $bookmark_title = true, $display_page = true) { $this->pdf->CreateIndex($this, $titre, $size_title, $size_bookmark, $bookmark_title, $display_page); } - + function textLOAD($langue) { if (!preg_match('/^([a-z0-9]+)$/isU', $langue)) @@ -4580,15 +4905,15 @@ if (!defined('__CLASS_HTML2PDF__')) echo 'ERROR : language code '.$langue.' incorrect.'; exit; } - + $file = dirname(__FILE__).'/langues/'.strtolower($langue).'.txt'; if (!is_file($file)) { echo 'ERROR : language code '.$langue.' unknown.
'; echo 'You can create the translation file '.$file.' and send it to me in order to integrate it into a future version.'; - exit; + exit; } - + $texte = array(); $infos = file($file); foreach($infos as $val) @@ -4596,67 +4921,68 @@ if (!defined('__CLASS_HTML2PDF__')) $val = trim($val); $val = explode("\t", $val); if (count($val)<2) continue; - + $t_k = trim($val[0]); unset($val[0]); $t_v = trim(implode(' ', $val)); if ($t_k && $t_v) $texte[$t_k] = $t_v; } global $HTML2PDF_TEXTE_FILE; - $HTML2PDF_TEXTE_FILE = $texte; + $HTML2PDF_TEXTE_FILE = $texte; } - + function textGET($key) { global $HTML2PDF_TEXTE_FILE; if (!isset($HTML2PDF_TEXTE_FILE[$key])) return '######'; - + return $HTML2PDF_TEXTE_FILE[$key]; } - - function makeError($err, $file, $line, $other = null) + + function makeError($err, $file, $line, $other = null, $html = '') { $msg = ''; switch($err) { case 1: $msg = (@HTML2PDF::textGET('err01')); - $msg = str_replace('[[OTHER]]', $other, $msg); + $msg = str_replace('[[OTHER]]', $other, $msg); break; - + case 2: $msg = (@HTML2PDF::textGET('err02')); - $msg = str_replace('[[OTHER_0]]', $other[0], $msg); - $msg = str_replace('[[OTHER_1]]', $other[1], $msg); - $msg = str_replace('[[OTHER_2]]', $other[2], $msg); + $msg = str_replace('[[OTHER_0]]', $other[0], $msg); + $msg = str_replace('[[OTHER_1]]', $other[1], $msg); + $msg = str_replace('[[OTHER_2]]', $other[2], $msg); break; - + case 3: $msg = (@HTML2PDF::textGET('err03')); - $msg = str_replace('[[OTHER]]', $other, $msg); + $msg = str_replace('[[OTHER]]', $other, $msg); break; - + case 4: $msg = (@HTML2PDF::textGET('err04')); - $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); + $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; - + case 5: $msg = (@HTML2PDF::textGET('err05')); - $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); + $msg = str_replace('[[OTHER]]', print_r($other, true), $msg); break; - + case 6: $msg = (@HTML2PDF::textGET('err06')); - $msg = str_replace('[[OTHER]]', $other, $msg); - break; - + $msg = str_replace('[[OTHER]]', $other, $msg); + break; + case 7: $msg = (@HTML2PDF::textGET('err07')); - break; + break; } - + $Dokeosmsg = '
'.get_lang("ConversionFailled").'
'.get_lang("CommentErrorExportDocument").'
'; echo $Dokeosmsg; + /* ////uncomment for debug echo ''.(@HTML2PDF::textGET('txt01')).$err.'
'; @@ -4664,9 +4990,10 @@ if (!defined('__CLASS_HTML2PDF__')) echo (@HTML2PDF::textGET('txt03')).' '.$line.'
'; echo '
'; echo $msg; + echo '
'; + if ($html) echo '
HTML : ...'.htmlentities($html).'...'; */ - exit; + exit; } } } - diff --git a/main/inc/lib/html2pdf/langues/ca.txt b/main/inc/lib/html2pdf/langues/ca.txt index eddd6ef53d..1d211008b1 100755 --- a/main/inc/lib/html2pdf/langues/ca.txt +++ b/main/inc/lib/html2pdf/langues/ca.txt @@ -1,19 +1,19 @@ -err01 L'etiqueta <[[OTHER]]> encara no existeix.

Si voleu afegir-la, heu de crear els m�todes o_[[OTHER]] (per l'obertura) i c_[[OTHER]] (pel tancament) seguint el model de les etiquetes existents.

A m�s, si creeu nous m�todes, envieu-ho a webmaster@spipu.net per tal d'afegir-los a les seg�ents versions d'HTML2PDF, i que tothom en pugui gaudir. -err02 Frase de 1000 l�nies => massa llarga
Frase : [[OTHER_0]]
Mida casella : [[OTHER_1]]
Mida text : [[OTHER_2]]
-err03 Codi HTML no v�lid, una etiqueta t� un tancament de m�s : <[[OTHER]]> -err04 Codi HTML no v�lid, les etiquetes no estan tancades en l'ordre correcte.
Estat :
[[OTHER]]
-err05 Codi HTML no v�lid, totes les etiquetes han de tenir el seu tancament.
Estat :
[[OTHER]]
-err06 Impossible carregar la imatge [[OTHER]] -err07 El contenido de una etiqueta TD no encaja en una sola p�gina -txt01 ERROR n� -txt02 Fitxer : -txt03 L�nia : -pdf01 Document generat el [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Document generat a les [[date_h]]:[[date_i]] -pdf03 Document generat el [[date_d]]/[[date_m]]/[[date_y]] a les [[date_h]]:[[date_i]] -pdf04 P�gina [[current]]/[[nb]] -pdf05 Els formularis requereixen l'�s de l'Adobe Reader 9 -vue01 ENCABEZAR -vue02 PEU DE P�GINA -vue03 P�GINA -vue04 Visualitzaci� \ No newline at end of file +err01 L'etiqueta <[[OTHER]]> encara no existeix.

Si voleu afegir-la, heu de crear els mètodes o_[[OTHER]] (per l'obertura) i c_[[OTHER]] (pel tancament) seguint el model de les etiquetes existents.

A més, si creeu nous mètodes, envieu-ho a webmaster@spipu.net per tal d'afegir-los a les següents versions d'HTML2PDF, i que tothom en pugui gaudir. +err02 Frase de 1000 línies => massa llarga
Frase : [[OTHER_0]]
Mida casella : [[OTHER_1]]
Mida text : [[OTHER_2]]
+err03 Codi HTML no vàlid, una etiqueta té un tancament de més : <[[OTHER]]> +err04 Codi HTML no vàlid, les etiquetes no estan tancades en l'ordre correcte.
Estat :
[[OTHER]]
+err05 Codi HTML no vàlid, totes les etiquetes han de tenir el seu tancament.
Estat :
[[OTHER]]
+err06 Impossible carregar la imatge [[OTHER]] +err07 El contingut d'una etiqueta TD no quep en una sola pàgina +txt01 ERROR n° +txt02 Fitxer : +txt03 Línia : +pdf01 Document generat el [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Document generat a les [[date_h]]:[[date_i]] +pdf03 Document generat el [[date_d]]/[[date_m]]/[[date_y]] a les [[date_h]]:[[date_i]] +pdf04 Pàgina [[current]]/[[nb]] +pdf05 Els formularis requereixen l'ús de l'Adobe Reader 9 +vue01 CAPÇALERA +vue02 PEU DE PÀGINA +vue03 PÀGINA +vue04 Visualització diff --git a/main/inc/lib/html2pdf/langues/da.txt b/main/inc/lib/html2pdf/langues/da.txt new file mode 100644 index 0000000000..5d6227b5eb --- /dev/null +++ b/main/inc/lib/html2pdf/langues/da.txt @@ -0,0 +1,19 @@ +err01 Tag <[[OTHER]]> endnu ikke eksisterer.

Hvis du ønsker at tilføje det, skal du oprette de metoder o_[[OTHER]] (for åbning) og c_[[OTHER]] (for lukning) ved at følge den model af eksisterende tags.

Hvis du opretter disse metoder, så tøv ikke med at send mig en e-mail til webmaster@spipu.net til indsat dem i den næste version af HTML2PDF. +err02 Sætning af 1000 lines => er for lang
sætning : [[OTHER_0]]
Bredde boksen : [[OTHER_1]]
Længde tekst : [[OTHER_2]]
+err03 HTML-kode er ugyldig, et tag er lukket for mange gange: <[[OTHER]]> +err04 HTML-kode er ugyldig, tags er ikke afsluttet på en ordentlig måde.
Status :
[[OTHER]]
+err05 HTML-kode er ugyldig, alle tags skal lukkes.
Status :
[[OTHER]]
+err06 Umuligt at indlæse billedet [[OTHER]] +err07 Indholdet af en TD tag ikke passer på én side +txt01 FEJL n° +txt02 File : +txt03 Linje : +pdf01 Siden oprettet d. [[date_y]]-[[date_m]]-[[date_d]] +pdf02 Siden oprettet d. [[date_h]]:[[date_i]] +pdf03 Siden oprettet d. [[date_y]]-[[date_m]]-[[date_d]] at [[date_h]]:[[date_i]] +pdf04 Side [[current]]/[[nb]] +pdf05 De formularer kræver brug af Adobe Reader 9 +vue01 HEADER +vue02 FOOTER +vue03 PAGE +vue04 View diff --git a/main/inc/lib/html2pdf/langues/de.txt b/main/inc/lib/html2pdf/langues/de.txt index 2f070007f2..a241f06195 100755 --- a/main/inc/lib/html2pdf/langues/de.txt +++ b/main/inc/lib/html2pdf/langues/de.txt @@ -1,19 +1,19 @@ -err01 Das Tag <[[OTHER]]> existiert noch nicht.

Wenn Sie es hinzuf�gen m�chten, sollen Sie die Methodeno_[[OTHER]] (zu �ffnen) und c_[[OTHER]] (zu schlie�en) nach dem Modell den existierenden Tags.

Wenn Sie diese Methoden au�erdem aufbauen, bitte teilen Sie sie duch eine E-Mail an meine Adresse : webmaster@spipu.net, so da� sie k�nftig in die n�chste Version von HTML2PDF erscheinen. -err02 1000-Linien Satz => zu lang
Satz : [[OTHER_0]]
Breite des Eingabefelds : [[OTHER_1]]
L�nge des Texts : [[OTHER_2]]
-err03 Falsches HTML Code, �berz�hliges geschlo�ene Tag : <[[OTHER]]> -err04 Falsches HTML Code, die Tags sind nicht in richtiger Ordnung geschlo�en.
Status :
[[OTHER]]
-err05 Falsches HTML Code, alle Tags sollen geschlo�en sein.
Status :
[[OTHER]]
-err06 Ladung des Bilds unm�glich [[OTHER]] -err07 Er Inhalt eines TD-Tag passt nicht nur auf einer Seite -txt01 Fehler n� -txt02 Datei : -txt03 Linie : -pdf01 Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Datei aufgebaut um [[date_h]]:[[date_m]] -pdf03 Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]] um [[date_h]]:[[date_i]] -pdf04 Seite [[current]]/[[nb]] -pdf05 Die Formulare ben�tigen Sie den Adobe Reader 9 -vue01 Seite-Header -vue02 Fu�zeile -vue03 Seite -vue04 Visualisierung +err01 Das Tag <[[OTHER]]> existiert noch nicht.

Wenn Sie es hinzufügen möchten, sollen Sie die Methodeno_[[OTHER]] (zu öffnen) und c_[[OTHER]] (zu schließen) nach dem Modell den existierenden Tags.

Wenn Sie diese Methoden außerdem aufbauen, bitte teilen Sie sie duch eine E-Mail an meine Adresse : webmaster@spipu.net, so daß sie künftig in die nächste Version von HTML2PDF erscheinen. +err02 1000-Linien Satz => zu lang
Satz : [[OTHER_0]]
Breite des Eingabefelds : [[OTHER_1]]
Länge des Texts : [[OTHER_2]]
+err03 Falsches HTML Code, überzähliges geschloßene Tag : <[[OTHER]]> +err04 Falsches HTML Code, die Tags sind nicht in richtiger Ordnung geschloßen.
Status :
[[OTHER]]
+err05 Falsches HTML Code, alle Tags sollen geschloßen sein.
Status :
[[OTHER]]
+err06 Ladung des Bilds unmöglich [[OTHER]] +err07 Er Inhalt eines TD-Tag passt nicht nur auf einer Seite +txt01 Fehler n° +txt02 Datei : +txt03 Linie : +pdf01 Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Datei aufgebaut um [[date_h]]:[[date_m]] +pdf03 Datei aufgebaut am [[date_d]]/[[date_m]]/[[date_y]] um [[date_h]]:[[date_i]] +pdf04 Seite [[current]]/[[nb]] +pdf05 Die Formulare benötigen Sie den Adobe Reader 9 +vue01 Seite-Header +vue02 Fußzeile +vue03 Seite +vue04 Visualisierung diff --git a/main/inc/lib/html2pdf/langues/en.txt b/main/inc/lib/html2pdf/langues/en.txt index 5c6a1a43e0..ce31fce629 100755 --- a/main/inc/lib/html2pdf/langues/en.txt +++ b/main/inc/lib/html2pdf/langues/en.txt @@ -1,19 +1,19 @@ -err01 The tag <[[OTHER]]> does not yet exist.

If you want to add it, you must create the methods o_[[OTHER]] (for opening) and c_[[OTHER]] (for closure) by following the model of existing tags.

If you create these methods, do not hesitate to send me an email to webmaster@spipu.net to included them in the next version of HTML2PDF. -err02 Sentence of 1000 lines => too long
Sentence : [[OTHER_0]]
Width box : [[OTHER_1]]
Length text : [[OTHER_2]]
-err03 HTML code invalid, a tag is closed too many times: <[[OTHER]]> -err04 HTML code invalid, the tags are not closed in an orderly fashion.
Status :
[[OTHER]]
-err05 HTML code invalid, all tags must be closed.
Status :
[[OTHER]]
-err06 Impossible to load the image [[OTHER]] -err07 The content of a TD tag does not fit on only one page -txt01 ERROR n� -txt02 File : -txt03 Line : -pdf01 Document generated on [[date_y]]-[[date_m]]-[[date_d]] -pdf02 Document generated at [[date_h]]:[[date_i]] -pdf03 Document generated on [[date_y]]-[[date_m]]-[[date_d]] at [[date_h]]:[[date_i]] -pdf04 Page [[current]]/[[nb]] -pdf05 The forms require the use of Adobe Reader 9 -vue01 HEADER -vue02 FOOTER -vue03 PAGE -vue04 View +err01 The tag <[[OTHER]]> does not yet exist.

If you want to add it, you must create the methods o_[[OTHER]] (for opening) and c_[[OTHER]] (for closure) by following the model of existing tags.

If you create these methods, do not hesitate to send me an email to webmaster@spipu.net to included them in the next version of HTML2PDF. +err02 Sentence of 1000 lines => too long
Sentence : [[OTHER_0]]
Width box : [[OTHER_1]]
Length text : [[OTHER_2]]
+err03 HTML code invalid, a tag is closed too many times: <[[OTHER]]> +err04 HTML code invalid, the tags are not closed in an orderly fashion.
Status :
[[OTHER]]
+err05 HTML code invalid, all tags must be closed.
Status :
[[OTHER]]
+err06 Impossible to load the image [[OTHER]] +err07 The content of a TD tag does not fit on only one page +txt01 ERROR n° +txt02 File : +txt03 Line : +pdf01 Document generated on [[date_y]]-[[date_m]]-[[date_d]] +pdf02 Document generated at [[date_h]]:[[date_i]] +pdf03 Document generated on [[date_y]]-[[date_m]]-[[date_d]] at [[date_h]]:[[date_i]] +pdf04 Page [[current]]/[[nb]] +pdf05 The forms require the use of Adobe Reader 9 +vue01 HEADER +vue02 FOOTER +vue03 PAGE +vue04 View diff --git a/main/inc/lib/html2pdf/langues/es.txt b/main/inc/lib/html2pdf/langues/es.txt index dcc4ce2f7f..b2bdf7d8ab 100755 --- a/main/inc/lib/html2pdf/langues/es.txt +++ b/main/inc/lib/html2pdf/langues/es.txt @@ -1,19 +1,19 @@ -err01 La etiqueta <[[OTHER]]> todav�a no existe.

Si quiere a�adirla, debe crear los m�todos o_[[OTHER]] (para la apertura) y c_[[OTHER]] (para el cierre) siguiendo el modelo de las etiquetas existentes.

Si crea nuevos m�todos, env�elos a webmaster@spipu.net para a�adirlos a las siguientes versiones de HTML2PDF, y que todo el mundo se pueda beneficiar. -err02 Frase de 1000 l�neas => demasiado larga
Frase : [[OTHER_0]]
Tama�o casilla : [[OTHER_1]]
Tama�o texto : [[OTHER_2]]
-err03 C�digo HTML no v�lido, una etiqueta tiene un cierre de m�s : <[[OTHER]]> -err04 C�digo HTML no v�lido, las etiquetas no estan cerradas en el orden correcto.
Estado :
[[OTHER]]
-err05 C�digo HTML no v�lido, todas las etiquetas deben tener su cierre.
Estado :
[[OTHER]]
-err06 Imposible cargar la imagen [[OTHER]] -err07 El contenido de una etiqueta TD no encaja en una sola p�gina -txt01 ERROR n� -txt02 Fichero : -txt03 L�nea : -pdf01 Documento generado el [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Documento generado a las [[date_h]]:[[date_i]] -pdf03 Documento generado el [[date_d]]/[[date_m]]/[[date_y]] a las [[date_h]]:[[date_i]] -pdf04 P�gina [[current]]/[[nb]] -pdf05 Los formularios requieren el uso de Adobe Reader 9 -vue01 ENCABEZADO -vue02 PIE DE P�GINA -vue03 P�GINA -vue04 Visualizaci�n +err01 La etiqueta <[[OTHER]]> todavía no existe.

Si quiere añadirla, debe crear los métodos o_[[OTHER]] (para la apertura) y c_[[OTHER]] (para el cierre) siguiendo el modelo de las etiquetas existentes.

Si crea nuevos métodos, envíelos a webmaster@spipu.net para añadirlos a las siguientes versiones de HTML2PDF, y que todo el mundo se pueda beneficiar. +err02 Frase de 1000 líneas => demasiado larga
Frase : [[OTHER_0]]
Tamaño casilla : [[OTHER_1]]
Tamaño texto : [[OTHER_2]]
+err03 Código HTML no válido, una etiqueta tiene un cierre de más : <[[OTHER]]> +err04 Código HTML no válido, las etiquetas no estan cerradas en el orden correcto.
Estado :
[[OTHER]]
+err05 Código HTML no válido, todas las etiquetas deben tener su cierre.
Estado :
[[OTHER]]
+err06 Imposible cargar la imagen [[OTHER]] +err07 El contenido de una etiqueta TD no encaja en una sola página +txt01 ERROR n° +txt02 Fichero : +txt03 Línea : +pdf01 Documento generado el [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Documento generado a las [[date_h]]:[[date_i]] +pdf03 Documento generado el [[date_d]]/[[date_m]]/[[date_y]] a las [[date_h]]:[[date_i]] +pdf04 Página [[current]]/[[nb]] +pdf05 Los formularios requieren el uso de Adobe Reader 9 +vue01 ENCABEZADO +vue02 PIE DE PÁGINA +vue03 PÁGINA +vue04 Visualización diff --git a/main/inc/lib/html2pdf/langues/fr.txt b/main/inc/lib/html2pdf/langues/fr.txt index 63bf6c1b14..0c9ced6c7e 100755 --- a/main/inc/lib/html2pdf/langues/fr.txt +++ b/main/inc/lib/html2pdf/langues/fr.txt @@ -1,19 +1,19 @@ -err01 La balise <[[OTHER]]> n'existe pas encore.

Si vous voulez la rajouter, vous devez cr�er les m�thodes o_[[OTHER]] (pour l'ouverture) et c_[[OTHER]] (pour la fermeture) en suivant le mod�le des balises existantes.

De plus, si vous cr�ez ces m�thodes, n'h�sitez pas � en faire profiter tout le monde en m'�crivant sur webmaster@spipu.net afin qu'elles se retrouvent dans la prochaine version d'HTML2PDF. -err02 Phrase de 1000 lignes => trop long
Phrase : [[OTHER_0]]
Largeur case : [[OTHER_1]]
Longueur text : [[OTHER_2]]
-err03 Code HTML non valide, une balise est ferm�e en trop : <[[OTHER]]> -err04 Code HTML non valide, les balises ne sont pas ferm�es dans le bon ordre.
Etat :
[[OTHER]]
-err05 Code HTML non valide, toutes les balises doivent �tre ferm�es.
Etat :
[[OTHER]]
-err06 Impossible de charger l'image [[OTHER]] -err07 le contenu d'une balise TD ne rentre pas sur une seule page -txt01 ERREUR n� -txt02 Fichier : -txt03 Ligne : -pdf01 Document g�n�r� le [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Document g�n�r� � [[date_h]]:[[date_i]] -pdf03 Document g�n�r� le [[date_d]]/[[date_m]]/[[date_y]] � [[date_h]]:[[date_i]] -pdf04 Page [[current]]/[[nb]] -pdf05 Les formulaires n�cessitent l'utilisation de Adobe Reader 9 -vue01 HEADER -vue02 FOOTER -vue03 PAGE -vue04 Restitution +err01 La balise <[[OTHER]]> n'existe pas encore.

Si vous voulez la rajouter, vous devez créer les méthodes o_[[OTHER]] (pour l'ouverture) et c_[[OTHER]] (pour la fermeture) en suivant le modèle des balises existantes.

De plus, si vous créez ces méthodes, n'hésitez pas à en faire profiter tout le monde en m'écrivant sur webmaster@spipu.net afin qu'elles se retrouvent dans la prochaine version d'HTML2PDF. +err02 Phrase de 1000 lignes => trop long
Phrase : [[OTHER_0]]
Largeur case : [[OTHER_1]]
Longueur text : [[OTHER_2]]
+err03 Code HTML non valide, une balise est fermée en trop : <[[OTHER]]> +err04 Code HTML non valide, les balises ne sont pas fermées dans le bon ordre.
Etat :
[[OTHER]]
+err05 Code HTML non valide, toutes les balises doivent être fermées.
Etat :
[[OTHER]]
+err06 Impossible de charger l'image [[OTHER]] +err07 le contenu d'une balise TD ne rentre pas sur une seule page +txt01 ERREUR n° +txt02 Fichier : +txt03 Ligne : +pdf01 Document généré le [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Document généré à [[date_h]]:[[date_i]] +pdf03 Document généré le [[date_d]]/[[date_m]]/[[date_y]] à [[date_h]]:[[date_i]] +pdf04 Page [[current]]/[[nb]] +pdf05 Les formulaires nécessitent l'utilisation de Adobe Reader 9 +vue01 HEADER +vue02 FOOTER +vue03 PAGE +vue04 Restitution diff --git a/main/inc/lib/html2pdf/langues/it.txt b/main/inc/lib/html2pdf/langues/it.txt index e70f8daae9..b5c029c45b 100755 --- a/main/inc/lib/html2pdf/langues/it.txt +++ b/main/inc/lib/html2pdf/langues/it.txt @@ -1,19 +1,19 @@ -err01 Il tag <[[OTHER]]> non esiste ancora.

Se si desidera aggiungere, � necessario creare metodi o_[[OTHER]] (di apertura) e C_[[OTHER]] (per la chiusura) secondo il modello esistente di tag.

Inoltre, se si creare questi metodi, non esitate a portare il mondo intero ha scritto su webmaster@spipu.net in modo che alla fine nella prossima versione di HTML2PDF. -err02 Citazione di 1000 linee => troppo lungo
frase : [[OTHER_0]]
casella Larghezza : [[OTHER_1]]
Lunghezza testo : [[OTHER_2]]
-err03 HTML non valido, un tag � chiusa troppo <[[OTHER]]> -err04 HTML non validi, i tag non sono chiusi nel corretto ordine.
Stato :
[[OTHER]]
-err05 HTML non valido, tutte le tag deve essere chiuso.
Stato :
[[OTHER]]
-err06 Impossibile caricare l'immagine [[OTHER]] -err07 il contenuto di un tag TD non rientra in una sola pagina -txt01 ERRORE n� -txt02 File : -txt03 Linea : -pdf01 Documento generato il [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Documento generato [[date_h]]:[[date_i]] -pdf03 Documento generato il [[date_d]]/[[date_m]]/[[date_y]] nel [[date_h]]:[[date_i]] -pdf04 Pagina [[current]]/[[nb]] -pdf05 I moduli richiedono l'uso di Adobe Reader 9 -vue01 HEADER -vue02 FOOTER -vue03 PAGINA -vue04 Visualization +err01 Il tag <[[OTHER]]> non esiste ancora.

Se si desidera aggiungere, è necessario creare metodi o_[[OTHER]] (di apertura) e C_[[OTHER]] (per la chiusura) secondo il modello esistente di tag.

Inoltre, se si creare questi metodi, non esitate a portare il mondo intero ha scritto su webmaster@spipu.net in modo che alla fine nella prossima versione di HTML2PDF. +err02 Citazione di 1000 linee => troppo lungo
frase : [[OTHER_0]]
casella Larghezza : [[OTHER_1]]
Lunghezza testo : [[OTHER_2]]
+err03 HTML non valido, un tag è chiusa troppo <[[OTHER]]> +err04 HTML non validi, i tag non sono chiusi nel corretto ordine.
Stato :
[[OTHER]]
+err05 HTML non valido, tutte le tag deve essere chiuso.
Stato :
[[OTHER]]
+err06 Impossibile caricare l'immagine [[OTHER]] +err07 il contenuto di un tag TD non rientra in una sola pagina +txt01 ERRORE n° +txt02 File : +txt03 Linea : +pdf01 Documento generato il [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Documento generato [[date_h]]:[[date_i]] +pdf03 Documento generato il [[date_d]]/[[date_m]]/[[date_y]] nel [[date_h]]:[[date_i]] +pdf04 Pagina [[current]]/[[nb]] +pdf05 I moduli richiedono l'uso di Adobe Reader 9 +vue01 HEADER +vue02 FOOTER +vue03 PAGINA +vue04 Visualization diff --git a/main/inc/lib/html2pdf/langues/nl.txt b/main/inc/lib/html2pdf/langues/nl.txt index 5cea0a5514..18b82a11d7 100755 --- a/main/inc/lib/html2pdf/langues/nl.txt +++ b/main/inc/lib/html2pdf/langues/nl.txt @@ -1,19 +1,19 @@ -err01 De tag <[[OTHER]]> bestaat nog niet.

Om deze toe te voegen, gebruik de methods o_[[OTHER]] (om te openen) en c_[[OTHER]] (om te sluiten) volgens het model van de bestaande tags.

Als u deze methods maakt, stuur deze dan a.u.b. via e-mail naar webmaster@spipu.net voor opname in de volgende versie van HTML2PDF. -err02 Zin van 1000 regels => te lang
Zin : [[OTHER_0]]
Kaderbreedte : [[OTHER_1]]
Tekstlengte : [[OTHER_2]]
-err03 Ongeldige HTML code, overvloedig afgesloten tag : <[[OTHER]]> -err04 Ongeldige HTML code, de tags zijn niet correct afgesloten.
Status :
[[OTHER]]
-err05 Ongeldige HTML code, alle tags dienen te zijn gesloten.
Status :
[[OTHER]]
-err06 Kan afbeelding niet laden: [[OTHER]] -err07 De inhoud van de cel () past niet op een pagina -txt01 Fout nr -txt02 Bestand : -txt03 Regel : -pdf01 Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]] -pdf02 Document gemaakt om [[date_h]]:[[date_i]] -pdf03 Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]] om [[date_h]]:[[date_i]] -pdf04 Pagina [[current]] van [[nb]] -pdf05 De formulieren vereisen het gebruik van Adobe Reader 9 -vue01 Paginakop -vue02 Paginavoet -vue03 Pagina -vue04 Bekijken +err01 De tag <[[OTHER]]> bestaat nog niet.

Om deze toe te voegen, gebruik de methods o_[[OTHER]] (om te openen) en c_[[OTHER]] (om te sluiten) volgens het model van de bestaande tags.

Als u deze methods maakt, stuur deze dan a.u.b. via e-mail naar webmaster@spipu.net voor opname in de volgende versie van HTML2PDF. +err02 Zin van 1000 regels => te lang
Zin : [[OTHER_0]]
Kaderbreedte : [[OTHER_1]]
Tekstlengte : [[OTHER_2]]
+err03 Ongeldige HTML code, overvloedig afgesloten tag : <[[OTHER]]> +err04 Ongeldige HTML code, de tags zijn niet correct afgesloten.
Status :
[[OTHER]]
+err05 Ongeldige HTML code, alle tags dienen te zijn gesloten.
Status :
[[OTHER]]
+err06 Kan afbeelding niet laden: [[OTHER]] +err07 De inhoud van de cel () past niet op een pagina +txt01 Fout nr +txt02 Bestand : +txt03 Regel : +pdf01 Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]] +pdf02 Document gemaakt om [[date_h]]:[[date_i]] +pdf03 Document gemaakt op [[date_d]]-[[date_m]]-[[date_y]] om [[date_h]]:[[date_i]] +pdf04 Pagina [[current]] van [[nb]] +pdf05 De formulieren vereisen het gebruik van Adobe Reader 9 +vue01 Paginakop +vue02 Paginavoet +vue03 Pagina +vue04 Bekijken diff --git a/main/inc/lib/html2pdf/langues/pt.txt b/main/inc/lib/html2pdf/langues/pt.txt index b0def8f16f..0bd6bef750 100755 --- a/main/inc/lib/html2pdf/langues/pt.txt +++ b/main/inc/lib/html2pdf/langues/pt.txt @@ -1,19 +1,19 @@ -err01 A tag <[[OTHER]]> ainda n�o existe.

Se voc� quer inser�-la, deve criar os m�todos o_[[OTHER]] (para abr�-la) e c_[[OTHER]] (para fech�-la) seguindo o modelo das tags existentes.

Se voc� criar novos m�todos, os envie para webmaster@spipu.net para que as pr�ximas vers�es de HTML2PDF, e o restante do mundo se beneficie com isso. -err02 Frase de 1000 linhas => muito grande
Frase : [[OTHER_0]]
Tamanho do quadro : [[OTHER_1]]
Tamanho do texto : [[OTHER_2]]
-err03 C�digo HTML n�o v�lido, uma tag est� com fechamento sobrando : <[[OTHER]]> -err04 C�digo HTML n�o v�lido, as tags n�o est�o fechadas na ordem correta.
Estado :
[[OTHER]]
-err05 C�digo HTML n�o v�lido, todas as tags devem ser fechadas.
Estado :
[[OTHER]]
-err06 Imposs�vel carregar imagem [[OTHER]] -err07 O conte�do de uma tag TD n�o se encaixa em apenas uma p�gina -txt01 ERRO n� -txt02 Arquivo : -txt03 Linha : -pdf01 Documento generado em [[date_d]]/[[date_m]]/[[date_y]] -pdf02 Documento generado �s [[date_h]]:[[date_i]] -pdf03 Documento generado em [[date_d]]/[[date_m]]/[[date_y]] �s [[date_h]]:[[date_i]] -pdf04 P�gina [[current]]/[[nb]] -pdf05 Os formul�rios exigem a utiliza��o do Adobe Reader 9 -vue01 CABE�ALHO -vue02 RODAP� -vue03 P�GINA -vue04 Visualiza��o +err01 A tag <[[OTHER]]> ainda não existe.

Se você quer inserí-la, deve criar os métodos o_[[OTHER]] (para abrí-la) e c_[[OTHER]] (para fechá-la) seguindo o modelo das tags existentes.

Se você criar novos métodos, os envie para webmaster@spipu.net para que as próximas versões de HTML2PDF, e o restante do mundo se beneficie com isso. +err02 Frase de 1000 linhas => muito grande
Frase : [[OTHER_0]]
Tamanho do quadro : [[OTHER_1]]
Tamanho do texto : [[OTHER_2]]
+err03 Código HTML não válido, uma tag está com fechamento sobrando : <[[OTHER]]> +err04 Código HTML não válido, as tags não estão fechadas na ordem correta.
Estado :
[[OTHER]]
+err05 Código HTML não válido, todas as tags devem ser fechadas.
Estado :
[[OTHER]]
+err06 Impossível carregar imagem [[OTHER]] +err07 O conteúdo de uma tag TD não se encaixa em apenas uma página +txt01 ERRO n° +txt02 Arquivo : +txt03 Linha : +pdf01 Documento generado em [[date_d]]/[[date_m]]/[[date_y]] +pdf02 Documento generado às [[date_h]]:[[date_i]] +pdf03 Documento generado em [[date_d]]/[[date_m]]/[[date_y]] às [[date_h]]:[[date_i]] +pdf04 Página [[current]]/[[nb]] +pdf05 Os formulários exigem a utilização do Adobe Reader 9 +vue01 CABEÇALHO +vue02 RODAPÉ +vue03 PÁGINA +vue04 Visualização diff --git a/main/inc/lib/html2pdf/langues/tr.txt b/main/inc/lib/html2pdf/langues/tr.txt index ad6861473b..3a239c7366 100755 --- a/main/inc/lib/html2pdf/langues/tr.txt +++ b/main/inc/lib/html2pdf/langues/tr.txt @@ -1,19 +1,19 @@ -err01 <[[OTHER]]> etiketi bulunamad�.

Eklemek isterseniz, o_[[OTHER]] �eklinde a��p, c_[[OTHER]] �eklinde kapatabilirsiniz.

Bu �ekilde etiketler �retirseniz l�tfen daha sonraki HTML2PDF versiyonuna eklenmek �zere bana g�nderin. ( webmaster@spipu.net ). -err02 ��erik 1000 sat�rdan fazla ve gerekenden uzun
Konu : [[OTHER_0]]
Geni�lik : [[OTHER_1]]
Yaz� boyutu : [[OTHER_2]]
-err03 HTML kodu hatal�, etiket birden fazla defa kapat�lm��: <[[OTHER]]> -err04 HTML kodu hatal�, etiketler gereken d�zen i�inde kapat�lmam��.
Durum :
[[OTHER]]
-err05 HTML kodu hatal�, b�t�n etiketler kapat�lmal�.
Durum :
[[OTHER]]
-err06 Resim dosyas� okunam�yor [[OTHER]] -err07 TD i�eri�i bir sayfaya s��m�yor -txt01 HATA n� -txt02 Dosya : -txt03 Sat�r : -pdf01 Dok�man �retilme tarihi [[date_y]]-[[date_m]]-[[date_d]] -pdf02 Dok�man �retilme tarihi [[date_h]]:[[date_i]] -pdf03 Dok�man �retilme tarihi [[date_y]]-[[date_m]]-[[date_d]] saati [[date_h]]:[[date_i]] -pdf04 Sayfa [[current]]/[[nb]] -pdf05 Adobe Reader 9 gerektirir -vue01 DOSYA �ST� -vue02 DOSYA ALTI -vue03 SAYFA -vue04 G�r�n� \ No newline at end of file +err01 <[[OTHER]]> etiketi bulunamadý.

Eklemek isterseniz, o_[[OTHER]] þeklinde açýp, c_[[OTHER]] þeklinde kapatabilirsiniz.

Bu þekilde etiketler üretirseniz lütfen daha sonraki HTML2PDF versiyonuna eklenmek üzere bana gönderin. ( webmaster@spipu.net ). +err02 Ýçerik 1000 satýrdan fazla ve gerekenden uzun
Konu : [[OTHER_0]]
Geniþlik : [[OTHER_1]]
Yazý boyutu : [[OTHER_2]]
+err03 HTML kodu hatalý, etiket birden fazla defa kapatýlmýþ: <[[OTHER]]> +err04 HTML kodu hatalý, etiketler gereken düzen içinde kapatýlmamýþ.
Durum :
[[OTHER]]
+err05 HTML kodu hatalý, bütün etiketler kapatýlmalý.
Durum :
[[OTHER]]
+err06 Resim dosyasý okunamýyor [[OTHER]] +err07 TD içeriði bir sayfaya sýðmýyor +txt01 HATA n° +txt02 Dosya : +txt03 Satýr : +pdf01 Doküman üretilme tarihi [[date_y]]-[[date_m]]-[[date_d]] +pdf02 Doküman üretilme tarihi [[date_h]]:[[date_i]] +pdf03 Doküman üretilme tarihi [[date_y]]-[[date_m]]-[[date_d]] saati [[date_h]]:[[date_i]] +pdf04 Sayfa [[current]]/[[nb]] +pdf05 Adobe Reader 9 gerektirir +vue01 DOSYA ÜSTÜ +vue02 DOSYA ALTI +vue03 SAYFA +vue04 Görünüm diff --git a/main/inc/lib/html2pdf/parsingHTML.class.php b/main/inc/lib/html2pdf/parsingHTML.class.php index e9e461048d..b63a132cbc 100755 --- a/main/inc/lib/html2pdf/parsingHTML.class.php +++ b/main/inc/lib/html2pdf/parsingHTML.class.php @@ -1,421 +1,440 @@ - PDF, utilise fpdf de Olivier PLATHEY - * Distribu� sous la licence LGPL. - * - * @author Laurent MINGUET - * @version 3.24 - 05/08/2009 - */ - -if (!defined('__CLASS_PARSINGHTML__')) -{ - define('__CLASS_PARSINGHTML__', true); - - class parsingHTML - { - var $html = ''; // code HTML � parser - var $code = array(); // code HTML pars� - var $num = 0; // num�ro de table - var $level = 0; // niveaux de table - - /** - * Constructeur - * - * @return null - */ - function parsingHTML() - { - $this->num = 0; - $this->level = array($this->num); - $this->html = ''; - $this->code = array(); - } - - /** - * D�finir le code HTML � parser - * - * @param string code html - * @return null - */ - function setHTML($html) - { - $html = preg_replace('//isU', '', $html); - $this->html = $html; - } - - /** - * parser le code HTML - * - * @return null - */ - function parse() - { - $parents = array(); - // r�cup�rer le code � parser - $content = $this->html; - - // chercher les balises HTML du code - $tmp = array(); - $this->searchCode($content, $tmp); - - // identifier les balises une � une - $pre_in = false; - $pre_br = array( - 'name' => 'br', - 'close' => false, - 'param' => array( - 'style' => array(), - 'num' => 0 - ) - ); - - $todos = array(); - foreach($tmp as $part) - { - // si c'est un texte - if ($part[0]=='txt') - { - // enregistrer l'action correspondante - if (!$pre_in) - { - if (trim($part[1])!=='') - { - // remplacer tous les espaces, tabulations, saufs de ligne multiples par de simples espaces - $part[1] = preg_replace('/([\s]+)/is', ' ', $part[1]); - - $todos[] = array( - 'name' => 'write', - 'close' => false, - 'param' => array('txt' => $part[1]), - ); - } - } - else - { - $part[1] = str_replace("\r", '', $part[1]); - $part[1] = explode("\n", $part[1]); - - foreach($part[1] as $k => $txt) - { - $txt = str_replace("\t", ' ', $txt); - $txt = str_replace(' ', ' ', $txt); - if ($k>0) $todos[] = $pre_br; - - $todos[] = array( - 'name' => 'write', - 'close' => false, - 'param' => array('txt' => $txt), - ); - } - } - } - // sinon, analyser le code - else - { - $res = $this->analiseCode($part[1]); - if ($res) - { - if (!in_array($res['name'], array('br', 'hr', 'img', 'input', 'link', 'option'))) - { - if ($res['close']) - { - if (count($parents)<1) - @HTML2PDF::makeError(3, __FILE__, __LINE__, $res['name']); - else if ($parents[count($parents)-1]!=$res['name']) - @HTML2PDF::makeError(4, __FILE__, __LINE__, $parents); - else - unset($parents[count($parents)-1]); - } - else - { - $parents[count($parents)] = $res['name']; - } - } - if ($res['name']=='pre' || $res['name']=='code') - { - $pre_in = !$res['close']; - } - $todos[] = $res; - } - } - } - - // pour chaque action identifi�e, il faut nettoyer le d�but et la fin des textes - // en fonction des balises qui l'entourent. - $nb = count($todos); - for($k=0; $k<$nb; $k++) - { - //si c'est un texte - if ($todos[$k]['name']=='write') - { - // et qu'une balise sp�cifique le pr�c�de => on nettoye les espaces du d�but du texte - if ($k>0 && in_array($todos[$k-1]['name'], array('table', 'tr', 'td', 'th', 'br', 'div', 'hr', 'p', 'ul', 'ol', 'li'))) - $todos[$k]['param']['txt'] = preg_replace('/^([\s]*)([^\s])/isU', '$2', $todos[$k]['param']['txt']); - - // et qu'une balise sp�cifique le suit => on nettoye les espaces de la fin du texte - if ($kcode = $todos; - } - - /** - * parser le code HTML - * - * @param string contenu � parser. - * @param &array tableau de retour des donn�es - * @return null - */ - function searchCode($content, &$tmp) - { - // s�parer les balises du texte - $tmp = array(); - $reg = '/(<[^>]+>)|([^<]+)+/isU'; - - // pour chaque �l�ment trouv� : - $str = ''; - $offset = 0; - while(preg_match($reg, $content, $parse, PREG_OFFSET_CAPTURE, $offset)) - { - // si une balise a �t� d�tect�e - if ($parse[1][0]) - { - // sauvegarde du texte pr�c�dent si il existe - if ($str!=='') $tmp[] = array('txt',$str); - - // sauvegarde de la balise - $tmp[] = array('code',trim($parse[1][0])); - - // initialisation du texte suivant - $str = ''; - } - else - { - // ajout du texte � la fin de celui qui est d�j� d�tect� - $str.= $parse[2][0]; - } - // Update offset to the end of the match - $offset = $parse[0][1] + strlen($parse[0][0]); - unset($parse); - } - // si un texte est pr�sent � la fin, on l'enregistre - if ($str!='') $tmp[] = array('txt',$str); - unset($str); - } - - /** - * analyse une balise HTML - * - * @param string code HTML � identifier - * @return array action correspondante - */ - function analiseCode($code) - { - // nom de la balise et ouverture ou fermeture - $balise = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)'; - preg_match('/'.$balise.'/isU', $code, $match); - $close = ($match[1]=='/' ? true : false); - $name = strtolower($match[2]); - - // param�tres obligatoires en fonction du nom de la balise - $param = array(); - $param['style'] = ''; - if ($name=='img') { $param['alt'] = ''; $param['src'] = ''; } - if ($name=='a') { $param['href'] = ''; } - - // lecture des param�tres du type nom=valeur - $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; - preg_match_all('/'.$prop.'/is', $code, $match); - for($k=0; $k $val) - { - $key = strtolower($key); - switch($key) - { - case 'width': - unset($param[$key]); - $param['style'] = 'width: '.$val.'px; '.$param['style']; - break; - - case 'align': - if ($name!=='table') - { - unset($param[$key]); - $param['style'] = 'text-align: '.$val.'; '.$param['style']; - } - break; - - case 'valign': - unset($param[$key]); - $param['style'] = 'vertical-align: '.$val.'; '.$param['style']; - break; - - case 'height': - unset($param[$key]); - $param['style'] = 'height: '.$val.'px; '.$param['style']; - break; - - case 'bgcolor': - unset($param[$key]); - $param['style'] = 'background: '.$val.'; '.$param['style']; - break; - - case 'bordercolor': - unset($param[$key]); - $color = $val; - break; - - case 'border': - unset($param[$key]); - if (preg_match('/^[0-9]$/isU', $val)) $val = $val.'px'; - $border = $val; - break; - - case 'cellpadding': - case 'cellspacing': - if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px'; - break; - - case 'colspan': - case 'rowspan': - $val = preg_replace('/[^0-9]/isU', '', $val); - if (!$val) $val = 1; - $param[$key] = $val; - break; - } - } - if ($border!==null) - { - if ($border) $param['style'] = 'border: solid '.$border.' '.$color.'; '.$param['style']; - else $param['style'] = 'border: none'; - } - - // lecture des styles - d�composition - $styles = explode(';', $param['style']); - $param['style'] = array(); - foreach($styles as $style) - { - $tmp = explode(':', $style); - if (count($tmp)>1) - { - $cod = $tmp[0]; unset($tmp[0]); $tmp = implode(':', $tmp); - $param['style'][trim(strtolower($cod))] = preg_replace('/[\s]+/isU', ' ', trim($tmp)); - } - } - - // d�termination du niveau de table pour les ouverture, avec ajout d'un level - if (in_array($name, array('ul', 'ol', 'table')) && !$close) - { - $this->num++; - $this->level[count($this->level)] = $this->num; - } - - // attribution du niveau de table o� se trouve l'�l�ment - if (!isset($param['num'])) $param['num'] = $this->level[count($this->level)-1]; - - // pour les fins de table : suppression d'un level - if (in_array($name, array('ul', 'ol', 'table')) && $close) - { - unset($this->level[count($this->level)-1]); - } - - // retour de l'action identifi�e - return array('name' => $name, 'close' => $close ? 1 : 0, 'param' => $param); - } - - // r�cup�rer un niveau complet d'HTML entre une ouverture de balise et la fermeture correspondante - function getLevel($k) - { - // si le code n'existe pas : fin - if (!isset($this->code[$k])) return ''; - - // quelle balise faudra-t-il d�tecter - $detect = $this->code[$k]['name']; - - $level = 0; // niveau de profondeur - $end = false; // etat de fin de recherche - $code = ''; // code extrait - - // tant que c'est pas fini, on boucle - while (!$end) - { - // action courante - $row = $this->code[$k]; - - // si write => on ajoute le texte - if ($row['name']=='write') - { - $code.= $row['param']['txt']; - } - // sinon, c'est une balise html - else - { - $not = false; // indicateur de non prise en compte de la balise courante - - // si c'est la balise que l'on cherche - if ($row['name']==$detect) - { - if ($level==0) { $not = true; } // si on est � la premiere balise : on l'ignore - $level+= ($row['close'] ? -1 : 1); // modification du niveau en cours en fonction de l'ouvertre / fermeture - if ($level==0) { $not = true; $end = true; } // si on est au niveau 0 : on a fini - } - - // si on doit prendre en compte la balise courante - if (!$not) - { - // ecriture du code HTML de la balise - $code.= '<'.($row['close'] ? '/' : '').$row['name']; - foreach($row['param'] as $key => $val) - { - if ($key=='style') - { - $tmp = ''; - if (isset($val['text-align'])) unset($val['text-align']); - foreach($val as $ks => $vs) $tmp.= $ks.':'.$vs.'; '; - if (trim($tmp)) $code.= ' '.$key.'="'.$tmp.'"'; - } - else - { - $code.= ' '.$key.'="'.$val.'"'; - } - } - $code.= '>'; - } - } - - // on continue tant qu'il y a du code � analyser... - if (isset($this->code[$k+1])) - $k++; - else - $end = true; - } - - // retourne la position finale et le code HTML extrait - return array($k, $code); - } - } -} -?> \ No newline at end of file + PDF, utilise fpdf de Olivier PLATHEY + * Distribué sous la licence LGPL. + * + * @author Laurent MINGUET + * @version 3.26 - 16/11/2009 + */ + +if (!defined('__CLASS_PARSINGHTML__')) +{ + define('__CLASS_PARSINGHTML__', true); + + class parsingHTML + { + var $html = ''; // code HTML à parser + var $code = array(); // code HTML parsé + var $num = 0; // numéro de table + var $level = 0; // niveaux de table + + /** + * Constructeur + * + * @return null + */ + function parsingHTML() + { + $this->num = 0; + $this->level = array($this->num); + $this->html = ''; + $this->code = array(); + } + + /** + * Définir le code HTML à parser + * + * @param string code html + * @return null + */ + function setHTML($html) + { + $html = preg_replace('//isU', '', $html); + $this->html = $html; + } + + /** + * parser le code HTML + * + * @return null + */ + function parse() + { + $parents = array(); + + // chercher les balises HTML du code + $tmp = array(); + $this->searchCode($tmp); + + // identifier les balises une à une + $pre_in = false; + $pre_br = array( + 'name' => 'br', + 'close' => false, + 'param' => array( + 'style' => array(), + 'num' => 0 + ) + ); + + $balises_no_closed = array('br', 'hr', 'img', 'input', 'link', 'option', 'col'); + $todos = array(); + foreach($tmp as $part) + { + // si c'est un texte + if ($part[0]=='txt') + { + // enregistrer l'action correspondante + if (!$pre_in) + { +// if (trim($part[1])!=='') +// { + // remplacer tous les espaces, tabulations, saufs de ligne multiples par de simples espaces + $part[1] = preg_replace('/([\s]+)/is', ' ', $part[1]); + + $todos[] = array( + 'name' => 'write', + 'close' => false, + 'param' => array('txt' => $part[1]), + ); +// } + } + else + { + $part[1] = str_replace("\r", '', $part[1]); + $part[1] = explode("\n", $part[1]); + + foreach($part[1] as $k => $txt) + { + $txt = str_replace("\t", ' ', $txt); + $txt = str_replace(' ', ' ', $txt); + if ($k>0) $todos[] = $pre_br; + + $todos[] = array( + 'name' => 'write', + 'close' => false, + 'param' => array('txt' => $txt), + ); + } + } + } + // sinon, analyser le code + else + { + $res = $this->analiseCode($part[1]); + if ($res) + { + $res['html_pos'] = $part[2]; + if (!in_array($res['name'], $balises_no_closed)) + { + if ($res['close']) + { + if (count($parents)<1) + @HTML2PDF::makeError(3, __FILE__, __LINE__, $res['name'], $this->getHtmlErrorCode($res['html_pos'])); + else if ($parents[count($parents)-1]!=$res['name']) + @HTML2PDF::makeError(4, __FILE__, __LINE__, $parents, $this->getHtmlErrorCode($res['html_pos'])); + else + unset($parents[count($parents)-1]); + } + else + { + if ($res['autoclose']) + { + $todos[] = $res; + $res['params'] = array(); + $res['close'] = true; + } + else + $parents[count($parents)] = $res['name']; + + } + if (($res['name']=='pre' || $res['name']=='code') && !$res['autoclose']) + $pre_in = !$res['close']; + } + + $todos[] = $res; + } + } + } + + // pour chaque action identifiée, il faut nettoyer le début et la fin des textes + // en fonction des balises qui l'entourent. + $balises_clean = array('page', 'page_header', 'page_footer', 'form', + 'table', 'thead', 'tfoot', 'tr', 'td', 'th', 'br', + 'div', 'hr', 'p', 'ul', 'ol', 'li', + 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', + 'bookmark'); + $nb = count($todos); + for($k=0; $k<$nb; $k++) + { + //si c'est un texte + if ($todos[$k]['name']=='write') + { + // et qu'une balise spécifique le précède => on nettoye les espaces du début du texte + if ($k>0 && in_array($todos[$k-1]['name'], $balises_clean)) + $todos[$k]['param']['txt'] = ltrim($todos[$k]['param']['txt']); + + // et qu'une balise spécifique le suit => on nettoye les espaces de la fin du texte + if ($kcode = array_values($todos);; + } + + /** + * parser le code HTML + * + * @param &array tableau de retour des données + * @return null + */ + function searchCode(&$tmp) + { + // séparer les balises du texte + $tmp = array(); + $reg = '/(<[^>]+>)|([^<]+)+/isU'; + + // pour chaque élément trouvé : + $str = ''; + $offset = 0; + while(preg_match($reg, $this->html, $parse, PREG_OFFSET_CAPTURE, $offset)) + { + // si une balise a été détectée + if ($parse[1][0]) + { + // sauvegarde du texte précédent si il existe + if ($str!=='') $tmp[] = array('txt',$str); + + // sauvegarde de la balise + $tmp[] = array('code',trim($parse[1][0]), $offset); + + // initialisation du texte suivant + $str = ''; + } + else + { + // ajout du texte à la fin de celui qui est déjà détecté + $str.= $parse[2][0]; + } + // Update offset to the end of the match + $offset = $parse[0][1] + strlen($parse[0][0]); + unset($parse); + } + // si un texte est présent à la fin, on l'enregistre + if ($str!='') $tmp[] = array('txt',$str); + unset($str); + } + + /** + * analyse une balise HTML + * + * @param string code HTML à identifier + * @return array action correspondante + */ + function analiseCode($code) + { + // nom de la balise et ouverture ou fermeture + $balise = '<([\/]{0,1})([_a-z0-9]+)([\/>\s]+)'; + preg_match('/'.$balise.'/isU', $code, $match); + $close = ($match[1]=='/' ? true : false); + $autoclose = preg_match('/\/>$/isU', $code); + $name = strtolower($match[2]); + + // paramètres obligatoires en fonction du nom de la balise + $param = array(); + $param['style'] = ''; + if ($name=='img') { $param['alt'] = ''; $param['src'] = ''; } + if ($name=='a') { $param['href'] = ''; } + + // lecture des paramétres du type nom=valeur + $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; + preg_match_all('/'.$prop.'/is', $code, $match); + for($k=0; $k $val) + { + $key = strtolower($key); + switch($key) + { + case 'width': + unset($param[$key]); + $param['style'] = 'width: '.$val.'px; '.$param['style']; + break; + + case 'align': + if ($name!=='table') + { + unset($param[$key]); + $param['style'] = 'text-align: '.$val.'; '.$param['style']; + } + break; + + case 'valign': + unset($param[$key]); + $param['style'] = 'vertical-align: '.$val.'; '.$param['style']; + break; + + case 'height': + unset($param[$key]); + $param['style'] = 'height: '.$val.'px; '.$param['style']; + break; + + case 'bgcolor': + unset($param[$key]); + $param['style'] = 'background: '.$val.'; '.$param['style']; + break; + + case 'bordercolor': + unset($param[$key]); + $color = $val; + break; + + case 'border': + unset($param[$key]); + if (preg_match('/^[0-9]$/isU', $val)) $val = $val.'px'; + $border = $val; + break; + + case 'cellpadding': + case 'cellspacing': + if (preg_match('/^([0-9]+)$/isU', $val)) $param[$key] = $val.'px'; + break; + + case 'colspan': + case 'rowspan': + $val = preg_replace('/[^0-9]/isU', '', $val); + if (!$val) $val = 1; + $param[$key] = $val; + break; + } + } + if ($border!==null) + { + if ($border) $param['style'] = 'border: solid '.$border.' '.$color.'; '.$param['style']; + else $param['style'] = 'border: none'.$param['style']; + } + + // lecture des styles - décomposition + $styles = explode(';', $param['style']); + $param['style'] = array(); + foreach($styles as $style) + { + $tmp = explode(':', $style); + if (count($tmp)>1) + { + $cod = $tmp[0]; unset($tmp[0]); $tmp = implode(':', $tmp); + $param['style'][trim(strtolower($cod))] = preg_replace('/[\s]+/isU', ' ', trim($tmp)); + } + } + + // détermination du niveau de table pour les ouverture, avec ajout d'un level + if (in_array($name, array('ul', 'ol', 'table')) && !$close) + { + $this->num++; + $this->level[count($this->level)] = $this->num; + } + + // attribution du niveau de table où se trouve l'élément + if (!isset($param['num'])) $param['num'] = $this->level[count($this->level)-1]; + + // pour les fins de table : suppression d'un level + if (in_array($name, array('ul', 'ol', 'table')) && $close) + { + unset($this->level[count($this->level)-1]); + } + + // retour de l'action identifiée + return array('name' => $name, 'close' => $close ? 1 : 0, 'autoclose' => $autoclose, 'param' => $param); + } + + // récupérer un niveau complet d'HTML entre une ouverture de balise et la fermeture correspondante + function getLevel($k) + { + // si le code n'existe pas : fin + if (!isset($this->code[$k])) return ''; + + // quelle balise faudra-t-il détecter + $detect = $this->code[$k]['name']; + + $level = 0; // niveau de profondeur + $end = false; // etat de fin de recherche + $code = ''; // code extrait + + // tant que c'est pas fini, on boucle + while (!$end) + { + // action courante + $row = $this->code[$k]; + + // si write => on ajoute le texte + if ($row['name']=='write') + { + $code.= $row['param']['txt']; + } + // sinon, c'est une balise html + else + { + $not = false; // indicateur de non prise en compte de la balise courante + + // si c'est la balise que l'on cherche + if ($row['name']==$detect) + { + if ($level==0) { $not = true; } // si on est à la premiere balise : on l'ignore + $level+= ($row['close'] ? -1 : 1); // modification du niveau en cours en fonction de l'ouvertre / fermeture + if ($level==0) { $not = true; $end = true; } // si on est au niveau 0 : on a fini + } + + // si on doit prendre en compte la balise courante + if (!$not) + { + // ecriture du code HTML de la balise + $code.= '<'.($row['close'] ? '/' : '').$row['name']; + foreach($row['param'] as $key => $val) + { + if ($key=='style') + { + $tmp = ''; + if (isset($val['text-align'])) unset($val['text-align']); + foreach($val as $ks => $vs) $tmp.= $ks.':'.$vs.'; '; + if (trim($tmp)) $code.= ' '.$key.'="'.$tmp.'"'; + } + else + { + $code.= ' '.$key.'="'.$val.'"'; + } + } + $code.= '>'; + } + } + + // on continue tant qu'il y a du code à analyser... + if (isset($this->code[$k+1])) + $k++; + else + $end = true; + } + + // retourne la position finale et le code HTML extrait + return array($k, $code); + } + + function getHtmlErrorCode($pos) + { + return substr($this->html, $pos-30, 70); + } + } +} diff --git a/main/inc/lib/html2pdf/qrcode/qrcode.class.php b/main/inc/lib/html2pdf/qrcode/qrcode.class.php new file mode 100644 index 0000000000..0ba47b3102 --- /dev/null +++ b/main/inc/lib/html2pdf/qrcode/qrcode.class.php @@ -0,0 +1,47 @@ +=0.97" (sous licence LGPL) + * a cette adresse : http://prgm.spipu.net/php_qrcode + * et mettre tout son contenu dans ce repertoire (qrcode) + * en remplacant également ce fichier (qrcode.class.php) + * + * WARNING: + * You have to download the librairy "QR-code generator >=0.97" (under LGPL licence) + * at this url : http://prgm.spipu.net/php_qrcode + * and to put all his content in this folder (qrcode) + * and to replace also this file (qrcode.class.php) + */ + +if (!defined('__CLASS_QRCODE__')) +{ + define('__CLASS_QRCODE__', true); + + class QRcode + { + public function __construct($value, $level='L') + { + echo ' +
+	ATTENTION : 
+		Vous devez télécharger la librairie "QR-code generator >=0.97" (sous licence LGPL)
+ 		a cette adresse : http://prgm.spipu.net/php_qrcode
+ 		et mettre tout son contenu dans ce repertoire : '.dirname(__FILE__).'
+ 		en remplacant également ce fichier : '.basename(__FILE__).'
+ 		
+ 	WARNING: 
+ 		You have to download the librairy "QR-code generator >=0.97" (under LGPL licence)
+ 		at this url : http://prgm.spipu.net/php_qrcode
+ 		and to put all his contents in this folder '.dirname(__FILE__).'
+ 		and to replace also this file : '.basename(__FILE__).'
+ 
'; + exit; + } + + public function getQrSize() { return 0; } + public function disableBorder() { } + public function displayFPDF(&$fpdf, $x, $y, $s, $background=array(255,255,255), $color=array(0,0,0)) { return true; } + public function displayHTML() { return true; } + public function displayPNG($s=4, $background=array(255,255,255), $color=array(0,0,0), $filename = null, $quality = 0) { return true; } + } +} \ No newline at end of file diff --git a/main/inc/lib/html2pdf/styleHTML.class.php b/main/inc/lib/html2pdf/styleHTML.class.php index efa5705a15..3e40e49307 100755 --- a/main/inc/lib/html2pdf/styleHTML.class.php +++ b/main/inc/lib/html2pdf/styleHTML.class.php @@ -1,1456 +1,1536 @@ - PDF, utilise fpdf de Olivier PLATHEY - * Distribu� sous la licence LGPL. - * - * @author Laurent MINGUET - * @version 3.24 - 05/08/2009 - */ - -if (!defined('__CLASS_STYLEHTML__')) -{ - define('__CLASS_STYLEHTML__', true); - - class styleHTML - { - var $css = array(); // tableau des CSS - var $css_keys = array(); // tableau des clefs CSS, pour l'ordre d'execution - var $value = array(); // valeurs actuelles - var $table = array(); // tableau d'empilement pour historisation des niveaux - var $pdf = null; // r�f�rence au PDF parent - var $htmlColor = array(); // liste des couleurs HTML - var $onlyLeft = false; // indique si on est dans un sous HTML et qu'on bloque � gauche - - /** - * Constructeur - * - * @param &pdf r�f�rence � l'objet HTML2PDF parent - * @return null - */ - function styleHTML(&$pdf) - { - $this->init(); // initialisation - $this->pdf = &$pdf; - } - - /** - * Initialisation du style - * - * @return null - */ - function init() - { - $color = array(); - $color['AliceBlue'] = '#F0F8FF'; - $color['AntiqueWhite'] = '#FAEBD7'; - $color['Aqua'] = '#00FFFF'; - $color['Aquamarine'] = '#7FFFD4'; - $color['Azure'] = '#F0FFFF'; - $color['Beige'] = '#F5F5DC'; - $color['Bisque'] = '#FFE4C4'; - $color['Black'] = '#000000'; - $color['BlanchedAlmond'] = '#FFEBCD'; - $color['Blue'] = '#0000FF'; - $color['BlueViolet'] = '#8A2BE2'; - $color['Brown'] = '#A52A2A'; - $color['BurlyWood'] = '#DEB887'; - $color['CadetBlue'] = '#5F9EA0'; - $color['Chartreuse'] = '#7FFF00'; - $color['Chocolate'] = '#D2691E'; - $color['Coral'] = '#FF7F50'; - $color['CornflowerBlue'] = '#6495ED'; - $color['Cornsilk'] = '#FFF8DC'; - $color['Crimson'] = '#DC143C'; - $color['Cyan'] = '#00FFFF'; - $color['DarkBlue'] = '#00008B'; - $color['DarkCyan'] = '#008B8B'; - $color['DarkGoldenRod'] = '#B8860B'; - $color['DarkGray'] = '#A9A9A9'; - $color['DarkGrey'] = '#A9A9A9'; - $color['DarkGreen'] = '#006400'; - $color['DarkKhaki'] = '#BDB76B'; - $color['DarkMagenta'] = '#8B008B'; - $color['DarkOliveGreen'] = '#556B2F'; - $color['Darkorange'] = '#FF8C00'; - $color['DarkOrchid'] = '#9932CC'; - $color['DarkRed'] = '#8B0000'; - $color['DarkSalmon'] = '#E9967A'; - $color['DarkSeaGreen'] = '#8FBC8F'; - $color['DarkSlateBlue'] = '#483D8B'; - $color['DarkSlateGray'] = '#2F4F4F'; - $color['DarkSlateGrey'] = '#2F4F4F'; - $color['DarkTurquoise'] = '#00CED1'; - $color['DarkViolet'] = '#9400D3'; - $color['DeepPink'] = '#FF1493'; - $color['DeepSkyBlue'] = '#00BFFF'; - $color['DimGray'] = '#696969'; - $color['DimGrey'] = '#696969'; - $color['DodgerBlue'] = '#1E90FF'; - $color['FireBrick'] = '#B22222'; - $color['FloralWhite'] = '#FFFAF0'; - $color['ForestGreen'] = '#228B22'; - $color['Fuchsia'] = '#FF00FF'; - $color['Gainsboro'] = '#DCDCDC'; - $color['GhostWhite'] = '#F8F8FF'; - $color['Gold'] = '#FFD700'; - $color['GoldenRod'] = '#DAA520'; - $color['Gray'] = '#808080'; - $color['Grey'] = '#808080'; - $color['Green'] = '#008000'; - $color['GreenYellow'] = '#ADFF2F'; - $color['HoneyDew'] = '#F0FFF0'; - $color['HotPink'] = '#FF69B4'; - $color['IndianRed'] = '#CD5C5C'; - $color['Indigo'] = '#4B0082'; - $color['Ivory'] = '#FFFFF0'; - $color['Khaki'] = '#F0E68C'; - $color['Lavender'] = '#E6E6FA'; - $color['LavenderBlush'] = '#FFF0F5'; - $color['LawnGreen'] = '#7CFC00'; - $color['LemonChiffon'] = '#FFFACD'; - $color['LightBlue'] = '#ADD8E6'; - $color['LightCoral'] = '#F08080'; - $color['LightCyan'] = '#E0FFFF'; - $color['LightGoldenRodYellow'] = '#FAFAD2'; - $color['LightGray'] = '#D3D3D3'; - $color['LightGrey'] = '#D3D3D3'; - $color['LightGreen'] = '#90EE90'; - $color['LightPink'] = '#FFB6C1'; - $color['LightSalmon'] = '#FFA07A'; - $color['LightSeaGreen'] = '#20B2AA'; - $color['LightSkyBlue'] = '#87CEFA'; - $color['LightSlateGray'] = '#778899'; - $color['LightSlateGrey'] = '#778899'; - $color['LightSteelBlue'] = '#B0C4DE'; - $color['LightYellow'] = '#FFFFE0'; - $color['Lime'] = '#00FF00'; - $color['LimeGreen'] = '#32CD32'; - $color['Linen'] = '#FAF0E6'; - $color['Magenta'] = '#FF00FF'; - $color['Maroon'] = '#800000'; - $color['MediumAquaMarine'] = '#66CDAA'; - $color['MediumBlue'] = '#0000CD'; - $color['MediumOrchid'] = '#BA55D3'; - $color['MediumPurple'] = '#9370D8'; - $color['MediumSeaGreen'] = '#3CB371'; - $color['MediumSlateBlue'] = '#7B68EE'; - $color['MediumSpringGreen'] = '#00FA9A'; - $color['MediumTurquoise'] = '#48D1CC'; - $color['MediumVioletRed'] = '#C71585'; - $color['MidnightBlue'] = '#191970'; - $color['MintCream'] = '#F5FFFA'; - $color['MistyRose'] = '#FFE4E1'; - $color['Moccasin'] = '#FFE4B5'; - $color['NavajoWhite'] = '#FFDEAD'; - $color['Navy'] = '#000080'; - $color['OldLace'] = '#FDF5E6'; - $color['Olive'] = '#808000'; - $color['OliveDrab'] = '#6B8E23'; - $color['Orange'] = '#FFA500'; - $color['OrangeRed'] = '#FF4500'; - $color['Orchid'] = '#DA70D6'; - $color['PaleGoldenRod'] = '#EEE8AA'; - $color['PaleGreen'] = '#98FB98'; - $color['PaleTurquoise'] = '#AFEEEE'; - $color['PaleVioletRed'] = '#D87093'; - $color['PapayaWhip'] = '#FFEFD5'; - $color['PeachPuff'] = '#FFDAB9'; - $color['Peru'] = '#CD853F'; - $color['Pink'] = '#FFC0CB'; - $color['Plum'] = '#DDA0DD'; - $color['PowderBlue'] = '#B0E0E6'; - $color['Purple'] = '#800080'; - $color['Red'] = '#FF0000'; - $color['RosyBrown'] = '#BC8F8F'; - $color['RoyalBlue'] = '#4169E1'; - $color['SaddleBrown'] = '#8B4513'; - $color['Salmon'] = '#FA8072'; - $color['SandyBrown'] = '#F4A460'; - $color['SeaGreen'] = '#2E8B57'; - $color['SeaShell'] = '#FFF5EE'; - $color['Sienna'] = '#A0522D'; - $color['Silver'] = '#C0C0C0'; - $color['SkyBlue'] = '#87CEEB'; - $color['SlateBlue'] = '#6A5ACD'; - $color['SlateGray'] = '#708090'; - $color['SlateGrey'] = '#708090'; - $color['Snow'] = '#FFFAFA'; - $color['SpringGreen'] = '#00FF7F'; - $color['SteelBlue'] = '#4682B4'; - $color['Tan'] = '#D2B48C'; - $color['Teal'] = '#008080'; - $color['Thistle'] = '#D8BFD8'; - $color['Tomato'] = '#FF6347'; - $color['Turquoise'] = '#40E0D0'; - $color['Violet'] = '#EE82EE'; - $color['Wheat'] = '#F5DEB3'; - $color['White'] = '#FFFFFF'; - $color['WhiteSmoke'] = '#F5F5F5'; - $color['Yellow'] = '#FFFF00'; - $color['YellowGreen'] = '#9ACD32'; - - $this->htmlColor = array(); - foreach($color as $key => $val) $this->htmlColor[strtolower($key)] = $val; - unset($color); - - $this->table = array(); - - $this->value = array(); - $this->initStyle(); - - // initialisation des styles sans h�ritages - $this->resetStyle(); - } - - function initStyle() - { - $this->value['id_balise'] = 'body'; // balise - $this->value['id_name'] = null; // name - $this->value['id_id'] = null; // id - $this->value['id_class'] = null; // class - $this->value['id_lst'] = array('*'); // lst de dependance - $this->value['mini-size'] = 1.; // rapport de taille sp�cifique aux sup, sub - $this->value['mini-decal'] = 0; // rapport de position sp�cifique aux sup, sub - $this->value['font-family'] = 'Arial'; - $this->value['font-bold'] = false; - $this->value['font-italic'] = false; - $this->value['font-underline'] = false; - $this->value['font-overline'] = false; - $this->value['font-linethrough'] = false; - $this->value['font-size'] = $this->ConvertToMM('10pt'); - $this->value['text-indent'] = 0; - $this->value['text-align'] = 'left'; - $this->value['vertical-align'] = 'middle'; - $this->value['line-height'] = 'normal'; - - $this->value['position'] = null; - $this->value['x'] = null; - $this->value['y'] = null; - $this->value['width'] = 0; - $this->value['height'] = 0; - $this->value['top'] = null; - $this->value['right'] = null; - $this->value['bottom'] = null; - $this->value['left'] = null; - $this->value['float'] = null; - $this->value['display'] = null; - - $this->value['color'] = array(0, 0, 0); - $this->value['background'] = array('color' => null, 'image' => null, 'position' => null, 'repeat' => null); - $this->value['border'] = array(); - $this->value['padding'] = array(); - $this->value['margin'] = array(); - $this->value['margin-auto'] = false; - - $this->value['list-style-type'] = ''; - $this->value['list-style-image'] = ''; - - $this->value['xc'] = null; - $this->value['yc'] = null; - } - - /** - * Initialisation des styles sans h�ritages - * - * @param string balise HTML - * @return null - */ - function resetStyle($balise = '') - { - $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false; - if (!in_array($balise, array('tr', 'td', 'th'))) $collapse = false; - - $this->value['position'] = null; - $this->value['x'] = null; - $this->value['y'] = null; - $this->value['width'] = 0; - $this->value['height'] = 0; - $this->value['top'] = null; - $this->value['right'] = null; - $this->value['bottom'] = null; - $this->value['left'] = null; - $this->value['float'] = null; - $this->value['display'] = null; - $this->value['background'] = array('color' => null, 'image' => null, 'position' => null, 'repeat' => null); - $this->value['border'] = array( - 't' => $this->readBorder('none'), - 'r' => $this->readBorder('none'), - 'b' => $this->readBorder('none'), - 'l' => $this->readBorder('none'), - 'radius' => array(0, 0), - 'collapse' => $collapse, - ); - - $this->value['margin'] = array( - 't' => 0, - 'r' => 0, - 'b' => 0, - 'l' => 0 - ); - $this->value['margin-auto'] = false; - - if (in_array($balise, array('div'))) - $this->value['vertical-align'] = 'top'; - - if (in_array($balise, array('ul', 'li'))) - { - $this->value['list-style-type'] = ''; - $this->value['list-style-image'] = ''; - } - - if (!in_array($balise, array('tr', 'td'))) - { - $this->value['padding'] = array( - 't' => 0, - 'r' => 0, - 'b' => 0, - 'l' => 0 - ); - } - else - { - $this->value['padding'] = array( - 't' => $this->ConvertToMM('1px'), - 'r' => $this->ConvertToMM('1px'), - 'b' => $this->ConvertToMM('1px'), - 'l' => $this->ConvertToMM('1px') - ); - } - - if ($balise=='hr') - { - $this->value['border'] = array( - 't' => $this->readBorder('solid 1px #000000'), - 'r' => $this->readBorder('solid 1px #000000'), - 'b' => $this->readBorder('solid 1px #000000'), - 'l' => $this->readBorder('solid 1px #000000'), - 'radius' => array(0, 0), - 'collapse' => false, - ); - $this->ConvertBackground('#FFFFFF', $this->value['background']); - } - - $this->value['xc'] = null; - $this->value['yc'] = null; - } - - /** - * Initialisation de la font PDF - * - * @return null - */ - function FontSet() - { - $b = ($this->value['font-bold'] ? 'B' : ''); - $i = ($this->value['font-italic'] ? 'I' : ''); - $u = ($this->value['font-underline'] ? 'U' : ''); - - // taille en mm, � ramener en pt - $size = $this->value['font-size']; - $size = 72 * $size / 25.4; - - $this->pdf->setOverline($this->value['font-overline']); - $this->pdf->setLinethrough($this->value['font-linethrough']); - - // application de la fonte - $this->pdf->SetFont($this->value['font-family'], $b.$i.$u, $this->value['mini-size']*$size); - $this->pdf->SetTextColor($this->value['color'][0],$this->value['color'][1], $this->value['color'][2]); - if ($this->value['background']['color']) - $this->pdf->SetFillColor($this->value['background']['color'][0],$this->value['background']['color'][1], $this->value['background']['color'][2]); - else - $this->pdf->SetFillColor(255); - } - - /** - * Monter d'un niveau dans l'historisation - * - * @return null - */ - function save() - { - $this->table[count($this->table)] = $this->value; - } - - /** - * Descendre d'un niveau dans l'historisation - * - * @return null - */ - function load() - { - if (count($this->table)) - { - $this->value = $this->table[count($this->table)-1]; - unset($this->table[count($this->table)-1]); - } - } - - function restorePosition(&$current_x, &$current_y) - { - if ($this->value['y']==$current_y) $current_y = $this->value['yc']; - } - - function setPosition(&$current_x, &$current_y) - { - $this->value['xc'] = $current_x; - $this->value['yc'] = $current_y; - - if ($this->value['position']=='relative' || $this->value['position']=='absolute') - { - if ($this->value['right']!==null) - { - $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width']; - if ($this->value['margin']['r']) $x-= $this->value['margin']['r']; - } - else - { - $x = $this->value['left']; - if ($this->value['margin']['l']) $x+= $this->value['margin']['l']; - } - - if ($this->value['bottom']!==null) - { - $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height']; - if ($this->value['margin']['b']) $y-= $this->value['margin']['b']; - } - else - { - $y = $this->value['top']; - if ($this->value['margin']['t']) $y+= $this->value['margin']['t']; - } - - if ($this->value['position']=='relative') - { - $this->value['x'] = $current_x + $x; - $this->value['y'] = $current_y + $y; - } - else - { - $this->value['x'] = $this->getLastAbsoluteX()+$x; - $this->value['y'] = $this->getLastAbsoluteY()+$y; - } - } - else - { - $this->value['x'] = $current_x; - $this->value['y'] = $current_y; - if ($this->value['margin']['l']) $this->value['x']+= $this->value['margin']['l']; - if ($this->value['margin']['t']) $this->value['y']+= $this->value['margin']['t']; - } - - $current_x = $this->value['x']; - $current_y = $this->value['y']; - } - - /** - * Analyse un tableau de style provenant du parseurHTML - * - * @param string nom de la balise - * @param array tableau de style - * @return null - */ - function analyse($balise, &$param) - { - // preparation - $balise = strtolower($balise); - $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) $id = null; - $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) $name = null; - - // lecture de la propriete classe - $class = array(); - $tmp = isset($param['class']) ? preg_replace('/[\s]+/', ' ', strtolower($param['class'])) : ''; - $tmp = explode(' ', $tmp); - foreach($tmp as $k => $v) - { - $v = trim($v); - if ($v) $class[] = $v; - } - - // identification de la balise et des styles direct qui pourraient lui �tre appliqu�s - $this->value['id_balise'] = $balise; - $this->value['id_name'] = $name; - $this->value['id_id'] = $id; - $this->value['id_class'] = $class; - $this->value['id_lst'] = array(); - $this->value['id_lst'][] = '*'; - $this->value['id_lst'][] = $balise; - if (count($class)) - { - foreach($class as $v) - { - $this->value['id_lst'][] = '*.'.$v; - $this->value['id_lst'][] = '.'.$v; - $this->value['id_lst'][] = $balise.'.'.$v; - } - } - if ($id) - { - $this->value['id_lst'][] = '*#'.$id; - $this->value['id_lst'][] = '#'.$id; - $this->value['id_lst'][] = $id.'#'.$id; - } - - // style CSS - $styles = $this->getFromCSS(); - - // on ajoute le style propre � la balise - $styles = array_merge($styles, $param['style']); - if (isset($param['allwidth']) && !isset($styles['width'])) $styles['width'] = '100%'; - - // mise � zero des styles non h�rit�s - $this->resetStyle($balise); - - // interpreration des nouvelles valeurs - $correct_width = false; - $no_width = true; - - foreach($styles as $nom => $val) - { - switch($nom) - { - case 'font-family': - $val = explode(',', $val); - $val = trim($val[0]); - - if ($val) $this->value['font-family'] = $val; - break; - - case 'font-weight': - $this->value['font-bold'] = ($val=='bold'); - break; - - case 'font-style': - $this->value['font-italic'] = ($val=='italic'); - break; - - case 'text-decoration': - $val = explode(' ', $val); - $this->value['font-underline'] = (in_array('underline', $val)); - $this->value['font-overline'] = (in_array('overline', $val)); - $this->value['font-linethrough'] = (in_array('line-through', $val)); - break; - - case 'text-indent': - $this->value['text-indent'] = $this->ConvertToMM($val); - break; - - case 'font-size': - $val = $this->ConvertToMM($val, $this->value['font-size']); - if ($val) $this->value['font-size'] = $val; - break; - - case 'color': - $res = null; - $this->value['color'] = $this->ConvertToRVB($val, $res); - - if ($balise=='hr') - { - $this->value['border']['l']['color'] = $this->value['color']; - $this->value['border']['t']['color'] = $this->value['color']; - $this->value['border']['r']['color'] = $this->value['color']; - $this->value['border']['b']['color'] = $this->value['color']; - } - break; - - case 'text-align': - $this->value['text-align'] = $val; - break; - - case 'vertical-align': - $this->value['vertical-align'] = $val; - break; - - case 'width': - $this->value['width'] = $this->ConvertToMM($val, $this->getLastWidth()); - if ($this->value['width'] && substr($val, -1)=='%') $correct_width=true; - $no_width = false; - break; - - case 'height': - $this->value['height'] = $this->ConvertToMM($val, $this->getLastHeight()); - break; - - case 'line-height': - if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val*100).'%'; - $this->value['line-height'] = $val; - break; - - case 'padding': - $val = explode(' ', $val); - foreach($val as $k => $v) - { - $v = trim($v); - if ($v!='') $val[$k] = $v; - else unset($val[$k]); - } - $val = array_values($val); - if (count($val)!=4) - { - $val = $this->ConvertToMM($val[0], 0); - $this->value['padding']['t'] = $val; - $this->value['padding']['r'] = $val; - $this->value['padding']['b'] = $val; - $this->value['padding']['l'] = $val; - } - else - { - $this->value['padding']['t'] = $this->ConvertToMM($val[0], 0); - $this->value['padding']['r'] = $this->ConvertToMM($val[1], 0); - $this->value['padding']['b'] = $this->ConvertToMM($val[2], 0); - $this->value['padding']['l'] = $this->ConvertToMM($val[3], 0); - } - break; - - case 'padding-top': - $this->value['padding']['t'] = $this->ConvertToMM($val, 0); - break; - - case 'padding-right': - $this->value['padding']['r'] = $this->ConvertToMM($val, 0); - break; - - case 'padding-bottom': - $this->value['padding']['b'] = $this->ConvertToMM($val, 0); - break; - - case 'padding-left': - $this->value['padding']['l'] = $this->ConvertToMM($val, 0); - break; - - case 'margin': - if ($val=='auto') - { - $this->value['margin-auto'] = true; - break; - } - $val = explode(' ', $val); - foreach($val as $k => $v) - { - $v = trim($v); - if ($v!='') $val[$k] = $v; - else unset($val[$k]); - } - $val = array_values($val); - if (count($val)!=4) - { - $val = $this->ConvertToMM($val[0], 0); - $this->value['margin']['t'] = $val; - $this->value['margin']['r'] = $val; - $this->value['margin']['b'] = $val; - $this->value['margin']['l'] = $val; - } - else - { - $this->value['margin']['t'] = $this->ConvertToMM($val[0], 0); - $this->value['margin']['r'] = $this->ConvertToMM($val[1], 0); - $this->value['margin']['b'] = $this->ConvertToMM($val[2], 0); - $this->value['margin']['l'] = $this->ConvertToMM($val[3], 0); - } - break; - - case 'margin-top': - $this->value['margin']['t'] = $this->ConvertToMM($val, 0); - break; - - case 'margin-right': - $this->value['margin']['r'] = $this->ConvertToMM($val, 0); - break; - - case 'margin-bottom': - $this->value['margin']['b'] = $this->ConvertToMM($val, 0); - break; - - case 'margin-left': - $this->value['margin']['l'] = $this->ConvertToMM($val, 0); - break; - - case 'border': - $val = $this->readBorder($val); - $this->value['border']['t'] = $val; - $this->value['border']['r'] = $val; - $this->value['border']['b'] = $val; - $this->value['border']['l'] = $val; - break; - - case 'border-style': - $val = explode(' ', $val); - foreach($val as $val_k => $val_v) - if (!in_array($val_v, array('solid', 'dotted', 'dashed'))) - $val[$val_k] = null; - $this->duplicateBorder($val); - - if ($val[0]) $this->value['border']['t']['type'] = $val[0]; - if ($val[1]) $this->value['border']['r']['type'] = $val[1]; - if ($val[2]) $this->value['border']['b']['type'] = $val[2]; - if ($val[3]) $this->value['border']['l']['type'] = $val[3]; - break; - - case 'border-top-style': - if (in_array($val, array('solid', 'dotted', 'dashed'))) - $this->value['border']['t']['type'] = $val; - break; - - case 'border-right-style': - if (in_array($val, array('solid', 'dotted', 'dashed'))) - $this->value['border']['r']['type'] = $val; - break; - - case 'border-bottom-style': - if (in_array($val, array('solid', 'dotted', 'dashed'))) - $this->value['border']['b']['type'] = $val; - break; - - case 'border-left-style': - if (in_array($val, array('solid', 'dotted', 'dashed'))) - $this->value['border']['l']['type'] = $val; - break; - - case 'border-color': - $res = false; - $val = preg_replace('/,[\s]+/', ',', $val); - $val = explode(' ', $val); - - foreach($val as $val_k => $val_v) - { - $val[$val_k] = $this->ConvertToRVB($val_v, $res); - if (!$res) $val[$val_k] = null; - } - $this->duplicateBorder($val); - - if (is_array($val[0])) $this->value['border']['t']['color'] = $val[0]; - if (is_array($val[1])) $this->value['border']['r']['color'] = $val[1]; - if (is_array($val[2])) $this->value['border']['b']['color'] = $val[2]; - if (is_array($val[3])) $this->value['border']['l']['color'] = $val[3]; - - break; - - case 'border-top-color': - $res = false; - $val = $this->ConvertToRVB($val, $res); - if ($res) $this->value['border']['t']['color'] = $val; - break; - - case 'border-right-color': - $res = false; - $val = $this->ConvertToRVB($val, $res); - if ($res) $this->value['border']['r']['color'] = $val; - break; - - case 'border-bottom-color': - $res = false; - $val = $this->ConvertToRVB($val, $res); - if ($res) $this->value['border']['b']['color'] = $val; - break; - - case 'border-left-color': - $res = false; - $val = $this->ConvertToRVB($val, $res); - if ($res) $this->value['border']['l']['color'] = $val; - break; - - case 'border-width': - $val = explode(' ', $val); - foreach($val as $val_k => $val_v) - { - $val[$val_k] = $this->ConvertToMM($val_v, 0); - } - $this->duplicateBorder($val); - - if ($val[0]) $this->value['border']['t']['width'] = $val[0]; - if ($val[1]) $this->value['border']['r']['width'] = $val[1]; - if ($val[2]) $this->value['border']['b']['width'] = $val[2]; - if ($val[3]) $this->value['border']['l']['width'] = $val[3]; - break; - - case 'border-top-width': - $val = $this->ConvertToMM($val, 0);; - if ($val) $this->value['border']['t']['width'] = $val; - break; - - case 'border-right-width': - $val = $this->ConvertToMM($val, 0);; - if ($val) $this->value['border']['r']['width'] = $val; - break; - - case 'border-bottom-width': - $val = $this->ConvertToMM($val, 0);; - if ($val) $this->value['border']['b']['width'] = $val; - break; - - case 'border-left-width': - $val = $this->ConvertToMM($val, 0);; - if ($val) $this->value['border']['l']['width'] = $val; - break; - - case 'border-collapse': - if ($balise=='table') $this->value['border']['collapse'] = ($val=='collapse'); - break; - - case 'border-radius': - // nettoyage des valeurs - $val = explode(' ', $val); - foreach($val as $k => $v) - { - $v = trim($v); - if ($v) - { - $v = $this->ConvertToMM($v, 0); - if ($v) $val[$k] = $v; - else unset($val[$k]); - } - else unset($val[$k]); - } - $val = array_values($val); - - if (!isset($val[1]) && isset($val[0])) $val[1] = $val[0]; - if (count($val)==2) - $this->value['border']['radius'] = array($val[0], $val[1]); - - break; - - case 'border-top': - $this->value['border']['t'] = $this->readBorder($val); - break; - - case 'border-right': - $this->value['border']['r'] = $this->readBorder($val); - break; - - case 'border-bottom': - $this->value['border']['b'] = $this->readBorder($val); - break; - - case 'border-left': - $this->value['border']['l'] = $this->readBorder($val); - break; - - case 'background-color': - $this->value['background']['color'] = $this->ConvertBackgroundColor($val); - break; - - case 'background-image': - $this->value['background']['image'] = $this->ConvertBackgroundImage($val); - break; - - case 'background-position': - $res = null; - $this->value['background']['position'] = $this->ConvertBackgroundPosition($val, $res); - break; - - case 'background-repeat': - $this->value['background']['repeat'] = $this->ConvertBackgroundRepeat($val); - break; - - case 'background': - $this->ConvertBackground($val, $this->value['background']); - break; - - case 'position': - if ($val=='absolute') $this->value['position'] = 'absolute'; - else if ($val=='relative') $this->value['position'] = 'relative'; - else $this->value['position'] = null; - break; - - case 'float': - if ($val=='left') $this->value['float'] = 'left'; - else if ($val=='right') $this->value['float'] = 'right'; - else $this->value['float'] = null; - break; - - case 'display': - if ($val=='inline') $this->value['display'] = 'inline'; - else if ($val=='block') $this->value['display'] = 'block'; - else if ($val=='none') $this->value['display'] = 'none'; - else $this->value['display'] = null; - break; - - case 'top': - case 'bottom': - case 'left': - case 'right': - $this->value[$nom] = $val; - break; - - case 'list-style': - case 'list-style-type': - case 'list-style-image': - if ($nom=='list-style') $nom = 'list-style-type'; - $this->value[$nom] = $val; - break; - - default: - break; - } - } - - if ($this->onlyLeft) $this->value['text-align'] = 'left'; - - // correction de la largeur pour correspondre au mod�le de boite quick - if ($no_width && in_array($balise, array('div')) && $this->value['position']!='absolute') - { - $this->value['width'] = $this->getLastWidth(); - $this->value['width']-= $this->value['margin']['l'] + $this->value['margin']['r']; - } - else - { - if ($correct_width) - { - if (!in_array($balise, array('table', 'div', 'hr'))) - { - $this->value['width']-= $this->value['padding']['l'] + $this->value['padding']['r']; - $this->value['width']-= $this->value['border']['l']['width'] + $this->value['border']['r']['width']; - } - if (in_array($balise, array('th', 'td'))) - { - $this->value['width']-= $this->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px'); - } - if ($this->value['width']<0) $this->value['width']=0; - } - else - { - if ($this->value['width']) - { - if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width']; - if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width']; - if ($this->value['padding']['l']) $this->value['width'] += $this->value['padding']['l']; - if ($this->value['padding']['r']) $this->value['width'] += $this->value['padding']['r']; - } - } - } - if ($this->value['height']) - { - if ($this->value['border']['b']['width']) { $this->value['height'] += $this->value['border']['b']['width']; } - if ($this->value['border']['t']['width']) { $this->value['height'] += $this->value['border']['t']['width']; } - if ($this->value['padding']['b']) $this->value['height'] += $this->value['padding']['b']; - if ($this->value['padding']['t']) $this->value['height'] += $this->value['padding']['t']; - } - - if ($this->value['top']!=null) $this->value['top'] = $this->ConvertToMM($this->value['top'], $this->getLastHeight(true)); - if ($this->value['bottom']!=null) $this->value['bottom'] = $this->ConvertToMM($this->value['bottom'], $this->getLastHeight(true)); - if ($this->value['left']!=null) $this->value['left'] = $this->ConvertToMM($this->value['left'], $this->getLastWidth(true)); - if ($this->value['right']!=null) $this->value['right'] = $this->ConvertToMM($this->value['right'], $this->getLastWidth(true)); - - if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) $this->value['bottom'] = null; - if ($this->value['left'] && $this->value['right'] && $this->value['width']) $this->value['right'] = null; - } - - /** - * R�cup�ration de la hauteur de ligne courante - * - * @return float hauteur en mm - */ - function getLineHeight() - { - $val = $this->value['line-height']; - if ($val=='normal') $val = '108%'; - return $this->ConvertToMM($val, $this->value['font-size']); - } - - /** - * R�cup�ration de la largeur de l'objet parent - * - * @return float largeur - */ - function getLastWidth($mode = false) - { - for($k=count($this->table); $k>0; $k--) - { - if ($this->table[$k-1]['width']) - { - $w = $this->table[$k-1]['width']; - if ($mode) - { - $w+= $this->table[$k-1]['border']['l']['width'] + $this->table[$k-1]['padding']['l']+0.02; - $w+= $this->table[$k-1]['border']['r']['width'] + $this->table[$k-1]['padding']['r']+0.02; - } - return $w; - } - } - return $this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin; - } - - /** - * R�cup�ration de la hauteur de l'objet parent - * - * @return float hauteur - */ - function getLastHeight($mode = false) - { - for($k=count($this->table); $k>0; $k--) - { - if ($this->table[$k-1]['height']) - { - $h = $this->table[$k-1]['height']; - if ($mode) - { - $h+= $this->table[$k-1]['border']['t']['width'] + $this->table[$k-1]['padding']['t']+0.02; - $h+= $this->table[$k-1]['border']['b']['width'] + $this->table[$k-1]['padding']['b']+0.02; - } - return $h; - } - } - return $this->pdf->h - $this->pdf->tMargin - $this->pdf->bMargin; - } - - function getFloat() - { - if ($this->value['float']=='left') return 'left'; - if ($this->value['float']=='right') return 'right'; - return null; - } - - function getLastAbsoluteX() - { - for($k=count($this->table); $k>0; $k--) - { - if ($this->table[$k-1]['x'] && $this->table[$k-1]['position']) return $this->table[$k-1]['x']; - } - return $this->pdf->lMargin; - } - - function getLastAbsoluteY() - { - for($k=count($this->table); $k>0; $k--) - { - if ($this->table[$k-1]['y'] && $this->table[$k-1]['position']) return $this->table[$k-1]['y']; - } - return $this->pdf->tMargin; - } - - /** - * R�cup�ration des propri�t�s CSS de la balise en cours - * - * @return array() tableau des propri�t�s CSS - */ - function getFromCSS() - { - $styles = array(); // style � appliquer - $getit = array(); // styles � r�cuperer - - // identification des styles direct, et ceux des parents - $lst = array(); - $lst[] = $this->value['id_lst']; - for($i=count($this->table)-1; $i>=0; $i--) $lst[] = $this->table[$i]['id_lst']; - - // identification des styles � r�cuperer - foreach($this->css_keys as $key => $num) - if ($this->getReccursiveStyle($key, $lst)) - $getit[$key] = $num; - - // si des styles sont � recuperer - if (count($getit)) - { - // on les r�cup�re, mais dans l'odre de d�finition, afin de garder les priorit�s - asort($getit); - foreach($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]); - } - - return $styles; - } - - /** - * Identification des styles � r�cuperer, en fonction de la balise et de ses parents - * - * @param string clef CSS � analyser - * @param array() tableau des styles direct, et ceux des parents - * @param string prochaine etape - * @return boolean clef autoris�e ou non - */ - function getReccursiveStyle($key, $lst, $next = null) - { - // si propchaine etape, on construit les valeurs - if ($next!==null) - { - if ($next) $key = trim(substr($key, 0, -strlen($next))); // on el�ve cette etape - unset($lst[0]); - if (!count($lst)) return false; // pas d'etape possible - $lst = array_values($lst); - } - - // pour chaque style direct possible de l'etape en cours - foreach($lst[0] as $nom) - { - if ($key==$nom) return true; // si la clef conrrespond => ok - if (substr($key, -strlen(' '.$nom))==' '.$nom && $this->getReccursiveStyle($key, $lst, $nom)) return true; // si la clef est la fin, on analyse ce qui pr�c�de - } - - // si on est pas � la premiere etape, on doit analyse toutes les sous etapes - if ($next!==null && $this->getReccursiveStyle($key, $lst, '')) return true; - - // aucun style trouv� - return false; - } - - /** - * Analyse d'une propri�t� Border - * - * @param string propri�t� border - * @return array() propri�t� d�cod�e - */ - function readBorder($val) - { - $none = array('type' => 'none', 'width' => 0, 'color' => array(0, 0, 0)); - - // valeurs par d�fault - $type = 'solid'; - $width = $this->ConvertToMM('1pt'); - $color = array(0, 0, 0); - - // nettoyage des valeurs - $val = explode(' ', $val); - foreach($val as $k => $v) - { - $v = trim($v); - if ($v) $val[$k] = $v; - else unset($val[$k]); - } - $val = array_values($val); - // identification des valeurs - $res = null; - foreach($val as $key) - { - if ($key=='none' || $key=='hidden') return $none; - - if ($this->ConvertToMM($key)!==null) $width = $this->ConvertToMM($key); - else if (in_array($key, array('solid', 'dotted', 'dashed'))) $type = $key; - else - { - $tmp = $this->ConvertToRVB($key, $res); - if ($res) $color = $tmp; - } - } - if (!$width) return $none; - return array('type' => $type, 'width' => $width, 'color' => $color); - } - - function duplicateBorder(&$val) - { - if (count($val)==1) - { - $val[1] = $val[0]; - $val[2] = $val[0]; - $val[3] = $val[0]; - } - else if (count($val)==2) - { - $val[2] = $val[0]; - $val[3] = $val[1]; - } - else if (count($val)==3) - { - $val[3] = $val[1]; - } - } - - function ConvertBackground($stl, &$res) - { - // Image - $text = '/url\(([^)]*)\)/isU'; - if (preg_match($text, $stl, $match)) - { - $res['image'] = $this->ConvertBackgroundImage($match[0]); - $stl = preg_replace($text, '', $stl); - $stl = preg_replace('/[\s]+/', ' ', $stl); - } - - // protection des espaces - $stl = preg_replace('/,[\s]+/', ',', $stl); - $lst = explode(' ', $stl); - - $pos = ''; - foreach($lst as $val) - { - $ok = false; - $color = $this->ConvertToRVB($val, $ok); - - if ($ok) - { - $res['color'] = $color; - } - else if ($val=='transparent') - { - $res['color'] = null; - } - else - { - $repeat = $this->ConvertBackgroundRepeat($val); - if ($repeat) - { - $res['repeat'] = $repeat; - } - else - { - $pos.= ($pos ? ' ' : '').$val; - } - } - } - if ($pos) - { - $pos = $this->ConvertBackgroundPosition($pos, $ok); - if ($ok) $res['position'] = $pos; - } - } - - function ConvertBackgroundColor($val) - { - $res = null; - if ($val=='transparent') return null; - else return $this->ConvertToRVB($val, $res); - } - - function ConvertBackgroundImage($val) - { - if ($val=='none') - return null; - else if (preg_match('/^url\(([^)]*)\)$/isU', $val, $match)) - return $match[1]; - else - return null; - } - - function ConvertBackgroundPosition($val, &$res) - { - $val = explode(' ', $val); - if (count($val)<2) - { - if (!$val[0]) return null; - $val[1] = 'center'; - } - if (count($val)>2) return null; - - $x = 0; - $y = 0; - $res = true; - - if ($val[0]=='left') $x = '0%'; - else if ($val[0]=='center') $x = '50%'; - else if ($val[0]=='right') $x = '100%'; - else if ($val[0]=='top') $y = '0%'; - else if ($val[0]=='bottom') $y = '100%'; - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $val[0])) $x = $val[0]; - else if ($this->ConvertToMM($val[0])) $x = $this->ConvertToMM($val[0]); - else $res = false; - - if ($val[1]=='left') $x = '0%'; - else if ($val[1]=='right') $x = '100%'; - else if ($val[1]=='top') $y = '0%'; - else if ($val[1]=='center') $y = '50%'; - else if ($val[1]=='bottom') $y = '100%'; - else if (preg_match('/^[-]?[0-9\.]+%$/isU', $val[1])) $y = $val[1]; - else if ($this->ConvertToMM($val[1])) $y = $this->ConvertToMM($val[1]); - else $res = false; - - $val[0] = $x; - $val[1] = $y; - - return $val; - } - - function ConvertBackgroundRepeat($val) - { - switch($val) - { - case 'repeat': - return array(true, true); - case 'repeat-x': - return array(true, false); - case 'repeat-y': - return array(false, true); - case 'no-repeat': - return array(false, false); - } - return null; - } - /** - * Convertir une longueur en mm - * - * @param string longueur, avec unit�, � convertir - * @param float longueur du parent - * @return float longueur exprim�e en mm - */ - function ConvertToMM($val, $old=0.) - { - $val = trim($val); - if (preg_match('/^[0-9\.\-]+$/isU', $val)) $val.= 'px'; - if (preg_match('/^[0-9\.\-]+px$/isU', $val)) $val = 25.4/96. * str_replace('px', '', $val); - else if (preg_match('/^[0-9\.\-]+pt$/isU', $val)) $val = 25.4/72. * str_replace('pt', '', $val); - else if (preg_match('/^[0-9\.\-]+in$/isU', $val)) $val = 25.4 * str_replace('in', '', $val); - else if (preg_match('/^[0-9\.\-]+mm$/isU', $val)) $val = 1.*str_replace('mm', '', $val); - else if (preg_match('/^[0-9\.\-]+%$/isU', $val)) $val = 1.*$old*str_replace('%', '', $val)/100.; - else $val = null; - - return $val; - } - - /** - * D�composition d'un code couleur HTML - * - * @param string couleur au format CSS - * @return array(r, v, b) couleur exprim� par ses comporantes R, V, B, de 0 � 255. - */ - function ConvertToRVB($val, &$res) - { - $val = trim($val); - $res = true; - - if (strtolower($val)=='transparent') return array(null, null, null); - if (isset($this->htmlColor[strtolower($val)])) $val = $this->htmlColor[strtolower($val)]; - - if (preg_match('/rgb\([\s]*([0-9%]+)[\s]*,[\s]*([0-9%]+)[\s]*,[\s]*([0-9%]+)[\s]*\)/isU', $val, $match)) - { - $r =$match[1]; if (substr($r, -1)=='%') $r = floor(255*substr($r, 0, -1)/100); - $v =$match[2]; if (substr($v, -1)=='%') $v = floor(255*substr($v, 0, -1)/100); - $b =$match[3]; if (substr($b, -1)=='%') $b = floor(255*substr($b, 0, -1)/100); - } - else if (strlen($val)==7 && substr($val, 0, 1)=='#') - { - $r = hexdec(substr($val, 1, 2)); - $v = hexdec(substr($val, 3, 2)); - $b = hexdec(substr($val, 5, 2)); - } - else if (strlen($val)==4 && substr($val, 0, 1)=='#') - { - $r = hexdec(substr($val, 1, 1).substr($val, 1, 1)); - $v = hexdec(substr($val, 2, 1).substr($val, 2, 1)); - $b = hexdec(substr($val, 3, 1).substr($val, 3, 1)); - } - else - { - $r=0; - $v=0; - $b=0; - $res = false; - } - return array(floor($r), floor($v), floor($b)); - } - - /** - * Analyser une feuille de style - * - * @param string code CSS - * @return null - */ - function analyseStyle(&$code) - { - // on remplace tous les espaces, tab, \r, \n, par des espaces uniques - $code = preg_replace('/[\s]+/', ' ', $code); - - // on enl�ve les commentaires - $code = preg_replace('/\/\*.*?\*\//s', '', $code); - - // on analyse chaque style - preg_match_all('/([^{}]+){([^}]*)}/isU', $code, $match); - for($k=0; $k on remplie le tableau correspondant - $styles = trim($match[2][$k]); - $styles = explode(';', $styles); - $stl = array(); - foreach($styles as $style) - { - $tmp = explode(':', $style); - if (count($tmp)>1) - { - $cod = $tmp[0]; unset($tmp[0]); $tmp = implode(':', $tmp); - $stl[trim(strtolower($cod))] = trim($tmp); - } - } - - // d�composition des noms par les , - $noms = explode(',', $noms); - foreach($noms as $nom) - { - $nom = trim($nom); - // Si il a une fonction sp�cifique, comme :hover => on zap - if (strpos($nom, ':')!==false) continue; - if (!isset($this->css[$nom])) - $this->css[$nom] = $stl; - else - $this->css[$nom] = array_merge($this->css[$nom], $stl); - - } - } - - $this->css_keys = array_flip(array_keys($this->css)); - } - - /** - * Extraction des feuille de style du code HTML - * - * @param string code HTML - * @return null - */ - function readStyle(&$html) - { - $style = ' '; - - // extraction des balises link, et suppression de celles-ci dans le code HTML - preg_match_all('/]*)>/isU', $html, $match); - $html = preg_replace('/]*>/isU', '', $html); - $html = preg_replace('/<\/link[^>]*>/isU', '', $html); - - // analyse de chaque balise - foreach($match[1] as $code) - { - $tmp = array(); - // lecture des param�tres du type nom=valeur - $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; - preg_match_all('/'.$prop.'/is', $code, $match); - for($k=0; $k on garde - if (isset($tmp['type']) && strtolower($tmp['type'])=='text/css' && isset($tmp['href'])) - { - $content = @file_get_contents($tmp['href']); - $url = $tmp['href']; - if (strpos($url, 'http://')!==false) - { - $url = str_replace('http://', '', $url); - $url = explode('/', $url); - $url_main = 'http://'.$url[0].'/'; - $url_self = $url; unset($url_self[count($url_self)-1]); $url_self = 'http://'.implode('/', $url_self).'/'; - - $content = preg_replace('/url\(([^\\\\][^)]*)\)/isU', 'url('.$url_self.'$1)', $content); - $content = preg_replace('/url\((\\\\[^)]*)\)/isU', 'url('.$url_main.'$1)', $content); - } - - $style.= $content."\n"; - } - } - - - // extraction des balises style, et suppression de celles-ci dans le code HTML - preg_match_all('/]*>(.*)<\/style[^>]*>/isU', $html, $match); - $html = preg_replace('/]*>(.*)<\/style[^>]*>/isU', '', $html); - - // analyse de chaque balise - foreach($match[1] as $code) - { - $code = str_replace('', '', $code); - $style.= $code."\n"; - } - - $this->analyseStyle($style); - } - } -} -?> \ No newline at end of file + PDF, utilise fpdf de Olivier PLATHEY + * Distribué sous la licence LGPL. + * + * @author Laurent MINGUET + * @version 3.26 - 16/11/2009 + */ + +if (!defined('__CLASS_STYLEHTML__')) +{ + define('__CLASS_STYLEHTML__', true); + + class styleHTML + { + var $css = array(); // tableau des CSS + var $css_keys = array(); // tableau des clefs CSS, pour l'ordre d'execution + var $value = array(); // valeurs actuelles + var $table = array(); // tableau d'empilement pour historisation des niveaux + var $pdf = null; // référence au PDF parent + var $htmlColor = array(); // liste des couleurs HTML + var $onlyLeft = false; // indique si on est dans un sous HTML et qu'on bloque à gauche + var $defaultFont = null; // fonte par défaut si la fonte demandée n'existe pas + + /** + * Constructeur + * + * @param &pdf référence à l'objet HTML2PDF parent + * @return null + */ + function styleHTML(&$pdf) + { + $this->init(); // initialisation + $this->pdf = &$pdf; + } + + /** + * définit la fonte par défaut si aucun fonte n'est spécifiée, ou si la fonte demandée n'existe pas + * + * @param string nom de la fonte par defaut. si null : Arial pour fonte non spécifiée, et erreur pour fonte non existante + * @return string nom de l'ancienne fonte par defaut + */ + function setDefaultFont($default = null) + { + $old = $this->defaultFont; + $this->defaultFont = $default; + if ($default) $this->value['font-family'] = $default; + return $old; + } + + /** + * Initialisation du style + * + * @return null + */ + function init() + { + $color = array(); + $color['AliceBlue'] = '#F0F8FF'; + $color['AntiqueWhite'] = '#FAEBD7'; + $color['Aqua'] = '#00FFFF'; + $color['Aquamarine'] = '#7FFFD4'; + $color['Azure'] = '#F0FFFF'; + $color['Beige'] = '#F5F5DC'; + $color['Bisque'] = '#FFE4C4'; + $color['Black'] = '#000000'; + $color['BlanchedAlmond'] = '#FFEBCD'; + $color['Blue'] = '#0000FF'; + $color['BlueViolet'] = '#8A2BE2'; + $color['Brown'] = '#A52A2A'; + $color['BurlyWood'] = '#DEB887'; + $color['CadetBlue'] = '#5F9EA0'; + $color['Chartreuse'] = '#7FFF00'; + $color['Chocolate'] = '#D2691E'; + $color['Coral'] = '#FF7F50'; + $color['CornflowerBlue'] = '#6495ED'; + $color['Cornsilk'] = '#FFF8DC'; + $color['Crimson'] = '#DC143C'; + $color['Cyan'] = '#00FFFF'; + $color['DarkBlue'] = '#00008B'; + $color['DarkCyan'] = '#008B8B'; + $color['DarkGoldenRod'] = '#B8860B'; + $color['DarkGray'] = '#A9A9A9'; + $color['DarkGrey'] = '#A9A9A9'; + $color['DarkGreen'] = '#006400'; + $color['DarkKhaki'] = '#BDB76B'; + $color['DarkMagenta'] = '#8B008B'; + $color['DarkOliveGreen'] = '#556B2F'; + $color['Darkorange'] = '#FF8C00'; + $color['DarkOrchid'] = '#9932CC'; + $color['DarkRed'] = '#8B0000'; + $color['DarkSalmon'] = '#E9967A'; + $color['DarkSeaGreen'] = '#8FBC8F'; + $color['DarkSlateBlue'] = '#483D8B'; + $color['DarkSlateGray'] = '#2F4F4F'; + $color['DarkSlateGrey'] = '#2F4F4F'; + $color['DarkTurquoise'] = '#00CED1'; + $color['DarkViolet'] = '#9400D3'; + $color['DeepPink'] = '#FF1493'; + $color['DeepSkyBlue'] = '#00BFFF'; + $color['DimGray'] = '#696969'; + $color['DimGrey'] = '#696969'; + $color['DodgerBlue'] = '#1E90FF'; + $color['FireBrick'] = '#B22222'; + $color['FloralWhite'] = '#FFFAF0'; + $color['ForestGreen'] = '#228B22'; + $color['Fuchsia'] = '#FF00FF'; + $color['Gainsboro'] = '#DCDCDC'; + $color['GhostWhite'] = '#F8F8FF'; + $color['Gold'] = '#FFD700'; + $color['GoldenRod'] = '#DAA520'; + $color['Gray'] = '#808080'; + $color['Grey'] = '#808080'; + $color['Green'] = '#008000'; + $color['GreenYellow'] = '#ADFF2F'; + $color['HoneyDew'] = '#F0FFF0'; + $color['HotPink'] = '#FF69B4'; + $color['IndianRed'] = '#CD5C5C'; + $color['Indigo'] = '#4B0082'; + $color['Ivory'] = '#FFFFF0'; + $color['Khaki'] = '#F0E68C'; + $color['Lavender'] = '#E6E6FA'; + $color['LavenderBlush'] = '#FFF0F5'; + $color['LawnGreen'] = '#7CFC00'; + $color['LemonChiffon'] = '#FFFACD'; + $color['LightBlue'] = '#ADD8E6'; + $color['LightCoral'] = '#F08080'; + $color['LightCyan'] = '#E0FFFF'; + $color['LightGoldenRodYellow'] = '#FAFAD2'; + $color['LightGray'] = '#D3D3D3'; + $color['LightGrey'] = '#D3D3D3'; + $color['LightGreen'] = '#90EE90'; + $color['LightPink'] = '#FFB6C1'; + $color['LightSalmon'] = '#FFA07A'; + $color['LightSeaGreen'] = '#20B2AA'; + $color['LightSkyBlue'] = '#87CEFA'; + $color['LightSlateGray'] = '#778899'; + $color['LightSlateGrey'] = '#778899'; + $color['LightSteelBlue'] = '#B0C4DE'; + $color['LightYellow'] = '#FFFFE0'; + $color['Lime'] = '#00FF00'; + $color['LimeGreen'] = '#32CD32'; + $color['Linen'] = '#FAF0E6'; + $color['Magenta'] = '#FF00FF'; + $color['Maroon'] = '#800000'; + $color['MediumAquaMarine'] = '#66CDAA'; + $color['MediumBlue'] = '#0000CD'; + $color['MediumOrchid'] = '#BA55D3'; + $color['MediumPurple'] = '#9370D8'; + $color['MediumSeaGreen'] = '#3CB371'; + $color['MediumSlateBlue'] = '#7B68EE'; + $color['MediumSpringGreen'] = '#00FA9A'; + $color['MediumTurquoise'] = '#48D1CC'; + $color['MediumVioletRed'] = '#C71585'; + $color['MidnightBlue'] = '#191970'; + $color['MintCream'] = '#F5FFFA'; + $color['MistyRose'] = '#FFE4E1'; + $color['Moccasin'] = '#FFE4B5'; + $color['NavajoWhite'] = '#FFDEAD'; + $color['Navy'] = '#000080'; + $color['OldLace'] = '#FDF5E6'; + $color['Olive'] = '#808000'; + $color['OliveDrab'] = '#6B8E23'; + $color['Orange'] = '#FFA500'; + $color['OrangeRed'] = '#FF4500'; + $color['Orchid'] = '#DA70D6'; + $color['PaleGoldenRod'] = '#EEE8AA'; + $color['PaleGreen'] = '#98FB98'; + $color['PaleTurquoise'] = '#AFEEEE'; + $color['PaleVioletRed'] = '#D87093'; + $color['PapayaWhip'] = '#FFEFD5'; + $color['PeachPuff'] = '#FFDAB9'; + $color['Peru'] = '#CD853F'; + $color['Pink'] = '#FFC0CB'; + $color['Plum'] = '#DDA0DD'; + $color['PowderBlue'] = '#B0E0E6'; + $color['Purple'] = '#800080'; + $color['Red'] = '#FF0000'; + $color['RosyBrown'] = '#BC8F8F'; + $color['RoyalBlue'] = '#4169E1'; + $color['SaddleBrown'] = '#8B4513'; + $color['Salmon'] = '#FA8072'; + $color['SandyBrown'] = '#F4A460'; + $color['SeaGreen'] = '#2E8B57'; + $color['SeaShell'] = '#FFF5EE'; + $color['Sienna'] = '#A0522D'; + $color['Silver'] = '#C0C0C0'; + $color['SkyBlue'] = '#87CEEB'; + $color['SlateBlue'] = '#6A5ACD'; + $color['SlateGray'] = '#708090'; + $color['SlateGrey'] = '#708090'; + $color['Snow'] = '#FFFAFA'; + $color['SpringGreen'] = '#00FF7F'; + $color['SteelBlue'] = '#4682B4'; + $color['Tan'] = '#D2B48C'; + $color['Teal'] = '#008080'; + $color['Thistle'] = '#D8BFD8'; + $color['Tomato'] = '#FF6347'; + $color['Turquoise'] = '#40E0D0'; + $color['Violet'] = '#EE82EE'; + $color['Wheat'] = '#F5DEB3'; + $color['White'] = '#FFFFFF'; + $color['WhiteSmoke'] = '#F5F5F5'; + $color['Yellow'] = '#FFFF00'; + $color['YellowGreen'] = '#9ACD32'; + + $this->htmlColor = array(); + foreach($color as $key => $val) $this->htmlColor[strtolower($key)] = $val; + unset($color); + + $this->table = array(); + + $this->value = array(); + $this->initStyle(); + + // initialisation des styles sans héritages + $this->resetStyle(); + } + + function initStyle() + { + $this->value['id_balise'] = 'body'; // balise + $this->value['id_name'] = null; // name + $this->value['id_id'] = null; // id + $this->value['id_class'] = null; // class + $this->value['id_lst'] = array('*'); // lst de dependance + $this->value['mini-size'] = 1.; // rapport de taille spécifique aux sup, sub + $this->value['mini-decal'] = 0; // rapport de position spécifique aux sup, sub + $this->value['font-family'] = 'Arial'; + $this->value['font-bold'] = false; + $this->value['font-italic'] = false; + $this->value['font-underline'] = false; + $this->value['font-overline'] = false; + $this->value['font-linethrough'] = false; + $this->value['text-transform'] = 'none'; + $this->value['font-size'] = $this->ConvertToMM('10pt'); + $this->value['text-indent'] = 0; + $this->value['text-align'] = 'left'; + $this->value['vertical-align'] = 'middle'; + $this->value['line-height'] = 'normal'; + + $this->value['position'] = null; + $this->value['x'] = null; + $this->value['y'] = null; + $this->value['width'] = 0; + $this->value['height'] = 0; + $this->value['top'] = null; + $this->value['right'] = null; + $this->value['bottom'] = null; + $this->value['left'] = null; + $this->value['float'] = null; + $this->value['display'] = null; + $this->value['rotate'] = null; + $this->value['overflow'] = 'visible'; + + $this->value['color'] = array(0, 0, 0); + $this->value['background'] = array('color' => null, 'image' => null, 'position' => null, 'repeat' => null); + $this->value['border'] = array(); + $this->value['padding'] = array(); + $this->value['margin'] = array(); + $this->value['margin-auto'] = false; + + $this->value['list-style-type'] = ''; + $this->value['list-style-image'] = ''; + + $this->value['xc'] = null; + $this->value['yc'] = null; + } + + /** + * Initialisation des styles sans héritages + * + * @param string balise HTML + * @return null + */ + function resetStyle($balise = '') + { + $collapse = isset($this->value['border']['collapse']) ? $this->value['border']['collapse'] : false; + if (!in_array($balise, array('tr', 'td', 'th'))) $collapse = false; + + $this->value['position'] = null; + $this->value['x'] = null; + $this->value['y'] = null; + $this->value['width'] = 0; + $this->value['height'] = 0; + $this->value['top'] = null; + $this->value['right'] = null; + $this->value['bottom'] = null; + $this->value['left'] = null; + $this->value['float'] = null; + $this->value['display'] = null; + $this->value['rotate'] = null; + $this->value['overflow'] = 'visible'; + $this->value['background'] = array('color' => null, 'image' => null, 'position' => null, 'repeat' => null); + $this->value['border'] = array( + 't' => $this->readBorder('none'), + 'r' => $this->readBorder('none'), + 'b' => $this->readBorder('none'), + 'l' => $this->readBorder('none'), + 'radius' => array(0, 0), + 'collapse' => $collapse, + ); + + if (!in_array($balise, array('h1', 'h2', 'h3', 'h4', 'h5', 'h6'))) + $this->value['margin'] = array( + 't' => 0, + 'r' => 0, + 'b' => 0, + 'l' => 0 + ); + $this->value['margin-auto'] = false; + + if (in_array($balise, array('div'))) + $this->value['vertical-align'] = 'top'; + + if (in_array($balise, array('ul', 'li'))) + { + $this->value['list-style-type'] = ''; + $this->value['list-style-image'] = ''; + } + + if (!in_array($balise, array('tr', 'td'))) + { + $this->value['padding'] = array( + 't' => 0, + 'r' => 0, + 'b' => 0, + 'l' => 0 + ); + } + else + { + $this->value['padding'] = array( + 't' => $this->ConvertToMM('1px'), + 'r' => $this->ConvertToMM('1px'), + 'b' => $this->ConvertToMM('1px'), + 'l' => $this->ConvertToMM('1px') + ); + } + + if ($balise=='hr') + { + $this->value['border'] = array( + 't' => $this->readBorder('solid 1px #000000'), + 'r' => $this->readBorder('solid 1px #000000'), + 'b' => $this->readBorder('solid 1px #000000'), + 'l' => $this->readBorder('solid 1px #000000'), + 'radius' => array(0, 0), + 'collapse' => false, + ); + $this->ConvertBackground('#FFFFFF', $this->value['background']); + } + + $this->value['xc'] = null; + $this->value['yc'] = null; + } + + /** + * Initialisation de la font PDF + * + * @return null + */ + function FontSet() + { + $family = strtolower($this->value['font-family']); + $b = ($this->value['font-bold'] ? 'B' : ''); + $i = ($this->value['font-italic'] ? 'I' : ''); + $u = ($this->value['font-underline'] ? 'U' : ''); + + if ($this->defaultFont) + { + $style = $b.$i; + if($family=='arial') + $family='helvetica'; + elseif($family=='symbol' || $family=='zapfdingbats') + $style=''; + + $fontkey = $family.$style; + if (!isset($this->pdf->fonts[$fontkey])) + if (!isset($this->pdf->CoreFonts[$fontkey])) + $family = $this->defaultFont; + } + + // taille en mm, à ramener en pt + $size = $this->value['font-size']; + $size = 72 * $size / 25.4; + + $this->pdf->setOverline($this->value['font-overline']); + $this->pdf->setLinethrough($this->value['font-linethrough']); + + // application de la fonte + $this->pdf->SetFont($family, $b.$i.$u, $this->value['mini-size']*$size); + $this->pdf->setMyTextColor($this->value['color']); + if ($this->value['background']['color']) + $this->pdf->setMyFillColor($this->value['background']['color']); + else + $this->pdf->setMyFillColor(1.); + } + + /** + * Monter d'un niveau dans l'historisation + * + * @return null + */ + function save() + { + $this->table[count($this->table)] = $this->value; + } + + /** + * Descendre d'un niveau dans l'historisation + * + * @return null + */ + function load() + { + if (count($this->table)) + { + $this->value = $this->table[count($this->table)-1]; + unset($this->table[count($this->table)-1]); + } + } + + function restorePosition(&$current_x, &$current_y) + { + if ($this->value['y']==$current_y) $current_y = $this->value['yc']; + } + + function setPosition(&$current_x, &$current_y) + { + $this->value['xc'] = $current_x; + $this->value['yc'] = $current_y; + + if ($this->value['position']=='relative' || $this->value['position']=='absolute') + { + if ($this->value['right']!==null) + { + $x = $this->getLastWidth(true) - $this->value['right'] - $this->value['width']; + if ($this->value['margin']['r']) $x-= $this->value['margin']['r']; + } + else + { + $x = $this->value['left']; + if ($this->value['margin']['l']) $x+= $this->value['margin']['l']; + } + + if ($this->value['bottom']!==null) + { + $y = $this->getLastHeight(true) - $this->value['bottom'] - $this->value['height']; + if ($this->value['margin']['b']) $y-= $this->value['margin']['b']; + } + else + { + $y = $this->value['top']; + if ($this->value['margin']['t']) $y+= $this->value['margin']['t']; + } + + if ($this->value['position']=='relative') + { + $this->value['x'] = $current_x + $x; + $this->value['y'] = $current_y + $y; + } + else + { + $this->value['x'] = $this->getLastAbsoluteX()+$x; + $this->value['y'] = $this->getLastAbsoluteY()+$y; + } + } + else + { + $this->value['x'] = $current_x; + $this->value['y'] = $current_y; + if ($this->value['margin']['l']) $this->value['x']+= $this->value['margin']['l']; + if ($this->value['margin']['t']) $this->value['y']+= $this->value['margin']['t']; + } + + $current_x = $this->value['x']; + $current_y = $this->value['y']; + } + + /** + * Analyse un tableau de style provenant du parseurHTML + * + * @param string nom de la balise + * @param array tableau de style + * @return null + */ + function analyse($balise, &$param) + { + // preparation + $balise = strtolower($balise); + $id = isset($param['id']) ? strtolower(trim($param['id'])) : null; if (!$id) $id = null; + $name = isset($param['name']) ? strtolower(trim($param['name'])) : null; if (!$name) $name = null; + + // lecture de la propriete classe + $class = array(); + $tmp = isset($param['class']) ? preg_replace('/[\s]+/', ' ', strtolower($param['class'])) : ''; + $tmp = explode(' ', $tmp); + foreach($tmp as $k => $v) + { + $v = trim($v); + if ($v) $class[] = $v; + } + + // identification de la balise et des styles direct qui pourraient lui être appliqués + $this->value['id_balise'] = $balise; + $this->value['id_name'] = $name; + $this->value['id_id'] = $id; + $this->value['id_class'] = $class; + $this->value['id_lst'] = array(); + $this->value['id_lst'][] = '*'; + $this->value['id_lst'][] = $balise; + if (count($class)) + { + foreach($class as $v) + { + $this->value['id_lst'][] = '*.'.$v; + $this->value['id_lst'][] = '.'.$v; + $this->value['id_lst'][] = $balise.'.'.$v; + } + } + if ($id) + { + $this->value['id_lst'][] = '*#'.$id; + $this->value['id_lst'][] = '#'.$id; + $this->value['id_lst'][] = $balise.'#'.$id; + } + + // style CSS + $styles = $this->getFromCSS(); + + // on ajoute le style propre à la balise + $styles = array_merge($styles, $param['style']); + if (isset($param['allwidth']) && !isset($styles['width'])) $styles['width'] = '100%'; + + // mise à zero des styles non hérités + $this->resetStyle($balise); + + // interpreration des nouvelles valeurs + $correct_width = false; + $no_width = true; + + foreach($styles as $nom => $val) + { + switch($nom) + { + case 'font-family': + $val = explode(',', $val); + $val = trim($val[0]); + + if ($val) $this->value['font-family'] = $val; + break; + + case 'font-weight': + $this->value['font-bold'] = ($val=='bold'); + break; + + case 'font-style': + $this->value['font-italic'] = ($val=='italic'); + break; + + case 'text-decoration': + $val = explode(' ', $val); + $this->value['font-underline'] = (in_array('underline', $val)); + $this->value['font-overline'] = (in_array('overline', $val)); + $this->value['font-linethrough'] = (in_array('line-through', $val)); + break; + + case 'text-indent': + $this->value['text-indent'] = $this->ConvertToMM($val); + break; + + case 'text-transform': + if (!in_array($val, array('none', 'capitalize', 'uppercase', 'lowercase'))) $val = 'none'; + $this->value['text-transform'] = $val; + break; + + case 'font-size': + $val = $this->ConvertToMM($val, $this->value['font-size']); + if ($val) $this->value['font-size'] = $val; + break; + + case 'color': + $res = null; + $this->value['color'] = $this->ConvertToColor($val, $res); + + if ($balise=='hr') + { + $this->value['border']['l']['color'] = $this->value['color']; + $this->value['border']['t']['color'] = $this->value['color']; + $this->value['border']['r']['color'] = $this->value['color']; + $this->value['border']['b']['color'] = $this->value['color']; + } + break; + + case 'text-align': + $this->value['text-align'] = $val; + break; + + case 'vertical-align': + $this->value['vertical-align'] = $val; + break; + + case 'width': + $this->value['width'] = $this->ConvertToMM($val, $this->getLastWidth()); + if ($this->value['width'] && substr($val, -1)=='%') $correct_width=true; + $no_width = false; + break; + + case 'height': + $this->value['height'] = $this->ConvertToMM($val, $this->getLastHeight()); + break; + + case 'line-height': + if (preg_match('/^[0-9\.]+$/isU', $val)) $val = floor($val*100).'%'; + $this->value['line-height'] = $val; + break; + + case 'rotate': + if (!in_array($val, array(0, -90, 90, 180, 270, -180, -270))) $val = null; + if ($val<0) $val+= 360; + $this->value['rotate'] = $val; + break; + + case 'overflow': + if (!in_array($val, array('visible', 'hidden'))) $val = 'visible'; + $this->value['overflow'] = $val; + break; + + case 'padding': + $val = explode(' ', $val); + foreach($val as $k => $v) + { + $v = trim($v); + if ($v!='') $val[$k] = $v; + else unset($val[$k]); + } + $val = array_values($val); + if (count($val)!=4) + { + $val = $this->ConvertToMM($val[0], 0); + $this->value['padding']['t'] = $val; + $this->value['padding']['r'] = $val; + $this->value['padding']['b'] = $val; + $this->value['padding']['l'] = $val; + } + else + { + $this->value['padding']['t'] = $this->ConvertToMM($val[0], 0); + $this->value['padding']['r'] = $this->ConvertToMM($val[1], 0); + $this->value['padding']['b'] = $this->ConvertToMM($val[2], 0); + $this->value['padding']['l'] = $this->ConvertToMM($val[3], 0); + } + break; + + case 'padding-top': + $this->value['padding']['t'] = $this->ConvertToMM($val, 0); + break; + + case 'padding-right': + $this->value['padding']['r'] = $this->ConvertToMM($val, 0); + break; + + case 'padding-bottom': + $this->value['padding']['b'] = $this->ConvertToMM($val, 0); + break; + + case 'padding-left': + $this->value['padding']['l'] = $this->ConvertToMM($val, 0); + break; + + case 'margin': + if ($val=='auto') + { + $this->value['margin-auto'] = true; + break; + } + $val = explode(' ', $val); + foreach($val as $k => $v) + { + $v = trim($v); + if ($v!='') $val[$k] = $v; + else unset($val[$k]); + } + $val = array_values($val); + if (count($val)!=4) + { + $val = $this->ConvertToMM($val[0], 0); + $this->value['margin']['t'] = $val; + $this->value['margin']['r'] = $val; + $this->value['margin']['b'] = $val; + $this->value['margin']['l'] = $val; + } + else + { + $this->value['margin']['t'] = $this->ConvertToMM($val[0], 0); + $this->value['margin']['r'] = $this->ConvertToMM($val[1], 0); + $this->value['margin']['b'] = $this->ConvertToMM($val[2], 0); + $this->value['margin']['l'] = $this->ConvertToMM($val[3], 0); + } + break; + + case 'margin-top': + $this->value['margin']['t'] = $this->ConvertToMM($val, 0); + break; + + case 'margin-right': + $this->value['margin']['r'] = $this->ConvertToMM($val, 0); + break; + + case 'margin-bottom': + $this->value['margin']['b'] = $this->ConvertToMM($val, 0); + break; + + case 'margin-left': + $this->value['margin']['l'] = $this->ConvertToMM($val, 0); + break; + + case 'border': + $val = $this->readBorder($val); + $this->value['border']['t'] = $val; + $this->value['border']['r'] = $val; + $this->value['border']['b'] = $val; + $this->value['border']['l'] = $val; + break; + + case 'border-style': + $val = explode(' ', $val); + foreach($val as $val_k => $val_v) + if (!in_array($val_v, array('solid', 'dotted', 'dashed'))) + $val[$val_k] = null; + $this->duplicateBorder($val); + + if ($val[0]) $this->value['border']['t']['type'] = $val[0]; + if ($val[1]) $this->value['border']['r']['type'] = $val[1]; + if ($val[2]) $this->value['border']['b']['type'] = $val[2]; + if ($val[3]) $this->value['border']['l']['type'] = $val[3]; + break; + + case 'border-top-style': + if (in_array($val, array('solid', 'dotted', 'dashed'))) + $this->value['border']['t']['type'] = $val; + break; + + case 'border-right-style': + if (in_array($val, array('solid', 'dotted', 'dashed'))) + $this->value['border']['r']['type'] = $val; + break; + + case 'border-bottom-style': + if (in_array($val, array('solid', 'dotted', 'dashed'))) + $this->value['border']['b']['type'] = $val; + break; + + case 'border-left-style': + if (in_array($val, array('solid', 'dotted', 'dashed'))) + $this->value['border']['l']['type'] = $val; + break; + + case 'border-color': + $res = false; + $val = preg_replace('/,[\s]+/', ',', $val); + $val = explode(' ', $val); + + foreach($val as $val_k => $val_v) + { + $val[$val_k] = $this->ConvertToColor($val_v, $res); + if (!$res) $val[$val_k] = null; + } + $this->duplicateBorder($val); + + if (is_array($val[0])) $this->value['border']['t']['color'] = $val[0]; + if (is_array($val[1])) $this->value['border']['r']['color'] = $val[1]; + if (is_array($val[2])) $this->value['border']['b']['color'] = $val[2]; + if (is_array($val[3])) $this->value['border']['l']['color'] = $val[3]; + + break; + + case 'border-top-color': + $res = false; + $val = $this->ConvertToColor($val, $res); + if ($res) $this->value['border']['t']['color'] = $val; + break; + + case 'border-right-color': + $res = false; + $val = $this->ConvertToColor($val, $res); + if ($res) $this->value['border']['r']['color'] = $val; + break; + + case 'border-bottom-color': + $res = false; + $val = $this->ConvertToColor($val, $res); + if ($res) $this->value['border']['b']['color'] = $val; + break; + + case 'border-left-color': + $res = false; + $val = $this->ConvertToColor($val, $res); + if ($res) $this->value['border']['l']['color'] = $val; + break; + + case 'border-width': + $val = explode(' ', $val); + foreach($val as $val_k => $val_v) + { + $val[$val_k] = $this->ConvertToMM($val_v, 0); + } + $this->duplicateBorder($val); + + if ($val[0]) $this->value['border']['t']['width'] = $val[0]; + if ($val[1]) $this->value['border']['r']['width'] = $val[1]; + if ($val[2]) $this->value['border']['b']['width'] = $val[2]; + if ($val[3]) $this->value['border']['l']['width'] = $val[3]; + break; + + case 'border-top-width': + $val = $this->ConvertToMM($val, 0);; + if ($val) $this->value['border']['t']['width'] = $val; + break; + + case 'border-right-width': + $val = $this->ConvertToMM($val, 0);; + if ($val) $this->value['border']['r']['width'] = $val; + break; + + case 'border-bottom-width': + $val = $this->ConvertToMM($val, 0);; + if ($val) $this->value['border']['b']['width'] = $val; + break; + + case 'border-left-width': + $val = $this->ConvertToMM($val, 0);; + if ($val) $this->value['border']['l']['width'] = $val; + break; + + case 'border-collapse': + if ($balise=='table') $this->value['border']['collapse'] = ($val=='collapse'); + break; + + case 'border-radius': + // nettoyage des valeurs + $val = explode(' ', $val); + foreach($val as $k => $v) + { + $v = trim($v); + if ($v) + { + $v = $this->ConvertToMM($v, 0); + if ($v) $val[$k] = $v; + else unset($val[$k]); + } + else unset($val[$k]); + } + $val = array_values($val); + + if (!isset($val[1]) && isset($val[0])) $val[1] = $val[0]; + if (count($val)==2) + $this->value['border']['radius'] = array($val[0], $val[1]); + + break; + + case 'border-top': + $this->value['border']['t'] = $this->readBorder($val); + break; + + case 'border-right': + $this->value['border']['r'] = $this->readBorder($val); + break; + + case 'border-bottom': + $this->value['border']['b'] = $this->readBorder($val); + break; + + case 'border-left': + $this->value['border']['l'] = $this->readBorder($val); + break; + + case 'background-color': + $this->value['background']['color'] = $this->ConvertBackgroundColor($val); + break; + + case 'background-image': + $this->value['background']['image'] = $this->ConvertBackgroundImage($val); + break; + + case 'background-position': + $res = null; + $this->value['background']['position'] = $this->ConvertBackgroundPosition($val, $res); + break; + + case 'background-repeat': + $this->value['background']['repeat'] = $this->ConvertBackgroundRepeat($val); + break; + + case 'background': + $this->ConvertBackground($val, $this->value['background']); + break; + + case 'position': + if ($val=='absolute') $this->value['position'] = 'absolute'; + else if ($val=='relative') $this->value['position'] = 'relative'; + else $this->value['position'] = null; + break; + + case 'float': + if ($val=='left') $this->value['float'] = 'left'; + else if ($val=='right') $this->value['float'] = 'right'; + else $this->value['float'] = null; + break; + + case 'display': + if ($val=='inline') $this->value['display'] = 'inline'; + else if ($val=='block') $this->value['display'] = 'block'; + else if ($val=='none') $this->value['display'] = 'none'; + else $this->value['display'] = null; + break; + + case 'top': + case 'bottom': + case 'left': + case 'right': + $this->value[$nom] = $val; + break; + + case 'list-style': + case 'list-style-type': + case 'list-style-image': + if ($nom=='list-style') $nom = 'list-style-type'; + $this->value[$nom] = $val; + break; + + default: + break; + } + } + + if ($this->onlyLeft) $this->value['text-align'] = 'left'; + + // correction de la largeur pour correspondre au modèle de boite quick + if ($no_width && in_array($balise, array('div')) && $this->value['position']!='absolute') + { + $this->value['width'] = $this->getLastWidth(); + $this->value['width']-= $this->value['margin']['l'] + $this->value['margin']['r']; + } + else + { + if ($correct_width) + { + if (!in_array($balise, array('table', 'div', 'hr'))) + { + $this->value['width']-= $this->value['padding']['l'] + $this->value['padding']['r']; + $this->value['width']-= $this->value['border']['l']['width'] + $this->value['border']['r']['width']; + } + if (in_array($balise, array('th', 'td'))) + { + $this->value['width']-= $this->ConvertToMM(isset($param['cellspacing']) ? $param['cellspacing'] : '2px'); + } + if ($this->value['width']<0) $this->value['width']=0; + } + else + { + if ($this->value['width']) + { + if ($this->value['border']['l']['width']) $this->value['width'] += $this->value['border']['l']['width']; + if ($this->value['border']['r']['width']) $this->value['width'] += $this->value['border']['r']['width']; + if ($this->value['padding']['l']) $this->value['width'] += $this->value['padding']['l']; + if ($this->value['padding']['r']) $this->value['width'] += $this->value['padding']['r']; + } + } + } + if ($this->value['height']) + { + if ($this->value['border']['b']['width']) { $this->value['height'] += $this->value['border']['b']['width']; } + if ($this->value['border']['t']['width']) { $this->value['height'] += $this->value['border']['t']['width']; } + if ($this->value['padding']['b']) $this->value['height'] += $this->value['padding']['b']; + if ($this->value['padding']['t']) $this->value['height'] += $this->value['padding']['t']; + } + + if ($this->value['top']!=null) $this->value['top'] = $this->ConvertToMM($this->value['top'], $this->getLastHeight(true)); + if ($this->value['bottom']!=null) $this->value['bottom'] = $this->ConvertToMM($this->value['bottom'], $this->getLastHeight(true)); + if ($this->value['left']!=null) $this->value['left'] = $this->ConvertToMM($this->value['left'], $this->getLastWidth(true)); + if ($this->value['right']!=null) $this->value['right'] = $this->ConvertToMM($this->value['right'], $this->getLastWidth(true)); + + if ($this->value['top'] && $this->value['bottom'] && $this->value['height']) $this->value['bottom'] = null; + if ($this->value['left'] && $this->value['right'] && $this->value['width']) $this->value['right'] = null; + } + + /** + * Récupération de la hauteur de ligne courante + * + * @return float hauteur en mm + */ + function getLineHeight() + { + $val = $this->value['line-height']; + if ($val=='normal') $val = '108%'; + return $this->ConvertToMM($val, $this->value['font-size']); + } + + /** + * Récupération de la largeur de l'objet parent + * + * @return float largeur + */ + function getLastWidth($mode = false) + { + for($k=count($this->table); $k>0; $k--) + { + if ($this->table[$k-1]['width']) + { + $w = $this->table[$k-1]['width']; + if ($mode) + { + $w+= $this->table[$k-1]['border']['l']['width'] + $this->table[$k-1]['padding']['l']+0.02; + $w+= $this->table[$k-1]['border']['r']['width'] + $this->table[$k-1]['padding']['r']+0.02; + } + return $w; + } + } + return $this->pdf->w - $this->pdf->lMargin - $this->pdf->rMargin; + } + + /** + * Récupération de la hauteur de l'objet parent + * + * @return float hauteur + */ + function getLastHeight($mode = false) + { + for($k=count($this->table); $k>0; $k--) + { + if ($this->table[$k-1]['height']) + { + $h = $this->table[$k-1]['height']; + if ($mode) + { + $h+= $this->table[$k-1]['border']['t']['width'] + $this->table[$k-1]['padding']['t']+0.02; + $h+= $this->table[$k-1]['border']['b']['width'] + $this->table[$k-1]['padding']['b']+0.02; + } + return $h; + } + } + return $this->pdf->h - $this->pdf->tMargin - $this->pdf->bMargin; + } + + function getFloat() + { + if ($this->value['float']=='left') return 'left'; + if ($this->value['float']=='right') return 'right'; + return null; + } + + function getParentBalise() + { + $nb = count($this->table); + if ($nb>0) + return $this->table[$nb-1]['id_balise']; + return null; + } + + function getLastAbsoluteX() + { + for($k=count($this->table); $k>0; $k--) + { + if ($this->table[$k-1]['x'] && $this->table[$k-1]['position']) return $this->table[$k-1]['x']; + } + return $this->pdf->lMargin; + } + + function getLastAbsoluteY() + { + for($k=count($this->table); $k>0; $k--) + { + if ($this->table[$k-1]['y'] && $this->table[$k-1]['position']) return $this->table[$k-1]['y']; + } + return $this->pdf->tMargin; + } + + /** + * Récupération des propriétés CSS de la balise en cours + * + * @return array() tableau des propriétés CSS + */ + function getFromCSS() + { + $styles = array(); // style à appliquer + $getit = array(); // styles à récuperer + + // identification des styles direct, et ceux des parents + $lst = array(); + $lst[] = $this->value['id_lst']; + for($i=count($this->table)-1; $i>=0; $i--) $lst[] = $this->table[$i]['id_lst']; + + // identification des styles à récuperer + foreach($this->css_keys as $key => $num) + if ($this->getReccursiveStyle($key, $lst)) + $getit[$key] = $num; + + // si des styles sont à recuperer + if (count($getit)) + { + // on les récupère, mais dans l'odre de définition, afin de garder les priorités + asort($getit); + foreach($getit as $key => $val) $styles = array_merge($styles, $this->css[$key]); + } + + return $styles; + } + + /** + * Identification des styles à récuperer, en fonction de la balise et de ses parents + * + * @param string clef CSS à analyser + * @param array() tableau des styles direct, et ceux des parents + * @param string prochaine etape + * @return boolean clef autorisée ou non + */ + function getReccursiveStyle($key, $lst, $next = null) + { + // si propchaine etape, on construit les valeurs + if ($next!==null) + { + if ($next) $key = trim(substr($key, 0, -strlen($next))); // on elève cette etape + unset($lst[0]); + if (!count($lst)) return false; // pas d'etape possible + $lst = array_values($lst); + } + + // pour chaque style direct possible de l'etape en cours + foreach($lst[0] as $nom) + { + if ($key==$nom) return true; // si la clef conrrespond => ok + if (substr($key, -strlen(' '.$nom))==' '.$nom && $this->getReccursiveStyle($key, $lst, $nom)) return true; // si la clef est la fin, on analyse ce qui précède + } + + // si on est pas à la premiere etape, on doit analyse toutes les sous etapes + if ($next!==null && $this->getReccursiveStyle($key, $lst, '')) return true; + + // aucun style trouvé + return false; + } + + /** + * Analyse d'une propriété Border + * + * @param string propriété border + * @return array() propriété décodée + */ + function readBorder($val) + { + $none = array('type' => 'none', 'width' => 0, 'color' => array(0, 0, 0)); + + // valeurs par défault + $type = 'solid'; + $width = $this->ConvertToMM('1pt'); + $color = array(0, 0, 0); + + // nettoyage des valeurs + $val = explode(' ', $val); + foreach($val as $k => $v) + { + $v = trim($v); + if ($v) $val[$k] = $v; + else unset($val[$k]); + } + $val = array_values($val); + // identification des valeurs + $res = null; + foreach($val as $key) + { + if ($key=='none' || $key=='hidden') return $none; + + if ($this->ConvertToMM($key)!==null) $width = $this->ConvertToMM($key); + else if (in_array($key, array('solid', 'dotted', 'dashed'))) $type = $key; + else + { + $tmp = $this->ConvertToColor($key, $res); + if ($res) $color = $tmp; + } + } + if (!$width) return $none; + return array('type' => $type, 'width' => $width, 'color' => $color); + } + + function duplicateBorder(&$val) + { + if (count($val)==1) + { + $val[1] = $val[0]; + $val[2] = $val[0]; + $val[3] = $val[0]; + } + else if (count($val)==2) + { + $val[2] = $val[0]; + $val[3] = $val[1]; + } + else if (count($val)==3) + { + $val[3] = $val[1]; + } + } + + function ConvertBackground($stl, &$res) + { + // Image + $text = '/url\(([^)]*)\)/isU'; + if (preg_match($text, $stl, $match)) + { + $res['image'] = $this->ConvertBackgroundImage($match[0]); + $stl = preg_replace($text, '', $stl); + $stl = preg_replace('/[\s]+/', ' ', $stl); + } + + // protection des espaces + $stl = preg_replace('/,[\s]+/', ',', $stl); + $lst = explode(' ', $stl); + + $pos = ''; + foreach($lst as $val) + { + $ok = false; + $color = $this->ConvertToColor($val, $ok); + + if ($ok) + { + $res['color'] = $color; + } + else if ($val=='transparent') + { + $res['color'] = null; + } + else + { + $repeat = $this->ConvertBackgroundRepeat($val); + if ($repeat) + { + $res['repeat'] = $repeat; + } + else + { + $pos.= ($pos ? ' ' : '').$val; + } + } + } + if ($pos) + { + $pos = $this->ConvertBackgroundPosition($pos, $ok); + if ($ok) $res['position'] = $pos; + } + } + + function ConvertBackgroundColor($val) + { + $res = null; + if ($val=='transparent') return null; + else return $this->ConvertToColor($val, $res); + } + + function ConvertBackgroundImage($val) + { + if ($val=='none') + return null; + else if (preg_match('/^url\(([^)]*)\)$/isU', $val, $match)) + return $match[1]; + else + return null; + } + + function ConvertBackgroundPosition($val, &$res) + { + $val = explode(' ', $val); + if (count($val)<2) + { + if (!$val[0]) return null; + $val[1] = 'center'; + } + if (count($val)>2) return null; + + $x = 0; + $y = 0; + $res = true; + + if ($val[0]=='left') $x = '0%'; + else if ($val[0]=='center') $x = '50%'; + else if ($val[0]=='right') $x = '100%'; + else if ($val[0]=='top') $y = '0%'; + else if ($val[0]=='bottom') $y = '100%'; + else if (preg_match('/^[-]?[0-9\.]+%$/isU', $val[0])) $x = $val[0]; + else if ($this->ConvertToMM($val[0])) $x = $this->ConvertToMM($val[0]); + else $res = false; + + if ($val[1]=='left') $x = '0%'; + else if ($val[1]=='right') $x = '100%'; + else if ($val[1]=='top') $y = '0%'; + else if ($val[1]=='center') $y = '50%'; + else if ($val[1]=='bottom') $y = '100%'; + else if (preg_match('/^[-]?[0-9\.]+%$/isU', $val[1])) $y = $val[1]; + else if ($this->ConvertToMM($val[1])) $y = $this->ConvertToMM($val[1]); + else $res = false; + + $val[0] = $x; + $val[1] = $y; + + return $val; + } + + function ConvertBackgroundRepeat($val) + { + switch($val) + { + case 'repeat': + return array(true, true); + case 'repeat-x': + return array(true, false); + case 'repeat-y': + return array(false, true); + case 'no-repeat': + return array(false, false); + } + return null; + } + /** + * Convertir une longueur en mm + * + * @param string longueur, avec unité, à convertir + * @param float longueur du parent + * @return float longueur exprimée en mm + */ + function ConvertToMM($val, $old=0.) + { + $val = trim($val); + if (preg_match('/^[0-9\.\-]+$/isU', $val)) $val.= 'px'; + if (preg_match('/^[0-9\.\-]+px$/isU', $val)) $val = 25.4/96. * str_replace('px', '', $val); + else if (preg_match('/^[0-9\.\-]+pt$/isU', $val)) $val = 25.4/72. * str_replace('pt', '', $val); + else if (preg_match('/^[0-9\.\-]+in$/isU', $val)) $val = 25.4 * str_replace('in', '', $val); + else if (preg_match('/^[0-9\.\-]+mm$/isU', $val)) $val = 1.*str_replace('mm', '', $val); + else if (preg_match('/^[0-9\.\-]+%$/isU', $val)) $val = 1.*$old*str_replace('%', '', $val)/100.; + else $val = null; + + return $val; + } + + /** + * Décomposition d'un code couleur HTML + * + * @param string couleur au format CSS + * @return array(r, v, b) couleur exprimé par ses comporantes R, V, B, de 0 à 255. + */ + function ConvertToColor($val, &$res) + { + $val = trim($val); + $res = true; + + if (strtolower($val)=='transparent') return array(null, null, null); + if (isset($this->htmlColor[strtolower($val)])) $val = $this->htmlColor[strtolower($val)]; + + if (preg_match('/^#[0-9A-Fa-f]{6}$/isU', $val)) + { + $r = floatVal(hexdec(substr($val, 1, 2)))/255.; + $v = floatVal(hexdec(substr($val, 3, 2)))/255.; + $b = floatVal(hexdec(substr($val, 5, 2)))/255.; + $col = array($r, $v, $b); + } + elseif (preg_match('/^#[0-9A-F]{3}$/isU', $val)) + { + $r = floatVal(hexdec(substr($val, 1, 1).substr($val, 1, 1)))/255.; + $v = floatVal(hexdec(substr($val, 2, 1).substr($val, 2, 1)))/255.; + $b = floatVal(hexdec(substr($val, 3, 1).substr($val, 3, 1)))/255.; + $col = array($r, $v, $b); + } + elseif (preg_match('/rgb\([\s]*([0-9%\.]+)[\s]*,[\s]*([0-9%\.]+)[\s]*,[\s]*([0-9%\.]+)[\s]*\)/isU', $val, $match)) + { + $r = $this->ConvertSubColor($match[1]); + $v = $this->ConvertSubColor($match[2]); + $b = $this->ConvertSubColor($match[3]); + $col = array($r, $v, $b); + } + elseif (preg_match('/cmyk\([\s]*([0-9%\.]+)[\s]*,[\s]*([0-9%\.]+)[\s]*,[\s]*([0-9%\.]+)[\s]*,[\s]*([0-9%\.]+)[\s]*\)/isU', $val, $match)) + { + $c = $this->ConvertSubColor($match[1]); + $m = $this->ConvertSubColor($match[2]); + $y = $this->ConvertSubColor($match[3]); + $k = $this->ConvertSubColor($match[4]); + $col = array($c, $m, $y, $k); + } + else + { + $col = array(0., 0., 0.); + $res = false; + } + + return $col; + } + + function ConvertSubColor($c) + { + if (substr($c, -1)=='%') $c = floatVal(substr($c, 0, -1))/100.; + else + { + $c = floatVal($c); + if ($c>1) $c = $c/255.; + } + return $c; + } + + /** + * Analyser une feuille de style + * + * @param string code CSS + * @return null + */ + function analyseStyle(&$code) + { + // on remplace tous les espaces, tab, \r, \n, par des espaces uniques + $code = preg_replace('/[\s]+/', ' ', $code); + + // on enlève les commentaires + $code = preg_replace('/\/\*.*?\*\//s', '', $code); + + // on analyse chaque style + preg_match_all('/([^{}]+){([^}]*)}/isU', $code, $match); + for($k=0; $k on remplie le tableau correspondant + $styles = trim($match[2][$k]); + $styles = explode(';', $styles); + $stl = array(); + foreach($styles as $style) + { + $tmp = explode(':', $style); + if (count($tmp)>1) + { + $cod = $tmp[0]; unset($tmp[0]); $tmp = implode(':', $tmp); + $stl[trim(strtolower($cod))] = trim($tmp); + } + } + + // décomposition des noms par les , + $noms = explode(',', $noms); + foreach($noms as $nom) + { + $nom = trim($nom); + // Si il a une fonction spécifique, comme :hover => on zap + if (strpos($nom, ':')!==false) continue; + if (!isset($this->css[$nom])) + $this->css[$nom] = $stl; + else + $this->css[$nom] = array_merge($this->css[$nom], $stl); + + } + } + + $this->css_keys = array_flip(array_keys($this->css)); + } + + /** + * Extraction des feuille de style du code HTML + * + * @param string code HTML + * @return null + */ + function readStyle(&$html) + { + $style = ' '; + + // extraction des balises link, et suppression de celles-ci dans le code HTML + preg_match_all('/]*)>/isU', $html, $match); + $html = preg_replace('/]*>/isU', '', $html); + $html = preg_replace('/<\/link[^>]*>/isU', '', $html); + + // analyse de chaque balise + foreach($match[1] as $code) + { + $tmp = array(); + // lecture des paramétres du type nom=valeur + $prop = '([a-zA-Z0-9_]+)=([^"\'\s>]+)'; + preg_match_all('/'.$prop.'/is', $code, $match); + for($k=0; $k on garde + if (isset($tmp['type']) && strtolower($tmp['type'])=='text/css' && isset($tmp['href'])) + { + $content = @file_get_contents($tmp['href']); + $url = $tmp['href']; + if (strpos($url, 'http://')!==false) + { + $url = str_replace('http://', '', $url); + $url = explode('/', $url); + $url_main = 'http://'.$url[0].'/'; + $url_self = $url; unset($url_self[count($url_self)-1]); $url_self = 'http://'.implode('/', $url_self).'/'; + + $content = preg_replace('/url\(([^\\\\][^)]*)\)/isU', 'url('.$url_self.'$1)', $content); + $content = preg_replace('/url\((\\\\[^)]*)\)/isU', 'url('.$url_main.'$1)', $content); + } + + $style.= $content."\n"; + } + } + + + // extraction des balises style, et suppression de celles-ci dans le code HTML + preg_match_all('/]*>(.*)<\/style[^>]*>/isU', $html, $match); + $html = preg_replace('/]*>(.*)<\/style[^>]*>/isU', '', $html); + + // analyse de chaque balise + foreach($match[1] as $code) + { + $code = str_replace('', '', $code); + $style.= $code."\n"; + } + + $this->analyseStyle($style); + } + } +} diff --git a/main/inc/lib/mimetex/README b/main/inc/lib/mimetex/README index dd94231284..3c34af6273 100755 --- a/main/inc/lib/mimetex/README +++ b/main/inc/lib/mimetex/README @@ -1,10 +1,11 @@ -------------------------------------------------------------------------- - September 6, 2008 Version 1.70 + March 24, 2009 Version 1.71 m i m e T e X R e a d m e F i l e + (including pre-compiled Linux binary mimetex.cgi -- see NOTE below) - Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved. + Copyright(c) 2002-2009, John Forkosh Associates, Inc. All rights reserved. -------------------------------------------------------------------------- by: John Forkosh @@ -12,10 +13,20 @@ This file is part of mimeTeX, which is free software. You may redistribute and/or modify it under the terms - of the GNU General Public License, version 3 or later, + of the GNU General Public License, version 2 or later, as published by the Free Software Foundation. See http://www.gnu.org/licenses/gpl.html + ------------------------------------------------------------- + NOTE for Linux users... + ------------------------------------------------------------- + This zip file contains pre-compiled binary image mimetex.cgi, + compiled under Debian GNU/Linux running kernel 2.4.32, with gcc + 3.3.5. It also contains all mimetex source files. The compile + command was + gcc -static -DAA mimetex.c gifsave.c -lm -o mimetex.cgi + ------------------------------------------------------------- + MimeTeX is discussed and illustrated online at its homepage http://www.forkosh.com/mimetex.html @@ -91,7 +102,7 @@ III. COMPILATION AND INSTALLATION Your working directory should now contain mimetex.zip your gnu zipped mimeTeX distribution containing... README this file (see mimetex.html for demo/tutorial) - COPYING GPL license, under which you may use mimeTeX + LICENSE GPL license, under which you may use mimeTeX mimetex.c mimeTeX source program and all required functions mimetex.h header file for mimetex.c (and for gfuntype.c) gfuntype.c parses output from gftype -i and writes bitmap data @@ -176,11 +187,7 @@ III. COMPILATION AND INSTALLATION IV. REVISION HISTORY ------------------------------------------------------------------------ - A more detailed account of mimeTeX's revision history - is maintained at http://www.forkosh.com/mimetexchangelog.html - --- - 09/06/08 J.Forkosh version 1.70 released. - 11/30/04 J.Forkosh version 1.60 released + 11/30/04 J.Forkosh version 1.60 (beta) released 10/02/04 J.Forkosh version 1.50 released on CTAN with various new features and fixes, and updated documentation. 07/18/04 J.Forkosh version 1.40 re-released on CTAN with minor @@ -212,5 +219,9 @@ V. CONCLUDING REMARKS I hope you find mimeTeX useful. If so, a contribution to your country's TeX Users Group, or to the GNU project, is suggested, especially if you're a company that's currently profitable. + + If you also like mimeTeX's source, I'm an independent contractor + incorporated in the US as John Forkosh Associates, Inc. A resume + is at www.forkosh.com or email john@forkosh.com ========================= END-OF-FILE README =========================== diff --git a/main/inc/lib/mimetex/mimetex.cgi b/main/inc/lib/mimetex/mimetex.cgi index 7a263c1099..92eaa57cea 100755 Binary files a/main/inc/lib/mimetex/mimetex.cgi and b/main/inc/lib/mimetex/mimetex.cgi differ diff --git a/main/inc/lib/mimetex/mimetex.exe b/main/inc/lib/mimetex/mimetex.exe index 4b6f285cff..87c6dd8fb2 100755 Binary files a/main/inc/lib/mimetex/mimetex.exe and b/main/inc/lib/mimetex/mimetex.exe differ diff --git a/main/install/dokeos_main.sql b/main/install/dokeos_main.sql index d55ad50ebb..246abb3808 100755 --- a/main/install/dokeos_main.sql +++ b/main/install/dokeos_main.sql @@ -219,9 +219,6 @@ CREATE TABLE course_field ( PRIMARY KEY(id) ); -INSERT INTO course_field (field_type, field_variable, field_display_text, field_default_value, field_visible, field_changeable) values (10, 'special_course','SpecialCourse', 'Yes', 1 , 1); - - -- -- Table structure for table course_field_values -- @@ -647,7 +644,7 @@ VALUES ('service_ppt2lp', 'ftp_password', 'textfield', NULL, NULL, 'FtpPassword', NULL, NULL, NULL, 0), ('service_ppt2lp', 'path_to_lzx', 'textfield', NULL, NULL, '', NULL, NULL, NULL, 0), ('service_ppt2lp', 'size', 'radio', NULL, '720x540', '', NULL, NULL, NULL, 0), -('wcag_anysurfer_public_pages', NULL, 'radio','Platform','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0), +('wcag_anysurfer_public_pages', NULL, 'radio','Editor','false','PublicPagesComplyToWAITitle','PublicPagesComplyToWAIComment', NULL, NULL, 0), ('stylesheets', NULL, 'textfield','stylesheets','dokeos_blue','',NULL, NULL, NULL, 1), ('upload_extensions_list_type', NULL, 'radio', 'Security', 'blacklist', 'UploadExtensionsListType', 'UploadExtensionsListTypeComment', NULL, NULL, 0), ('upload_extensions_blacklist', NULL, 'textfield', 'Security', '', 'UploadExtensionsBlacklist', 'UploadExtensionsBlacklistComment', NULL, NULL, 0), @@ -669,7 +666,6 @@ VALUES ('show_tabs', 'platform_administration', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsPlatformAdministration', 1), ('show_tabs', 'my_agenda', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyAgenda', 1), ('show_tabs', 'my_profile', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsMyProfile', 1), -('show_tabs', 'social', 'checkbox', 'Platform', 'true', 'ShowTabsTitle','ShowTabsComment',NULL,'TabsSocial', 0), ('default_forum_view', NULL, 'radio', 'Course', 'flat', 'DefaultForumViewTitle','DefaultForumViewComment',NULL,NULL, 0), ('platform_charset',NULL,'textfield','Platform','iso-8859-15','PlatformCharsetTitle','PlatformCharsetComment','platform',NULL, 0), ('noreply_email_address', '', 'textfield', 'Platform', '', 'NoReplyEmailAddress', 'NoReplyEmailAddressComment', NULL, NULL, 0), @@ -720,7 +716,7 @@ VALUES ('course_create_active_tools','survey','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Survey', 0), ('course_create_active_tools','glossary','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Glossary', 0), ('course_create_active_tools','notebook','checkbox','Tools','true','CourseCreateActiveToolsTitle','CourseCreateActiveToolsComment',NULL,'Notebook', 0), -('advanced_filemanager',NULL,'radio','Platform','false','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 0), +('advanced_filemanager',NULL,'radio','Editor','false','AdvancedFileManagerTitle','AdvancedFileManagerComment',NULL,NULL, 0), ('allow_reservation', NULL, 'radio', 'Tools', 'false', 'AllowReservationTitle', 'AllowReservationComment', NULL, NULL, 0), ('profile','apikeys','checkbox','User','false','ProfileChangesTitle','ProfileChangesComment',NULL,'ApiKeys', 0), ('allow_message_tool', NULL, 'radio', 'Tools', 'false', 'AllowMessageToolTitle', 'AllowMessageToolComment', NULL, NULL,0), @@ -739,7 +735,14 @@ VALUES ('show_glossary_in_extra_tools', NULL, 'radio', 'Course', 'false', 'ShowGlossaryInExtraToolsTitle', 'ShowGlossaryInExtraToolsComment', NULL, NULL,1), ('dokeos_database_version', NULL, 'textfield', NULL,'1.8.6.2.9070','DokeosDatabaseVersion','',NULL,NULL,0), ('send_email_to_admin_when_create_course',NULL,'radio','Platform','false','SendEmailToAdminTitle','SendEmailToAdminComment',NULL,NULL, 1), -('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0); +('go_to_course_after_login',NULL,'radio','Course','false','GoToCourseAfterLoginTitle','GoToCourseAfterLoginComment',NULL,NULL, 0), +('math_mimetex',NULL,'radio','Editor','false','MathMimetexTitle','MathMimetexComment',NULL,NULL, 0), +('math_asciimathML',NULL,'radio','Editor','false','MathASCIImathMLTitle','MathASCIImathMLComment',NULL,NULL, 0), +('youtube_for_students',NULL,'radio','Editor','true','YoutubeForStudentsTitle','YoutubeForStudentsComment',NULL,NULL, 0), +('block_copy_paste_for_students',NULL,'radio','Editor','false','BlockCopyPasteForStudentsTitle','BlockCopyPasteForStudentsComment',NULL,NULL, 0), +('more_buttons_maximized_mode',NULL,'radio','Editor','false','MoreButtonsForMaximizedModeTitle','MoreButtonsForMaximizedModeComment',NULL,NULL, 0), +('students_download_folders',NULL,'radio','Tools','true','AllowStudentsDownloadFoldersTitle','AllowStudentsDownloadFoldersComment',NULL,NULL, 0); + UNLOCK TABLES; /*!40000 ALTER TABLE settings_current ENABLE KEYS */; @@ -928,7 +931,19 @@ VALUES ('send_email_to_admin_when_create_course','true','Yes'), ('send_email_to_admin_when_create_course','false','No'), ('go_to_course_after_login','true','Yes'), -('go_to_course_after_login','false','No'); +('go_to_course_after_login','false','No'), +('math_mimetex','true','Yes'), +('math_mimetex','false','No'), +('math_asciimathML','true','Yes'), +('math_asciimathML','false','No'), +('youtube_for_students','true','Yes'), +('youtube_for_students','false','No'), +('block_copy_paste_for_students','true','Yes'), +('block_copy_paste_for_students','false','No'), +('more_buttons_maximized_mode','true','Yes'), +('more_buttons_maximized_mode','false','No'), +('students_download_folders','true','Yes'), +('students_download_folders','false','No'); UNLOCK TABLES; @@ -2277,6 +2292,7 @@ CREATE TABLE session_category ( -- Table structure for table user tag -- + CREATE TABLE tag ( id int NOT NULL auto_increment, tag varchar(255) NOT NULL, @@ -2336,8 +2352,9 @@ CREATE TABLE IF NOT EXISTS message_attachment ( message_id int NOT NULL, filename varchar(255) NOT NULL, PRIMARY KEY (id) -); +) + -INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (1, 'rssfeeds','RSS',0,0); -INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (10,'tags','tags',0,0); +INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (10, 'tags','tags',0,0); +INSERT INTO user_field (field_type, field_variable, field_display_text, field_visible, field_changeable) values (9, 'rssfeeds','RSS',0,0); diff --git a/main/lang/asturian/admin.inc.php b/main/lang/asturian/admin.inc.php index 18320a20fc..5cd3cebc93 100755 --- a/main/lang/asturian/admin.inc.php +++ b/main/lang/asturian/admin.inc.php @@ -979,6 +979,7 @@ $SoberBrown = "Marr $SteelGrey = "Gris aceru"; $TastyOlive = "Sabor oliva"; $AddNews = "Criar anunciu"; +$ExportCourses = "Esportar cursos"; $SearchDatabaseOpeningError = "Nun pudo abrise la base de datos del motor d\'indexáu, preba a amestar un recursu nuevu (exerciciu, enllaz, lleición, etc) el cual será indexáu al guetador"; $SearchDatabaseVersionError = "La base de datos ta nun formatu nun sofitáu"; $SearchDatabaseModifiedError = "La base de datos foi camudada"; @@ -1096,4 +1097,8 @@ $ShowGlossaryInExtraToolsComment = "Dende equ $FieldTypeTag = "Etiqueta d\'usuariu"; $SendEmailToAdminTitle = "Avisu por corréu electrónicu, de la criación d\'un cursu nuevu"; $SendEmailToAdminComment = "Unviar un corréu electrónicu al alministrador de la plataforma, cada vegada qu\'un mayestru crie un cursu nuevu"; +$UserTag = "Etiqueta d\'usuariu"; +$SelectSession = "Seleicionar sesión"; +$GroupPermissions = "Permisos del grupu"; +$SpecialCourse = "Cursu especial"; ?> \ No newline at end of file diff --git a/main/lang/asturian/course_home.inc.php b/main/lang/asturian/course_home.inc.php index 1d1e854fe2..a7bca0308f 100755 --- a/main/lang/asturian/course_home.inc.php +++ b/main/lang/asturian/course_home.inc.php @@ -27,4 +27,5 @@ $IntroductionTextDeleted = "Testu d\'entamu esborr $SessionIdentifier = "Identificador de la sesión"; $SessionName = "Nome de la sesión"; $SessionCategory = "Categoría de la sesión"; +$SessionData = "Datos de la sesión"; ?> \ No newline at end of file diff --git a/main/lang/asturian/slideshow.inc.php b/main/lang/asturian/slideshow.inc.php index 3ebfa57e35..a843623c76 100755 --- a/main/lang/asturian/slideshow.inc.php +++ b/main/lang/asturian/slideshow.inc.php @@ -18,4 +18,6 @@ $lang_next_slide = "Diapositiva siguiente"; $lang_image = "Imaxe"; $lang_of = "de"; $lang_view_slideshow = "Ver presentación"; +$FirstSlide = "Primer diapositiva"; +$LastSlide = "Cabera diapositiva"; ?> \ No newline at end of file diff --git a/main/lang/asturian/userInfo.inc.php b/main/lang/asturian/userInfo.inc.php index feb6de9dab..3542d3ceed 100755 --- a/main/lang/asturian/userInfo.inc.php +++ b/main/lang/asturian/userInfo.inc.php @@ -92,4 +92,6 @@ $SendInvitation = "Unviar invitaci $SocialInvitationToFriends = "Invitar a xunise a la mio rede de collacios"; $MyCertificates = "Los mios certificaos"; $ToChangeYourEmailMustTypeYourPassword = "Pa camudar el to corréu electrónicu tienes qu\'escribir la to contraseña"; +$Invitations = "Invitaciones"; +$MyGroups = "Los mios grupos"; ?> \ No newline at end of file diff --git a/main/lang/english/admin.inc.php b/main/lang/english/admin.inc.php index 5611470013..6b2dccd0d6 100755 --- a/main/lang/english/admin.inc.php +++ b/main/lang/english/admin.inc.php @@ -1103,4 +1103,21 @@ $GroupPermissions = "Group Permissions"; $MessagesSent = "Messages sent"; $MessagesReceived = "Messages received"; $CountFriends = "Number of friends"; +$SpecialCourse = "Special course"; +$MathMimetexTitle = "mimeTEX mathematical editor"; +$MathMimetexComment = "Enable mimeTeX mathematical editor"; +$MathASCIImathMLTitle = "SCIImathML mathematical editor"; +$MathASCIImathMLComment = "Enable SCIImathML mathematical editor"; +$YoutubeForStudentsTitle = "Allow students to insert videos from YouTube"; +$YoutubeForStudentsComment = "Enable the possibility that students can insert Youtube videos"; +$BlockCopyPasteForStudentsTitle = "Block students copy and paste"; +$BlockCopyPasteForStudentsComment = "Block students the ability to copy and paste into the WYSIWYG editor"; +$MoreButtonsForMaximizedModeTitle = "Buttons bar extended"; +$MoreButtonsForMaximizedModeComment = "Enable button bars extended when the WYSIWYG editor is maximized"; +$Editor = "WYSIWYG Editor"; +$GoToCourseAfterLoginTitle = "Go directly to the course after login"; +$GoToCourseAfterLoginComment = "When a user is registered in one course, go directly to the course after login"; +$GroupList = "Group List"; +$AllowStudentsDownloadFoldersTitle = "Allow students to download directories"; +$AllowStudentsDownloadFoldersComment = "Allow to students pack and download a complete directory in the document tool"; ?> \ No newline at end of file diff --git a/main/lang/greek/accessibility.inc.php b/main/lang/greek/accessibility.inc.php index 410d713f7a..680110da69 100755 --- a/main/lang/greek/accessibility.inc.php +++ b/main/lang/greek/accessibility.inc.php @@ -2,12 +2,13 @@ for more information: see languages.txt in the lang folder. */ $langClarContent = "Åäþ, êáèçãçôÝò êáé âïçèïß äçìéïõñãïýí êáé äéá÷åéñßæïíôáé ôïõò äéêôõáêïýò ôüðïõò ôùí ìáèçìÜôùí ôïõò. Ïé öïéôçôÝò ìðïñïýí íá äéáâÜóïõí ôá Ýããñáöá, ôá ðñïãñÜììáôá, ôçí áôæÝíôá, êëð., íá êÜíïõí áóêÞóåéò, íá äçìïóéåýóïõí åñãáóßåò, íá óõììåôÜó÷ïõí óå óõæçôÞóåéò, ê.á.

ÅããñáöÞ

Áí åßóôå öïéôçôÞò, èá ðñÝðåé íá åããñáöåßôå åðéëÝãïíôáò «Ðáñáêïëïýèçóç ìáèçìÜôùí», êáé ìåôÜ íá åðéëÝîåôå ôá ìáèÞìáôá ðïõ åðéèõìåßôå íá ðáñáêïëïõèÞóåôå.

Áí åßóôå êáèçãçôÞò Þ âïçèüò, èá ðñÝðåé êáé ðÜëé íá åããñáöåßôå, åðéëÝãïíôáò üìùò «Äçìéïõñãßá ìáèçìÜôùí». Óôç óõíÝ÷åéá, èá óõìðëçñþóåôå ìéá öüñìá ìå ôá óôïé÷åßá ôïõ ìáèÞìáôüò óáò: ôßôëï êáé êùäéêü ìáèÞìáôïò êáé ó÷ïëÞ/ôìÞìá ðïõ áíÞêåé. Ìüëéò åðéêõñþóåôå ôá óôïé÷åßá áõôÜ, èá ìåôáöåñèåßôå óôç óåëßäá ðïõ ìüëéò èá Ý÷åé äçìéïõñãçèåß ãéá ôï ìÜèçìá, êáé èá ìðïñåßôå íá áëëÜîåôå ôá ðåñéå÷üìåíÜ êáé ôçí ïñãÜíùóÞ ôçò áíÜëïãá ìå ôéò áíÜãêåò óáò.

Áí ç óåëßäá áõôÞ äåí áíôáðïêñßíåôáé óôéò áíÜãêåò óáò, ðáñáêáëïýìå åíçìåñþóôå ìáò ìÝóù ôçò ëßóôáò «Íá ãßíïõí», ðïõ åìöáíßæåôáé óôçí áñ÷éêÞ óåëßäá ôçò ôÜîçò "; -$test = "test"; +$test = "τεστ"; $WCAGImage = "Εικόνα"; $WCAGLabel = "Τίτλος εικόνας"; $WCAGLink = "Σύνδεσμος"; $WCAGLinkLabel = "Τίτλος Συνδέσμου"; $errorNoLabel = "Κανένας τίτλος για αυτή την εικόνα."; +$AllLanguages = "όλες οι γλώσσες"; $WCAGEditor = "WCAG Editor"; $WCAGGoMenu = "Μενού μετάβασης"; $WCAGGoContent = "Περιεχόμενο μετάβασης"; diff --git a/main/lang/italian/admin.inc.php b/main/lang/italian/admin.inc.php index 2f13ea5c0a..df36582705 100755 --- a/main/lang/italian/admin.inc.php +++ b/main/lang/italian/admin.inc.php @@ -979,6 +979,7 @@ $SoberBrown = "Sober brown"; $SteelGrey = "Steel grey"; $TastyOlive = "Tasty olive"; $AddNews = "Aggiungi avvisi"; +$ExportCourses = "Esporta corsi"; $SearchDatabaseOpeningError = "Non è possibile accedere al database di indicizzazione dei contenuti"; $SearchDatabaseVersionError = "Il formato del database non è supportato"; $SearchDatabaseModifiedError = "Database di indicizzazione modificato"; @@ -1097,4 +1098,7 @@ $FieldTypeTag = "Tag utente"; $SendEmailToAdminTitle = "Avviso della creazione di un nuovo corso tramite e-mail"; $SendEmailToAdminComment = "Ogni volta che un docente crea un nuovo corso, verrà inviata un\'e-mail all\'amministratore"; $UserTag = "Etichetta utente"; +$SelectSession = "Seleziona la sessione"; +$GroupPermissions = "Permessi del gruppo"; +$SpecialCourse = "Corso speciale"; ?> \ No newline at end of file diff --git a/main/lang/italian/course_home.inc.php b/main/lang/italian/course_home.inc.php index b0cf7cc619..51c1c3a680 100755 --- a/main/lang/italian/course_home.inc.php +++ b/main/lang/italian/course_home.inc.php @@ -27,4 +27,5 @@ $IntroductionTextDeleted = "Testo introduttivo eliminato"; $SessionIdentifier = "Identificatore della sessione"; $SessionName = "Nome della sessione"; $SessionCategory = "Categoria della sessione"; +$SessionData = "Dati della sessione"; ?> \ No newline at end of file diff --git a/main/lang/italian/slideshow.inc.php b/main/lang/italian/slideshow.inc.php index 88b6b9bd02..475412de44 100755 --- a/main/lang/italian/slideshow.inc.php +++ b/main/lang/italian/slideshow.inc.php @@ -18,4 +18,6 @@ $lang_next_slide = "Prossima Diapositiva"; $lang_image = "Immagine"; $lang_of = "di"; $lang_view_slideshow = "Mostra presentazione"; +$FirstSlide = "Prima diapositiva"; +$LastSlide = "Ultima diapositiva"; ?> \ No newline at end of file diff --git a/main/lang/italian/userInfo.inc.php b/main/lang/italian/userInfo.inc.php index a840882207..e00beb6c35 100755 --- a/main/lang/italian/userInfo.inc.php +++ b/main/lang/italian/userInfo.inc.php @@ -92,4 +92,6 @@ $SendInvitation = "Manda un invito"; $SocialInvitationToFriends = "Invita ad unirsi al mio gruppo di amici"; $MyCertificates = "Il mio certificato"; $ToChangeYourEmailMustTypeYourPassword = "Per cambiare l\'indirizzo e-mail devi riscrivere la password"; +$Invitations = "Inviti"; +$MyGroups = "I miei gruppi"; ?> \ No newline at end of file diff --git a/main/lang/portuguese/admin.inc.php b/main/lang/portuguese/admin.inc.php index cf82f40c96..caaef1537c 100755 --- a/main/lang/portuguese/admin.inc.php +++ b/main/lang/portuguese/admin.inc.php @@ -979,6 +979,7 @@ $SoberBrown = "Sober brown"; $SteelGrey = "Steel grey"; $TastyOlive = "Tasty olive"; $AddNews = "Adicionar notícias/novidades"; +$ExportCourses = "Exportar cursos"; $SearchDatabaseOpeningError = "Erro ao tentar abrir a base-de-dados"; $SearchDatabaseVersionError = "A base-de-dados encontra-se num formato não suportado"; $SearchDatabaseModifiedError = "A base-de-dados foi modificada"; @@ -1096,4 +1097,22 @@ $ShowGlossaryInExtraToolsComment = "Neste local pode configurar como adicionar o $FieldTypeTag = "Etiqueta/comando do utilizador"; $SendEmailToAdminTitle = "E-mail de alerta, de criação de um novo curso"; $SendEmailToAdminComment = "Enviar um e-mail para o administardor da plataforma, de cada vez que um instrutor registrar um novo curso"; +$UserTag = "Etiqueta/comando do utilizador"; +$SelectSession = "Seleccionar sessão"; +$GroupPermissions = "Permissões do Grupo"; +$SpecialCourse = "Curso especial"; +$MathMimetexTitle = "Editor matemático mimeTEX"; +$MathMimetexComment = "Activar editor matemático mimeTEX"; +$MathASCIImathMLTitle = "Editor matemático SCIImathML"; +$MathASCIImathMLComment = "Activar editor matemático SCIImathML"; +$YoutubeForStudentsTitle = "Permitir aos alunos inserir videos do YouTube"; +$YoutubeForStudentsComment = "Activar a possibilidade dos alunos poderem inserir videos do YouTube"; +$BlockCopyPasteForStudentsTitle = "Bloquear aos alunos a opção de copiar e colar "; +$BlockCopyPasteForStudentsComment = "Bloquear aos alunos a opção de copiar e colar para dentro do editor WYSIWYG "; +$MoreButtonsForMaximizedModeTitle = "Barra de botões extendida"; +$MoreButtonsForMaximizedModeComment = "Activar a barra de botões extendida quando o editor WYSIWYG se encontrar maximizado"; +$Editor = "Editor WYSIWYG"; +$GoToCourseAfterLoginTitle = "Ir directamente para o curso após efectuar o login/acesso"; +$GoToCourseAfterLoginComment = "Quando um utilizador se encontra registado num curso, ir directamente para o curso após o login/acesso"; +$GroupList = "Lista do Grupo"; ?> \ No newline at end of file diff --git a/main/lang/portuguese/course_home.inc.php b/main/lang/portuguese/course_home.inc.php index 3130085069..ee3028429b 100755 --- a/main/lang/portuguese/course_home.inc.php +++ b/main/lang/portuguese/course_home.inc.php @@ -27,4 +27,5 @@ $IntroductionTextDeleted = "A introdu $SessionIdentifier = "Identificador da sessão"; $SessionName = "Nome da sessão"; $SessionCategory = "Categoria da sessão"; +$SessionData = "Dados da sessão"; ?> \ No newline at end of file diff --git a/main/lang/portuguese/slideshow.inc.php b/main/lang/portuguese/slideshow.inc.php index d00a3ee251..8e13f7e861 100755 --- a/main/lang/portuguese/slideshow.inc.php +++ b/main/lang/portuguese/slideshow.inc.php @@ -18,4 +18,6 @@ $lang_next_slide = "Imagem seguinte"; $lang_image = "Imagem"; $lang_of = "de"; $lang_view_slideshow = "Ver Apresentação de slides"; +$FirstSlide = "Primeiro slide/diapositivo"; +$LastSlide = "Último slide/diapositivo"; ?> \ No newline at end of file diff --git a/main/lang/portuguese/userInfo.inc.php b/main/lang/portuguese/userInfo.inc.php index fbad56fcfa..e61edd9cc5 100755 --- a/main/lang/portuguese/userInfo.inc.php +++ b/main/lang/portuguese/userInfo.inc.php @@ -92,4 +92,6 @@ $SendInvitation = "Enviar convite"; $SocialInvitationToFriends = "Convidar para fazer parte do meu grupo de amigos"; $MyCertificates = "Meus certificados"; $ToChangeYourEmailMustTypeYourPassword = "Para modificar o seu e-mail deverá introduzir a sua senha/password"; +$Invitations = "Convites"; +$MyGroups = "Meus grupos"; ?> \ No newline at end of file diff --git a/main/lang/spanish/admin.inc.php b/main/lang/spanish/admin.inc.php index c237010ae5..93ba78c9eb 100755 --- a/main/lang/spanish/admin.inc.php +++ b/main/lang/spanish/admin.inc.php @@ -1103,4 +1103,21 @@ $GroupPermissions = "Permisos del grupo"; $MessagesSent = "Mensajes enviados"; $MessagesReceived = "Mensajes recibidos"; $CountFriends = "Número de amigos"; +$SpecialCourse = "Curso especial"; +$MathMimetexTitle = "Editor matemático mimeTEX"; +$MathMimetexComment = "Habilitar el editor matemático mimeTEX"; +$MathASCIImathMLTitle = "Editor matemático SCIImathML"; +$MathASCIImathMLComment = "Habilitar el editor matemático SCIImathML"; +$YoutubeForStudentsTitle = "Permitir a los estudiantes insertar videos de YouTube"; +$YoutubeForStudentsComment = "Habilitar la posibilidad de que los estudiantes puedan insertar videos de Youtube"; +$BlockCopyPasteForStudentsTitle = "Bloquear a los estudiantes copiar y pegar"; +$BlockCopyPasteForStudentsComment = "Bloquear a los estudiantes la posibilidad de copiar y pegar en el editor WYSIWYG"; +$MoreButtonsForMaximizedModeTitle = "Barras de botones extendidas"; +$MoreButtonsForMaximizedModeComment = "Habilitar las barras de botones extendidas cuando el editor WYSIWYG está maximizado"; +$Editor = "Editor WYSIWYG"; +$GoToCourseAfterLoginTitle = "Ir directamente al curso tras identificarse"; +$GoToCourseAfterLoginComment = "Cuando un usuario está inscrito sólamente en un curso, ir directamente al curso despúes de identificarse"; +$GroupList = "Lista de grupos"; +$AllowStudentsDownloadFoldersTitle = "Permitir a los estudiantes descargar directorios"; +$AllowStudentsDownloadFoldersComment = "Permitir a los estudiantes empaquetar y descargar un directorio completo en la herramienta documentos"; ?> \ No newline at end of file diff --git a/main/lang/spanish/trad4all.inc.php b/main/lang/spanish/trad4all.inc.php index fa0da7dfc1..7c7f2f9078 100755 --- a/main/lang/spanish/trad4all.inc.php +++ b/main/lang/spanish/trad4all.inc.php @@ -291,7 +291,7 @@ $Documents = "Documentos"; $DocumentAdded = "Documento añadido"; $DocumentUpdated = "Documento actualizado"; $DocumentInFolderUpdated = "Documento actualizado en la carpeta"; -$Course_description = "Descripción"; +$Course_description = "Descripción del curso"; $Calendar_event = "Agenda"; $Document = "Documentos"; $Learnpath = "Lecciones"; diff --git a/main/lang/spanish/wiki.inc.php b/main/lang/spanish/wiki.inc.php index 74b9687167..3ab7c132e2 100755 --- a/main/lang/spanish/wiki.inc.php +++ b/main/lang/spanish/wiki.inc.php @@ -122,7 +122,7 @@ $AssignmentDescExtra = "Esta p $AssignmentWorkExtra = "Esta página es el trabajo de un alumno"; $NoAreSeeingTheLastVersion = "Atención no esta viendo la última versión de la página"; $AssignmentFirstComToStudent = "Modifica esta página para realizar tu tarea sobre la tarea propuesta"; -$AssignmentLinkstoStudentsPage = "Acceso a las tareas realizadas por los alumnos sobre la tarea propuesta en esta página"; +$AssignmentLinkstoStudentsPage = "Acceso a las páginas de los alumnos"; $AllowLaterSends = "Permitir envíos retrasados"; $WikiStandBy = "El Wiki está a la espera de que un profesor lo inicialice"; $NotifyDiscussByEmail = "La notificacion por correo electrónico de nuevos comentarios sobre la página está habilitada"; diff --git a/main/work/work.php b/main/work/work.php index 4e7199ee57..86d2e959fa 100755 --- a/main/work/work.php +++ b/main/work/work.php @@ -1486,11 +1486,13 @@ if (!$display_upload_form && !$display_tool_options) { echo $form_filter; } - if(!empty($publication['description'])){ - echo '
'.get_lang('Description').'  '.$publication['description'].'

'; - } - } + if(!empty($publication['description'])){ + echo '

'; + echo '
'.get_lang('Description').':  '.$publication['description'].'

'; + echo '
'; + } + display_student_publications_list($base_work_dir . '/' . $my_cur_dir_path, 'work/' . $my_cur_dir_path, $currentCourseRepositoryWeb, $link_target_parameter, $dateFormatLong, $origin,$add_query);