边框线不显示 - FPDF

时间:2016-11-16 08:45:07

标签: php fpdf

我的情况是我无法显示代码的边框线。我正在使用fdpf到www.fpdf.org网站的pdf转换器。 操作系统:Windows 10 64位 语言:PHP& MySQL的

<?

/* * * page protection ** */
// this protect the user direct access to the page,
// this should be included in every page, except /index.php (system entry)
if (!defined("_VALID_ACCESS")) { // denied direct access to the page
    header("HTTP/1.0 404 Not Found");
    exit(); // process terminated
}

header('Content-type: application/pdf');
require ($sys_config['plugins_path']."/fpdf/fpdf/fpdf.php");

if($_POST['report']=='report_daily'){
    $filename = "Report_Daily-".date("d-m-Y").".pdf";
    $title = "Daily Report";
    $date = "Date: ".date("d-m-Y");
}else{
    $filename = "Report_Date_Range-".date("d-m-Y").".pdf";
    $title = "Date Range Report";
    if(!empty($_POST['fromdate'])&&!empty($_POST['nextdate'])){
    $date = "For the period of: ".$_POST['fromdate']." To: ". $_POST['nextdate'];
}else
    $date = "All time transaction";
}

$create_date = 'Generated on '.date("d-m-Y h:i:sa");

$ssc = "/* " . $mod_config['document_root'] . "pdf.php [" . __LINE__ . "] */ "
    . "SELECT *, DATE_FORMAT(CREATE_DATE,'%d-%m-%Y %r') AS CREATE_DATE"
    . " FROM " . $db_config['t_transaction']
    . " WHERE merchantID = '" . $_SESSION['user']['merchantID'] 
    . "'AND status like '%" . $_POST['status'] . "%'";


if($_POST['report']=='report_daily')
$ssc .= " AND CAST(CREATE_DATE AS date) like '%". date("Y-m-d") ."%'";
else if($_POST['fromdate'] != '' && $_POST['nextdate']!= '')
$ssc .= " AND DATE_FORMAT(CREATE_DATE, '%d-%m-%Y') >= '".$_POST['fromdate']."' AND DATE_FORMAT(CREATE_DATE, '%d-%m-%Y') <= '".$_POST['nextdate']."'";

$ssc .=  " ORDER BY CREATE_DATE DESC ";

$rssc = $db->sql_query($ssc) or $db->sql_error($ssc);

$data= array();
while ($rwsc = $db->sql_fetchrow($rssc))
$data[] = $rwsc;
//show_debug($_POST,1);
$pdf = new FPDF();

$pdf->AddPage();

$addField = array(
    "CUR_ACTUAL" => 'Currency Actual', 
    "BILLING_EMAIL" => 'Billing Email', 
    "TRANSACTION_RATE" => 'Transaction Rate', 
    "BILLING_INFO" => 'Billing Info', 
    "TRANSACTION_COST" => 'Transaction Cost',
    "BILLING_NAME" => 'Name',
    "BILL_AMT" => 'Amount'
);

$width = array(20,40,40,50,40);
if($_POST['AddField']!='')
    $width = array(10,35,25,40,30,50);

$pdf->Image('https://admin.bestpay4u.my/images/logobest.png',10,-5,60,0,'PNG');
$pdf->SetFont("Arial", "B", "13");
$pdf->Cell(0,4,$title,0,1,"R");
$pdf->SetFont("Arial", "B", "8");
$pdf->Cell(0,4,$date,0,1,"R");
$pdf->SetFont("Arial", "B", "8");
$pdf->Cell(0,4,$create_date,0,1,"R");
$pdf->Cell(0,2,"",0,1,"C");
$pdf->Cell(0,2,"",0,1,"C");

$pdf->SetFont("Arial", "B", "8");
$pdf->SetFillColor(226, 232, 235);
$pdf->SetDrawColor('255','255','255');
$pdf->Cell($width['0'],4,"NO.",1,0,"C",'true');
$pdf->Cell($width['1'],4,"TRANS ID",1,0,"C",'true');
$pdf->Cell($width['2'],4,"ORDER ID",1,0,"C",'true');
$pdf->Cell($width['3'],4,"DATE",1,0,"C",'true');

if($_POST['AddField']!=''){
    $pdf->Cell($width['4'],4,"STATUS",'L',0,"C",'true');
    $pdf->Cell($width['5'],4,$addField[$_POST['AddField']],'L',1,"C",'true');
}else
    $pdf->Cell($width['4'],4,"STATUS",'L',1,"C",'true');

$pdf->SetFont("Arial", "", "8");
$i=1;
foreach($data as $d){

    $pdf->Cell($width['0'],4,$i,0,0,"C");
    $pdf->Cell($width['1'],4,$d['LEADID'].$d['tranID'],0,0,"C");
    $pdf->Cell($width['2'],4,$d['ORDER_ID'],0,0,"C");
    $pdf->Cell($width['3'],4,$d['CREATE_DATE'],0,0,"C");

if($_POST['AddField']!=''){
    $pdf->Cell($width['4'],4,$d['STATUS'],0,0,"C");
    $pdf->Cell($width['5'],4,$d[$_POST['AddField']],0,1,"C");
}
else
    $pdf->Cell($width['4'],4,$d['STATUS'],0,1,"C");

$i++;
}

$pdf->Cell(0,4,"",0,1,"C");
$pdf->Cell(0,4,"",0,1,"C");
$pdf->Cell(0,4,'Powered by Bestinet Sdn Bhd',0,1,"C");

ob_end_clean();
$pdf->Output(D, $filename);

?>

成功转换pdf 的结果如下图所示: enter image description here

1 个答案:

答案 0 :(得分:1)

请检查边框颜色。默认情况下,颜色为白色。将其更改为黑色。