Итак, я закодировал PDF-документ, используя fpdf (PHP)
Однако, когда мы собираемся распечатать эти документы, кажется, что они печатаются правильно с моего компьютера, но когда я печатаю с моего ноутбука-босса, это все портит.
Единственная разница в том, что он установил параметры 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();
?>