fpdf在实时服务器上不生成输出,即使它在本地主机上提供输出

时间:2015-01-24 09:57:29

标签: php smarty fpdf

我正在制作一份快递剧本。 http://courierv5.phpscriptsdemo.com用户名:[已删除]和密码:[已删除] 登录后单击http://courierv5.phpscriptsdemo.com/index.php?c=booking_shipment_mangement&f=show_my_booking_shipment并单击打印按钮 请给我解决方案

我使用的是fpdf来生成发票,它可以在本地工作,但不能在现场工作:

require('fpdf.php');
$pdf = new FPDF('L','mm',array(100,139)); //'P','mm',array(100,150)
$pdf->AddPage();

$LOGO_IMAGE=$site_url.'/logofolder/logo.jpeg';

$pdf->SetTitle('Label');



$pdf->SetFont('Arial','',8);

$pdf->Image($LOGO_IMAGE,90,5,30);
$pdf->Text(95,13,$company_name);
$pdf->Text(85,16,$company_address);
$pdf->Text(81,19,'Email:'.$email.', Ph:'.$phone);
$pdf->Setx('5');
$pdf->Ln(5);
$pdf->SetFont('Arial','B',12);

$pdf->Text(5,10,'Invoice #'.$status_update_data[0]['slip_no']);

if($status_update_data[0]['booking_mode']=='Paid')
{
    $pdf->SetFillColor(167,249,192);
$pdf->Rect('50','12','25','10','F');
$pdf->Text(58,18,'Paid');
}
else
{$pdf->SetFillColor(249,163,163);
$pdf->Rect('50','12','25','10','F');
$pdf->Text(55,18,'Unpaid');
}
$pdf->Rect('50','12','25','10');
$pdf->SetFont('Arial','B',12);
$pdf->Ln(3);

$pdf->SetFont('Arial','',10);
$pdf->Text(10,30,strtoupper($status_update_data[0]['sender_name']));
$pdf->Text(10,35,strtoupper($status_update_data[0]['sender_address']));
$pdf->Text(10,40,'Zip code:'.$status_update_data[0]['sender_zip']);
$pdf->Text(10,45,'Mobile:'.$status_update_data[0]['sender_phone']);


$pdf->SetFillColor(200,220,255);
$pdf->Rect('80','25','26','23','F');
$pdf->Rect('80','25','50','23');
$pdf->SetFont('Arial','B',10);
$pdf->Text(81,30,'Booking ID:');


$pdf->Text(81,35,'Created:');
$pdf->Text(81,40,'Booking Date:');
$pdf->Text(81,45,'Total(USD):');

$pdf->SetFont('Arial','',10);
$pdf->Text(107,30,$status_update_data[0]['uniqueid']);
$pdf->Text(107,35, date("d-m-Y",strtotime($status_update_data[0]['entrydate'])));
$pdf->Text(107,40, date("d-m-Y",strtotime($status_update_data[0]['pickup_date'])));
$pdf->Text(107,45,$status_update_data[0]['total_amt']);


$pdf->Rect('10','55','120','7','F');
$pdf->Rect('10','55','120','7');
$pdf->Rect('10','88','120','7','F');
$pdf->Rect('10','55','120','40');
$pdf->Text(11,60,'Description');
$pdf->Text(50,60,'Weight');
$pdf->Text(110,60,'Amount');
$pdf->Text(77,67,'Ser. Charge ');
$pdf->Text(77,72,'Pkg. Charge ');
$pdf->Text(77,77,'Valu. Charge');
$pdf->Text(77,82,'Other Charge ');
$pdf->Text(77,87,'Tax ');
$pdf->Text(77,92,'Grand Total');

$pdf->Text(11,67,$functions->Get_city_name(name,$status_update_data[0]['origin']));
$pdf->Text(11,72,'To');
$pdf->Text(11,77,$functions->Get_city_name(name,$status_update_data[0]['destination']));
$pdf->Text(11,82,'Service:'.$functions->getServiceDetails('services_name',$status_update_data[0]['service_id']));



if($status_update_data[0]['weight']>$status_update_data[0]['volumetric_weight'])
$weight=$status_update_data[0]['weight'];
else
$weight=$status_update_data[0]['volumetric_weight'];

$pdf->Text(50,67,$weight.'Kg');
$pdf->Text(105,67,$status_update_data[0]['service_charge']);
$pdf->Text(105,72,$status_update_data[0]['packing_charge']);
$pdf->Text(105,77,$status_update_data[0]['valuation_charges']);
$pdf->Text(105,82,$status_update_data[0]['other_charges']);
$pdf->Text(105,87,$status_update_data[0]['service_tax']);
$pdf->SetFont('Arial','B',10);

$pdf->Text(105,92,$status_update_data[0]['total_amt']);


$content =$pdf->Output('invoice_'.$status_update_data[0]['slip_no'].'.pdf','D');

1 个答案:

答案 0 :(得分:0)

$content =$pdf->Output('invoice_'.$status_update_data[0]['slip_no'].'.pdf','D');

取代'.pdf','D');使用'.pdf','I');希望能够解决问题