FPDF enviar PDF con phpmailer Hola, he hecho este pdf que coge los datos de la base de datos,
ahora lo quiero enviar con phpmailer como un archivo adjunto.
He conseguido enviar PDF hecho asi muy sencillos, pero este no logor enviar,
igual es por las imagenes. No sé si a lo mejor no se puede mandar directamente sino se debe de guardar el archivo en servidor o en base de datos.
Alguna idea como lo puedo enviar? Código PHP: class PDF extends FPDF
{
function Header()
{
$this->Image('paypal/headeringles2.png',10,5,190);
$this->SetFont('Arial','B',17);
// Salto de línea
$this->Ln(6);
global $propiedad;
$this->Cell(190,10,$propiedad,0,0,'C');
$this->Ln(16);
}
function Footer()
{
$this->SetFont('Arial','',10);
// Número de página
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
define('EUR', iconv('UTF-8', 'windows-1252', "€"));
define('DEG', iconv('UTF-8', 'windows-1252', "º"));
define('SEP', iconv('UTF-8', 'windows-1252', "'"));
// Creación del objeto de la clase heredada
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial','',11);
$pdf->SetX(20);
$pdf->Cell(170,5,'Name: ' . $row->name,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Passport: ' . $row->passport,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Email: ' . $row->emailtrue,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Home phonenumber: ' . $row->telhome,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Movile to bring on holiday: ' . $row->telmobile,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Adults: ' . $row->adults,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Children (2-17 years): ' . $row->children,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Infants (under 2 years): ' . $row->babies,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$row->propiedad = str_replace(" ", "_", $row->propiedad);
$casa = $row->propiedad;
$result = mysql_query ("SELECT Duermen_max, bond FROM Casas_alquilar where (nombre = '$casa')");
while ($rows = mysql_fetch_object($result)) {
$pdf->Cell(170,5,utf8_decode("Máx. occupacy is ") . $rows->Duermen_max . ' persons excluding babies or infants who sleep in a cot for which there is',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'no extra charge.',0,0);
$pdf->Ln(12);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Property rented: ' .$row->propiedad,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Arrival: ' . $row->llegada,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Departure: ' .$row->salida,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
if ($row->percentage=="25"){$whenpayment = $whenpayment = "is due 8 weeks before arrival";}
if ($row->percentage=="50"){$whenpayment = "is due on arrival";}
$pdf->Cell(170,5, 'Total Holiday Cost: '. $row->holidaycost.EUR,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Option choosen to pay:',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'deposit ('.$row->percentage .' %) ' .$row->deposit.EUR.' balance ' .$row->balance.EUR. ' '. $whenpayment.'.',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'balance ' .$row->balance.EUR. ' '. $whenpayment.'.',0,0);
$pdf->Ln(6);
if ($row->bond=="tarjeta"){
$pdf->SetX(20);
$pdf->Cell(170,5, 'A damage deposit will be paid on arrival by creditcard.',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'I have read the booking conditions and agree to abide by them.',0,0);
$pdf->Ln(12);
}
else {
$pdf->SetX(20);
$pdf->Cell(170,5, 'A damage deposit of ' . $row->damagedeposit.EUR. ' wich will be returned after inspection will be blocked on my credit',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'card or paid on arrival in cash in the currency of my choice.',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'I have read the booking conditions and agree to abide by them.',0,0);
$pdf->Ln(12);
}
$pdf->SetX(20);
$pdf->Cell(170,5, 'Flight or other transport information, arriving: ' . $row->transport,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Arrival and departure time at airport, trainstation or property: ',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Arrival time: ' .$row->hourarrival,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Departure time: ' .$row->hourdeparture,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Arrival flight: ' .$row->arrivalflightdetails,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Departure flight: ' .$row->departureflightdetails,0,0);
$pdf->Ln(12);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Services required: (Air Port pickup to be paid on arrival) ',0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Taxi' .SEP.'s up to 4 persons: ' .$row->taxismall,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5,'Taxi'.SEP.'s up to 7 persons: ' .$row->taxibig,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'n'.DEG.' and group of Rent a car'.SEP.'s: ' .$row->rentacar,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'n'.DEG.' of cots (free of charge): ' .$row->cot,0,0);
$pdf->Ln(6);
$pdf->SetX(20);
$pdf->Cell(170,5, 'Other services: ' .$row->otherservices,0,0);
$pdf->Ln(9);
$pdf->SetFont('Arial','',8);
$pdf->SetX(20);
$pdf->Cell(170,5, 'All charges of bank transfers to be paid by the guest. If the option of credit or debit card payment is chosen there will be a 4% charge to the guest.',0,0);
$pdf->Ln(4);
$pdf->Image('paypal/footeringles2.png',40,278,140);
}
$pdf->Output();
Gracias |