douguadao3883 2016-07-16 05:55
浏览 12

打印pdf定位

I just want to add some "Approved By: _______________" and "Prepared By: ______" and so on in the bottom of the page. Don't mind the mysql_query i just want to know to position it first.

Herewith is my sample print document.

enter image description here

MY CODE

<?php  
class PDF extends FPDF
{

function Header()
{
    $this->SetFont('Helvetica','',25);
    $this->SetFontSize(40);
    //Move to the right
    $this->Cell(80);
    //Line break
    $this->Ln();
}

//Page footer
function Footer()
{

}

//Load data
function LoadData($file)
{
    //Read file lines
    $lines=file($file);
    $data=array();
    foreach($lines as $line)
        $data[]=explode(';',chop($line));
    return $data;
}

//Simple table
function BasicTable($header,$data)
{ 

$this->SetFillColor(255,255,255);
//$this->SetDrawColor(255, 0, 0);
$w=array(38,21,90,7,12,7);

    //Header
    $this->SetFont('Arial','B',7);
    for($i=0;$i<count($header);$i++)
        $this->Cell($w[$i],7,$header[$i],1,0,'L',true);
    $this->Ln();

    //Data

    $this->SetFont('Arial','',7);
    foreach ($data as $eachResult) 
    { //width
        $this->Cell(10);
        $this->Cell(38,6,$eachResult["ecr_desc"],1);
        $this->Cell(21,6,$eachResult["itemcode"],1);
        $this->Cell(90,6,$eachResult["ite_desc"],1);
        $this->Cell(7,6,$eachResult["tqty"],1);
        $this->Cell(12,6,$eachResult["icount"],1);

        $this->Cell(7,6,$eachResult["total1"],1);
        $this->Ln();                        
    }
}

//Better table
}

$pdf=new PDF();  
$header=array('Model','Code','Desc','XFR','ACTUAL', 'DIFF');  

//************************//


//*** Table 1 ***//
$pdf->AddPage();

    $pdf->SetFont('Helvetica','',14);
    $pdf->Cell(75);
    $pdf->Write(5, 'Stock Receiving');

    $pdf->Ln();

    $pdf->Cell(22);
    $pdf->SetFontSize(8);
    $pdf->Cell(57);
    $result=mysql_query("select date_format(now(), '%W, %M %d, %Y') as date");
    while( $row=mysql_fetch_array($result) )
    {
        $pdf->Write(5,$row['date']);
    }
    $pdf->Ln();

    //count total numbers of visitors   

    $pdf->Cell(0);
    $pdf->Write(3, '             REFERENCE NUMBER: '.$Rid.'');

    $pdf->Ln();

    $pdf->Cell(0);
    $pdf->Write(2, '             DATE RECEIVED: '.$date.'');

    $pdf->Ln();

    $pdf->Cell(0);
    $pdf->Write(2, '             TOTAL ITEM: '.$icount.'');

    $pdf->Ln();
    $pdf->Ln(5);

$pdf->Ln(0);
$pdf->Cell(10);
$pdf->BasicTable($header,$resultData);
//forme();
//$pdf->Output("$d.pdf","F");
$pdf->Output();   
?>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行