24/06/2010, 09:10
|
| | Fecha de Ingreso: mayo-2010
Mensajes: 153
Antigüedad: 13 años, 11 meses Puntos: 0 | |
error en enviar pdf phpmailer Hola a todos estoy creando un archivo pdf con tcpdf y despues de crearlo enviarlo por phpmailer y me sale este error. Código PHP:
Warning: fopen(example_048.pdf) [function.fopen]: failed to open stream: Permiso denegado in /opt/lampp/htdocs/sisco/vercotizaciones/tcpdf/tcpdf.php on line 5929 TCPDF ERROR: Unable to create output file: example_048.pdf // codigo que utilizo <?php //============================================================+ // File name : example_003.php // Begin : 2008-03-04 // Last Update : 2009-09-30 // // Description : Example 003 for TCPDF class // Custom Header and Footer // // Author: Nicola Asuni // // (c) Copyright: // Nicola Asuni // Tecnick.com s.r.l. // Via Della Pace, 11 // 09044 Quartucciu (CA) // ITALY // www.tecnick.com // [email protected] //============================================================+ /** * Creates an example PDF TEST document using TCPDF * @package com.tecnick.tcpdf * @abstract TCPDF - Example: Custom Header and Footer * @author Nicola Asuni * @copyright 2004-2009 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - [email protected] * @link http://tcpdf.org * @license http://www.gnu.org/copyleft/lesser.html LGPL * @since 2008-03-04 */ require_once('tcpdf/config/lang/eng.php'); require_once('tcpdf/tcpdf.php'); // Extend the TCPDF class to create custom Header and Footer class MYPDF extends TCPDF { //Page header public function Header() { // Logo $this->Image(K_PATH_IMAGES.'logo.jpg', 15, 8, 30); // Set font $this->SetFont('helvetica', 'B', 10); // Move to the right $this->Cell(80); // Title $this->Cell(30, 10, 'F03-003', 0, 0, 'C'); // Line break $this->Ln(20); } // Page footer public function Footer() { // Position at 1.5 cm from bottom $this->SetY(-25); // Set font $this->SetFont('helvetica', 'I', 8); // Title $this->Cell(0, 0, 'Direccion:Av.37B No. 38A-12 Itagui-Colombia - PBX:(574)370 47 00 -Fax(574) 281 73 27 - 372 78 52', 0, 0, 'C'); // Page number $this->Ln(4); $this->Cell(0, 0, 'WEB PAGE: www.cisealco.com - EMAIL: [email protected]', 0, 0, 'C'); $this->Ln(4); $this->Cell(0, 0, 'Revision 03 05-04', 0, 0, 'C'); $this->Ln(2); $this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, 0, 'C'); } } // create new PDF document $pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 003'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set some language-dependent strings $pdf->setLanguageArray($l); // --------------------------------------------------------- // set font $pdf->SetFont('helvetica', '', 8); // add a page $pdf->AddPage(); // --------------------------------------------------------- // set font $pdf->SetFont('times', 'B', 12); $pdf->MultiCell(0, 0, 'Solicitud No '.$cod.'', 0, 'C', 0, 1, '', '', true, 0); // ----------------------------------------------------------------------------- $pdf->SetFont('helvetica', '', 9); $tbl = <<<EOD <br /> <br /> <br /> <table width="530" border="1" align="left"> <tr> <td width="83"><strong>Fecha</strong></td> <td width="124">$fechasolicitud</td> <td width="40"><strong>Ciudad</strong></td> <td colspan="3" width="276">$Mciudad</td> </tr> <tr> <td width="83"><strong>Empresa</strong></td> <td colspan="5" width="440">$Mempresa</td> </tr> <tr> <td width="83"><strong>Nombre contacto</strong></td> <td width="124">$contacto</td> <td width="42"><strong>Email</strong></td> <td width="124">$email</td> <td width="75"><strong>Teléfono</strong></td> <td width="75"> </td> </tr> <tr> <td width="83"><strong>Fax</strong></td> <td width="124">$fax</td> <td width="42"><strong>Dirección</strong></td> <td width="274" colspan="3">$direccion</td> </tr> <tr> <td width="83"><strong>Precios</strong></td> <td width="124">SEALCO S.A.</td> <td width="42"><strong>Moneda</strong></td> <td width="124">Pesos Colombianos</td> <td width="75"><strong>Iva:</strong></td> <td width="75">16%</td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); // --------------------------------------------------------- // ----------------------------------------------------------------------------- $pdf->SetFont('helvetica', '', 9); $tbl = <<<EOD <table border="1" align="left"> <tr> <td width="20"><strong>Item</strong></td> <td width="22"><strong>Cant</strong></td> <td width="290"><strong>Descripción</strong></td> <td width="70"><strong>Tiempo entrega</strong></td> <td width="60"><strong>Vlr.Unit</strong></td> <td width="60"><strong>Vlr.Total</strong></td> </tr> $mailContents <tr> <td colspan="6" width="522"></td> </tr> <tr> <td width="20"></td> <td width="20"></td> <td width="295"></td> <td width="63"></td> <td width="62"><strong>SUBTOTAL</strong></td> <td width="62" align="right">$ $subtotalfort</td> </tr> <tr> <td width="20"></td> <td width="20"></td> <td width="295"></td> <td width="63"></td> <td width="62"><strong>IVA 16%</strong></td> <td width="62" align="right">$ $ivafort</td> </tr> <tr> <td width="20"></td> <td width="20"></td> <td width="295"></td> <td width="63"></td> <td width="62"><strong>TOTAL</strong></td> <td width="62" align="right">$ $totalfort</td> </tr> <tr> <td width="62">Observaciones</td> <td width="460">$obs</td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); // --------------------------------------------------------- // ----------------------------------------------------------------------------- $pdf->SetFont('helvetica', '', 9); $tbl = <<<EOD <br /> <br /> <br /> <table width="520" border="0" align="left"> <tr> <td width="85">Validez de la oferta</td> <td width="230"><u>$validezof</u></td> <td width="90">Condiciones de pago</td> <td width="115"><u>La usual</u></td> </tr> <tr> <td colspan="4" width="520"> </td> </tr> <tr> <td colspan="4" width="520" align="center"> _________________________________</td> </tr> <tr> <td colspan="4" width="520" align="center">Aprobación</td> </tr> </table> EOD; $pdf->writeHTML($tbl, true, false, false, false, ''); //$pdf->Output('example_048.pdf', 'I'); $filename = "example_048.pdf"; // use for Upload folder >>>>>>>>>>>>>>>>> $pdf->Output("../archivos/" . $filename,"F"); $pdf->Output($filename, "F"); require "../PhpMailer/class.phpmailer.php"; $mail = new phpmailer(); $mail->PluginDir = "../PhpMailer/"; $mail->Mailer = "smtp"; $mail->Host = "190.145.15.166"; $mail->SMTPAuth = true; $mail->Username = "[email protected]"; $mail->Password = "websealco"; $mail->From = "[email protected]"; $mail->FromName = "www.cisealco.com"; $mail->Timeout=15; //$mail->AddReplyTo("[email protected]","sdfsdf"); $mail->AddAddress("[email protected]"); //$mail->AddReplyTo("[email protected]","Nombre Apellido"); //$mail->AddReplyTo('[email protected]', 'sdfsdf'); //A quien //$mail->AddReplyTo("[email protected]", "Replies for my site"); $mail->Subject = "Cotizacion numero uno"; $mail->Body ="<meta http-equiv='content-Type' content='text/html; charset=iso-8859-1' /> <style type='text/css'> <!-- --> </style> Esta es una cotizacion "; $mail->IsHTML(true); $mail->AddAttachment("../archivos/example_048.pdf", "archivo.pdf"); $mail->Send(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Encuesta Sealco</title> <link rel="stylesheet" type="text/css" href="../../master.css"/> </head> <body> </body> </html> |