2011-11-02 4 views
0

그래서 나는 (PHP) 그러나FPDF - 인쇄 PDF는

우리가 내 컴퓨터에서 제대로 인쇄 것으로 보인다 이러한 문서를 인쇄로 이동 FPDF를 사용하여 PDF 문서를 코딩,하지만 컴퓨터에 따라 망쳐 도착 전에서 인쇄 할 때 내 상사 노트북 그것 물건을 망치.

유일한 차이점은 그가 HP 설정을 설치했고 내가 가지고 있지 않다는 것입니다.

내 코드가 여기에 있습니다.

<?php 
mysql_connect("localhost","DBUSER","DBPASS"); 
mysql_select_db("DB"); 
require('fpdf/fpdf.php'); 

class PDF extends FPDF 
{ 
// Page header 
    function Header() 
    { 
     // Logo 
     $this->Image('header.png',10,0,200); 
     // Arial bold 15 
     $this->SetFont('Arial','B',15); 
     // Move to the right 
     $this->Cell(80); 
     // Line break 
     $this->Ln(20); 
    } 

// Page footer 
    function Footer() 
    { 
    // Position at 1.5 cm from bottom 
    $this->SetY(-15); 

    //$this->Image('footer.png',0,200,'210%'); 
    // Arial italic 8 
    //$this->SetFont('Arial','I',8); 
    // Page number 
    //$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C'); 
    } 
} 

$pdf=new FPDF(); 

//Select the Products you want to show in your PDF file 
$arr = array($_GET['ids']); 
reset($arr); 
while (list(, $value) = each($arr)) { 

$result=mysql_query("SELECT customer.* FROM customer_detail as customer WHERE customer.customer_id IN ({$value})"); 
$number_of_customers = mysql_numrows($result); 



//For each row, add the field to the corresponding column 
while($row = mysql_fetch_array($result)) 
{ 
$pdf->AliasNbPages(); 
$pdf->AddPage(); 
    $name = ""; 
    $TradingName = ""; 
    $Street = ""; 
    $City = ""; 
    $state = ""; 


    $name = ucfirst($row["FirstName"])." ".ucfirst($row["LastName"]); 
    $TradingName = $row["TradingName"]; 
    $Street = $row["Street"]; 
    $City = $row["City"]; 
    $state = $row["State"]; 

    if($state == 1) 
    { 
    $states = "VIC"; 
    } 
    else if($state == 2) 
    { 
    $states = "NSW"; 
    } 
    else if($state == 3) 
    { 
    $states = "QLD"; 
    } 
    else if($state == 4) 
    { 
    $states = "WA"; 
    } 
    else if($state == 5) 
    { 
    $states = "TAS"; 
    } 
    else if($state == 6) 
    { 
    $states = "SA"; 
    } 
    else if($state == 7) 
    { 
    $states = "ACT"; 
    } 
    else if($state == 8) 
    { 
    $states = "NT"; 
    } 

    $PostCode = $row["PostCode"]; 

    $TradingName_code = $TradingName_code.$TradingName."\n"; 
    $Name_Code = $Name_code.$name."\n"; 
    $Address_code = $Address_Code.$Street."\n"; 
    $StateCityPostcode_code = $City." ".$states." ".$PostCode."\n"; 





//Create lines (boxes) for each ROW (Product) 
//If you don't use the following code, you don't create the lines separating each row 





// Instanciation of inherited class 
    $pdf->SetFont('Arial','B',12); 
    $pdf->Ln(60); 
    $pdf->SetXY(25,65); 
    $pdf->Cell(0,5,$TradingName,0,1); 
    $pdf->SetXY(25,70); 
    $pdf->Cell(0,5,$name,0,1); 
    $pdf->SetFont('Arial','',12); 
    $pdf->SetXY(25,75); 
    $pdf->Cell(0,5,$Street,0,1); 
    $pdf->SetXY(25,80); 
    $pdf->Cell(0,5,$StateCityPostcode_code,0,1); 
    $pdf->Ln(30); 
    $pdf->Cell(0,5,"Dear ". ucfirst($row['FirstName']),0,1); 
    $pdf->Ln(5); 
    $pdf->Write(5,'Thank you and welcome to the Company program.'); 
    $pdf->Ln(8); 
    $pdf->Write(5,'Please find enclosed your preliminary iNcard to access our Company program.'); 
    $pdf->Ln(8); 
    $pdf->Write(5,'An Company representative will contact you by telephone in the next couple of days to assist you in validating your iNcard. To allow us to complete your business listing and start promoting it to over 300,000 of our iNcard holders, the validation process is as follows:'); 
    $pdf->SetXY(25,170); 
    $pdf->Cell(0,5,"1. Your iNcard is activated over the phone and loaded with $1",0,1); 
    $pdf->SetXY(25,175); 
    $pdf->Cell(0,5,"2. An SMS confirmation is then sent to your mobile number",0,1); 
    $pdf->SetXY(25,180); 
    $pdf->Cell(0,5,"3. Once received, please run the $1.00 transaction through your EFTPOS terminal",0,1); 
    $pdf->SetXY(25,185); 
    $pdf->Cell(0,5,"4. You will then receive a follow up call to nominate a user name unique to your business",0,1); 
    $pdf->SetXY(25,190); 
    $pdf->Cell(0,5,"and to capture your business details",0,1); 
    $pdf->SetXY(25,195); 
    $pdf->Cell(0,5,"5. A password is then supplied to enable you to access your account activities ",0,1); 
    $pdf->SetXY(25,200); 
    $pdf->Cell(0,5,"via http://manage.URL.com.au ",0,1); 
    $pdf->Ln(8); 
    $pdf->Write(5,"Once again, welcome to the program and should you require any assistance or clarification on any of the above points please do not hesitate to contact us."); 
    $pdf->Ln(12); 
    $pdf->Cell(0,5,"Kind regards,",0,1); 
    $pdf->Cell(0,5,"Retail Support",0,1); 
    $pdf->Cell(0,5,"Comp Pty Ltd",0,1); 



} 
mysql_close(); 
} 

$pdf->Output(); 
?> 
+0

여기에 묻는 것이 명확하지 않습니다. 파일이 프린터로 전송되는지 여부를 알고 있습니까? 또한 $ pdf-> Output(); 줄이 있습니다. 일관된 출력을 내고 있습니까? – jakx

+0

확실하지 않음 - 우리는 여전히 수동으로 pdf를 다운로드하고 프린트를해야합니다. – RussellHarrower

답변

0

코드에 문제가 있다고 생각하지 않습니다. 그것은 다른 컴퓨터에서 다른 설정과 관련이 있습니다. 귀하의 상사는 페이지 레이아웃을 제어하는 ​​일부 설정을 가질 수 있으며 따라서 인쇄 된 페이지는 설정없이 인쇄 할 때와 다르게 보입니다.