$uploaddir = 'download/';
$Date = date("YmdHis");
$filenamepdf = $uploaddir."print".$Date.".pdf";
define('FPDF_FONTPATH','font/');
require('fpdf.php');
$pdf = new FPDF('P','mm','9x6');$pdf->AddPage();
$pdf->SetLeftMargin(1);
$pdf->SetTopMargin(0.1);
$pdf->SetFont('arial');
$pdf->Write(5,'test pdf');
$pdf->Ln();
$pdf->Write(5,'di er heng');
$pdf->Output("$filenamepdf", 'F');
顶边距无论设置多少,都还是那么宽,请问我的代码哪里有问题,还是缺少一些设置

解决方案 »

  1.   

    你的 fpdf 是被你改造过的?
    按 fpdf 的原始代码对于
    $pdf = new FPDF('P','mm','9x6');
    的 $foamat = '9x6' 是要报 Unknown page format: 9x6 错的
    因为他 9x6 不在是预设的 a3、a4、a5、letter、legal 之一另外 SetMargins、SetLeftMargin、SetRightMargin 并不是智能化的,需要单独设置。这是 fpdf 的败笔
      

  2.   

    xuzuning大大你好!页面我是加了一个9X6的进去,关于页边距单独设置是指修改源文件吗?你的意思是不是我每新增一个页面,就要争对这个页面去设置一下页边距????是修改fpdf的源文件还是在代码中用函数??