忙活了半天时间比较joomla和mambo pdf输出相关文件,搜索google,终于解决了mambo pdf输出的问题。适合代码是gb2312、utf8和big5的网站,并且可以输出包括gif格式图像。
1、首先从joomla include目录下拷贝下列文件和目录到相同地方。请注意备份旧文件。
a、pdf.php
b、class.ezpdf.php
c、class.pdf.php
e、目录big5_func
f、目录fpdf
2、修改pdf.php文件。
a、line134或者搜索‘}elseif ($mosConfig_lang=='simplified_chinese'){’,修嘎为‘}elseif ($mosConfig_lang=='simplified_chinese_utf-8'){’
b、line142的else前添加
elseif ($mosConfig_lang=='simplified_chinese'){
$pdf->AliasNbPages();
$pdf->AddGBhwFont();
//$pdf->AddBig5Font();
$pdf->Open();
$pdf->SetFont('GB-hw', '', 12);
$pdf->AddPage(); // added by Max 20041202
$pdf->WriteHTML($row->html);
}
3、修改fpdf.php
在函数_parsepng下面添加函数
function _parsegif($file) //EDITEI - updated
{
//Function by J�r�me Fenal
require_once 'gif.php'; //GIF class in pure
PHP from Yamasoft (
http://www.yamasoft.com/php-gif.zip)
$h=0;
$w=0;
$gif=new CGIF();
if (!$gif->loadFile($file, 0))
$this->Error("GIF parser: unable to open file $file"

;
if($gif->m_img->m_gih->m_bLocalClr) {
$nColors = $gif->m_img->m_gih->m_nTableSize;
$pal = $gif->m_img->m_gih->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
} elseif($gif->m_gfh->m_bGlobalClr) {
$nColors = $gif->m_gfh->m_nTableSize;
$pal = $gif->m_gfh->m_colorTable->toString();
if($bgColor != -1) {
$bgColor = $gif->m_gfh->m_colorTable->colorIndex($bgColor);
}
$colspace='Indexed';
} else {
$nColors = 0;
$bgColor = -1;
$colspace='DeviceGray';
$pal='';
}
$trns='';
if($gif->m_img->m_bTrans && ($nColors > 0)) {
$trns=array($gif->m_img->m_nTrans);
}
$data=$gif->m_img->m_data;
$w=$gif->m_gfh->m_nWidth;
$h=$gif->m_gfh->m_nHeight;
if($colspace=='Indexed' and empty($pal))
$this->Error('Missing palette in '.$file);
if ($this->compress) {
$data=gzcompress($data);
return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'f'=>'FlateDecode', 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
} else {
return array( 'w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>8, 'pal'=>$pal, 'trns'=>$trns, 'data'=>$data);
}
}
4、把附件gif.php拷贝到目录fpdf下
5、如果在ie下提示打不开pdf网页,请修改根目录下index2.php文件:注释掉line24 ‘session_start()’,或者把此语句移动到下面的语句块下面
if ( $do_pdf == 1 ){
include ('includes/pdf.php');
exit();
}
我现在还没有发现注释或者移动此语句有没有别的后果,在joomla中这语句是没有的。如果谁发现有什么问题,请也告诉我

另外文件输出的图像只能是通过{mosimage}方法添加的。
[
本帖最后由 hassion 于 2006-11-7 22:11 编辑 ]