diff --git a/e107_plugins/pdf/admin_pdf_config.php b/e107_plugins/pdf/admin_pdf_config.php index 83d55dcbe..556fc0900 100644 --- a/e107_plugins/pdf/admin_pdf_config.php +++ b/e107_plugins/pdf/admin_pdf_config.php @@ -9,8 +9,8 @@ * Plugin Administration - PDF generator * * $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/admin_pdf_config.php,v $ - * $Revision: 1.4 $ - * $Date: 2009-12-05 12:33:30 $ + * $Revision: 1.5 $ + * $Date: 2009-12-07 20:46:56 $ * $Author: e107steved $ * */ @@ -107,6 +107,82 @@ $pdfpref = getPDFPrefs(); if(!is_object($sql)){ $sql = new db; } +// Default list just in case +$fontlist=array('times','courier','helvetica','symbol'); + + +function getFontInfo($fontName) +{ + $type = 'empty'; // Preset the stuff we're going to read + $dw = 0; + $cw = array(); + $name=''; + //$desc=array('Ascent'=>900,'Descent'=>-300,'CapHeight'=>-29,'Flags'=>96,'FontBBox'=>'[-879 -434 1673 900]','ItalicAngle'=>-16.5,'StemV'=>70,'MissingWidth'=>600); + //$up=-125; + //$ut=50; + include(e_PLUGIN.'pdf/font/'.$fontName); + return array('type' => $type, 'weight' => $dw, 'codes' => count($cw), 'name' => $name); +} + + + +function getFontList($match = '') +{ + require_once(e_HANDLER.'file_class.php'); + $fl = new e_file(); + if (!$match) $match = '~^uni2cid'; + $fileList = $fl->get_files(e_PLUGIN.'pdf/font/',$match, 'standard', 1); + $fontList = array(); + $intList = array(); + foreach ($fileList as $v) + { + if (isset($v['fname']) && (substr($v['fname'],-4) == '.php')) + { + $intList[] = substr($v['fname'],0,-4); + } + } + unset($fileList); + sort($intList); // This will guarantee that base font names appear before bold, italic etc + foreach ($intList as $f) + { + if (substr($f,-2) == 'bi') + { + $fontList[substr($f,0,-2)]['bi'] = $f.'.php'; + } + elseif (substr($f,-1) == 'i') + { + $fontList[substr($f,0,-1)]['i'] = $f.'.php'; + } + elseif (substr($f,-1) == 'b') + { + $fontList[substr($f,0,-1)]['b'] = $f.'.php'; + } + else + { // Must be base font name + $fontList[$f]['base'] = $f.'.php'; + } + } + // Now get the info on each font. + foreach ($fontList as $font => $info) + { + $fontList[$font]['info'] = getFontInfo($info['base']); + } + //print_a($fontList); + return $fontList; +} + + +$fontList = getFontList(); +$coreList = array(); +foreach ($fontList as $font => $info) +{ + if ($info['info']['type'] == 'core') + { + $coreList[$font] = $font; + } +} + + $text = "
".$rs -> form_open("post", e_SELF, "pdfform", "", "enctype='multipart/form-data'")." @@ -125,13 +201,13 @@ $text = " ".$rs -> form_text("pdf_margin_top", 10, $pdfpref['pdf_margin_top'], 10)." "; -$fontlist=array('times','courier','helvetica','symbol'); $text .= " ".PDF_LAN_8." ".$rs -> form_select_open("pdf_font_family"); - foreach($fontlist as $font){ + foreach($coreList as $font => $info) + { $text .= $rs -> form_option($font, ($pdfpref['pdf_font_family'] == $font ? "1" : "0"), $font); } $text .= $rs -> form_select_close()." @@ -200,6 +276,26 @@ $text .= " $ns -> tablerender(PDF_LAN_2, $text); + +$text = "
+".PDF_LAN_21."".PDF_LAN_22."".PDF_LAN_23." + ".PDF_LAN_24."".PDF_LAN_26."\n"; + +foreach ($fontList as $font => $info) +{ + $wa = array(PDF_LAN_27); + if (isset($info['b'])) $wa[] = PDF_LAN_28; + if (isset($info['i'])) $wa[] = PDF_LAN_29; + if (isset($info['bi'])) $wa[] = PDF_LAN_30; + $variants = implode(', ', $wa); + $text .= "{$font}{$info['info']['type']}{$variants}{$info['info']['weight']}{$info['info']['codes']}\n"; +} + +$text .= "
"; +$ns->tablerender(PDF_LAN_31, $text); + + require_once(e_ADMIN."footer.php"); ?> \ No newline at end of file diff --git a/e107_plugins/pdf/languages/English_admin_pdf.php b/e107_plugins/pdf/languages/English_admin_pdf.php index b09953255..62065c9b6 100644 --- a/e107_plugins/pdf/languages/English_admin_pdf.php +++ b/e107_plugins/pdf/languages/English_admin_pdf.php @@ -4,37 +4,48 @@ | e107 website system - Language File. | | $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/languages/English_admin_pdf.php,v $ -| $Revision: 1.2 $ -| $Date: 2009-12-05 12:33:30 $ +| $Revision: 1.3 $ +| $Date: 2009-12-07 20:46:56 $ | $Author: e107steved $ +-----------------------------------------------------------------------------+ */ -define("PDF_PLUGIN_LAN_1", "PDF"); -define("PDF_PLUGIN_LAN_2", "PDF creation support using TCPDF"); -define("PDF_PLUGIN_LAN_3", "PDF"); -define("PDF_PLUGIN_LAN_4", "This plugin is now ready to be used."); +define('PDF_PLUGIN_LAN_1', 'PDF'); +define('PDF_PLUGIN_LAN_2', 'PDF creation support using TCPDF'); +define('PDF_PLUGIN_LAN_3', 'PDF'); +define('PDF_PLUGIN_LAN_4', 'This plugin is now ready to be used.'); -define("PDF_LAN_1", "PDF"); -define("PDF_LAN_2", "PDF preferences"); -define("PDF_LAN_3", "enabled"); -define("PDF_LAN_4", "disabled"); -define("PDF_LAN_5", "page margin left"); -define("PDF_LAN_6", "page margin right"); -define("PDF_LAN_7", "page margin top"); -define("PDF_LAN_8", "font family"); -define("PDF_LAN_9", "font size default"); -define("PDF_LAN_10", "font size sitename"); -define("PDF_LAN_11", "font size page url"); -define("PDF_LAN_12", "font size page number"); -define("PDF_LAN_13", "show logo on pdf?"); -define("PDF_LAN_14", "show sitename on pdf?"); -define("PDF_LAN_15", "show creator page url on pdf?"); -define("PDF_LAN_16", "show page numbers on pdf?"); -define("PDF_LAN_17", "update"); -define("PDF_LAN_18", "PDF preferences successfully updated"); -define("PDF_LAN_19", "Page"); -define("PDF_LAN_20", "error reporting"); +define('PDF_LAN_1', 'PDF'); +define('PDF_LAN_2', 'PDF preferences'); +define('PDF_LAN_3', 'enabled'); +define('PDF_LAN_4', 'disabled'); +define('PDF_LAN_5', 'page margin left'); +define('PDF_LAN_6', 'page margin right'); +define('PDF_LAN_7', 'page margin top'); +define('PDF_LAN_8', 'font family'); +define('PDF_LAN_9', 'font size default'); +define('PDF_LAN_10', 'font size sitename'); +define('PDF_LAN_11', 'font size page url'); +define('PDF_LAN_12', 'font size page number'); +define('PDF_LAN_13', 'show logo on pdf?'); +define('PDF_LAN_14', 'show sitename on pdf?'); +define('PDF_LAN_15', 'show creator page url on pdf?'); +define('PDF_LAN_16', 'show page numbers on pdf?'); +define('PDF_LAN_17', 'update'); +define('PDF_LAN_18', 'PDF preferences successfully updated'); +define('PDF_LAN_19', 'Page'); +define('PDF_LAN_20', 'error reporting'); +define('PDF_LAN_21', 'Font name'); +define('PDF_LAN_22', 'Font Type'); +define('PDF_LAN_23', 'Variants'); +define('PDF_LAN_24', 'Weight'); +define('PDF_LAN_25', 'This is an indication of the level of utf-8 support'); +define('PDF_LAN_26', 'Codes'); +define('PDF_LAN_27', 'std'); // 'Normal' font type +define('PDF_LAN_28', 'bold'); // Bold font type +define('PDF_LAN_29', 'ital'); // Italic font type +define('PDF_LAN_30', 'boldital'); // Bold italic font type +define('PDF_LAN_31', 'FONT LIST'); // Admin logging diff --git a/e107_plugins/pdf/pdf.php b/e107_plugins/pdf/pdf.php index 43b105b88..17ef7d7e0 100644 --- a/e107_plugins/pdf/pdf.php +++ b/e107_plugins/pdf/pdf.php @@ -9,8 +9,8 @@ * Plugin - PDF Generator * * $Source: /cvs_backup/e107_0.8/e107_plugins/pdf/pdf.php,v $ - * $Revision: 1.6 $ - * $Date: 2009-12-06 10:45:50 $ + * $Revision: 1.7 $ + * $Date: 2009-12-07 20:46:56 $ * $Author: e107steved $ * */ @@ -34,8 +34,15 @@ if(strpos($source,'plugin:') !== FALSE) if(file_exists(e_PLUGIN.$plugin.'/e_emailprint.php')) { include_once(e_PLUGIN.$plugin.'/e_emailprint.php'); - $text = print_item_pdf($parms); - $pdf->makePDF($text); + if (function_exists('print_item_pdf')) + { + $text = print_item_pdf($parms); + $pdf->makePDF($text); + } + else + { + echo 'PDF generation not supported in this section'; + } } else {