生成pdf文件

时间:2019-01-22 09:09:00

标签: pdf-generation

我正在制作学生简历的pdf文件,问题是pdf结构没有像示例简历那样定义

I want like this way student information showing

但是我这样编码

//Email
$pdf->SetXY(65,25);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(230,10,'Email: ',0,0,'L');
$pdf->SetXY(78,25);
$pdf->SetFont('Arial','',10);
$pdf->Cell(230,10,$Row_Std['email'],0,0,'L');
//Phone
$pdf->SetXY(65,30);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(230,10,'Phone: ',0,0,'L');
$pdf->SetXY(78,30);
$pdf->SetFont('Arial','',10);
$pdf->Cell(230,10,$Row_Std['cell'],0,0,'L');

//CNIC
$pdf->SetXY(65,35);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(230,10,'CNIC: ',0,0,'L');
$pdf->SetXY(78,35);
$pdf->SetFont('Arial','',10);
$pdf->Cell(230,10,$Row_Std['cnic'],0,0,'L');

//House Detail
$pdf->SetXY(65,40);
$pdf->SetFont('Arial','B',10);
$pdf->Cell(230,10,'Address: ',0,0,'L');
$pdf->SetXY(82,40);
$pdf->SetFont('Arial','',10);
    $address = $Row_Std['address'];
    $exp_address = explode(' ',$address);
        //$output = str_split($address, 40);
        $i=0; $address1='';
    foreach($exp_address as $add)
    {
        $str_address .= $add; 

        if((strlen($str_address))>0 && (strlen($str_address))<=59 && $i==0){
            $address1 .= $add." ";
        } elseif(strlen($str_address)>60 && strlen($str_address)<119 && $i==1){
         $address1 .= $add." ";
        } 
        elseif((strlen($str_address))>=60){
            $pdf->Cell(230,10,$address1,0,0,'L'); 
            $i=1;
            $address1='';
        }
        else {

        }   
    }

After the code than student information show is this way

如何分成两列,而不是像上图那样显示学生信息?

0 个答案:

没有答案