Foros del Web » Programando para Internet » PHP »

PHP OO Error al crear un PDF de la Web

Estas en el tema de Error al crear un PDF de la Web en el foro de PHP en Foros del Web. Hola es mi primer tema en este foro y mi problema es el siguiente he diseñado con joomla una web inmobiliaria a través de un ...
  #1 (permalink)  
Antiguo 06/07/2011, 11:08
 
Fecha de Ingreso: julio-2011
Mensajes: 3
Antigüedad: 12 años, 9 meses
Puntos: 0
Pregunta Error al crear un PDF de la Web

Hola es mi primer tema en este foro y mi problema es el siguiente he diseñado con joomla una web inmobiliaria a través de un componente especifico para ello y la web tiene la opción de crear un PDF de las viviendas para imprimir todos las características y fotos de una vivienda pero al utilizar la opción de crear un PDF me surge el siguiente error

Parse error: syntax error, unexpected $end in /homepages/19/d371359803/htdocs/libraries/tcpdf/tcpdf.php on line 4461


La línea 4461 es la última línea del archivo tcpdf.php, para no poner todo el código del archivo voy a poner las últimas líneas del código:


* @return string
* @access protected
* @author Nicola Asuni
* @since 2.1.000 (2008-01-08)
* @see UTF8ToUTF16BE()
*/
function arrUTF8ToUTF16BE($unicode, $setbom=true) {
$outstr = ""; // string to be returned
if ($setbom) {
$outstr .= "\xFE\xFF"; // Byte Order Mark (BOM)
}
foreach($unicode as $char) {
if($char == 0xFFFD) {
$outstr .= "\xFF\xFD"; // replacement character
} elseif ($char < 0x10000) {
$outstr .= chr($char >> 0x08);
$outstr .= chr($char & 0xFF);
} else {
$char -= 0x10000;
$w1 = 0xD800 | ($char >> 0x10);
$w2 = 0xDC00 | ($char & 0x3FF);
$outstr .= chr($w1 >> 0x08);
$outstr .= chr($w1 & 0xFF);
$outstr .= chr($w2 >> 0x08);
$outstr .= chr($w2 & 0xFF);
}
}
return $outstr;
}
// ================================================== ==

/**
* Set header font.
* @param array $font font
* @since 1.1
*/
function setHeaderFont($font) {
$this->header_font = $font;
}

/**
* Set footer font.
* @param array $font font
* @since 1.1
*/
function setFooterFont($font) {
$this->footer_font = $font;
}

/**
* Set language array.
* @param array $language
* @since 1.1
*/
function setLanguageArray($language) {
$this->l = $language;
$this->rtl = $this->l['a_meta_dir']=='rtl' ? true : false;
}

/**
* Set document barcode.
* @param string $bc barcode
*/
function setBarcode($bc="") {
$this->barcode = $bc;
}

/**
* Print Barcode.
* @param int $x x position in user units
* @param int $y y position in user units
* @param int $w width in user units
* @param int $h height position in user units
* @param string $type type of barcode (I25, C128A, C128B, C128C, C39)
* @param string $style barcode style
* @param string $font font for text
* @param int $xres x resolution
* @param string $code code to print
*/
function writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code) {
require_once(dirname(__FILE__)."/barcode/barcode.php");
require_once(dirname(__FILE__)."/barcode/i25object.php");
require_once(dirname(__FILE__)."/barcode/c39object.php");
require_once(dirname(__FILE__)."/barcode/c128aobject.php");
require_once(dirname(__FILE__)."/barcode/c128bobject.php");
require_once(dirname(__FILE__)."/barcode/c128cobject.php");

if (empty($code)) {
return;
}

if (empty($style)) {
$style = BCS_ALIGN_LEFT;
$style |= BCS_IMAGE_PNG;
$style |= BCS_TRANSPARENT;
//$style |= BCS_BORDER;
//$style |= BCS_DRAW_TEXT;
//$style |= BCS_STRETCH_TEXT;
//$style |= BCS_REVERSE_COLOR;
}
if (empty($font)) {$font = BCD_DEFAULT_FONT;}
if (empty($xres)) {$xres = BCD_DEFAULT_XRES;}

$scale_factor = 1.5 * $xres * $this->k;
$bc_w = round($w * $scale_factor); //width in points
$bc_h = round($h * $scale_factor); //height in points

switch (strtoupper($type)) {
case "I25": {
$obj = new I25Object($bc_w, $bc_h, $style, $code);
break;
}
case "C128A": {
$obj = new C128AObject($bc_w, $bc_h, $style, $code);
break;
}
default:
case "C128B": {
$obj = new C128BObject($bc_w, $bc_h, $style, $code);
break;
}
case "C128C": {
$obj = new C128CObject($bc_w, $bc_h, $style, $code);
break;
}
case "C39": {
$obj = new C39Object($bc_w, $bc_h, $style, $code);
break;
}
}

$obj->SetFont($font);
$obj->DrawObject($xres);

//use a temporary file....
$tmpName = tempnam(K_PATH_CACHE,'img');
imagepng($obj->getImage(), $tmpName);
$this->Image($tmpName, $x, $y, $w, $h, 'png');
$obj->DestroyObject();
unset($obj);
unlink($tmpName);
}

/**
* Returns the PDF data.
*/
function getPDFData() {
if($this->state < 3) {
$this->Close();
}
return $this->buffer;
}

// --- HTML PARSER FUNCTIONS ---

/**
* Allows to preserve some HTML formatting.<br />
* Supports: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small
* @param string $html text to display
* @param boolean $ln if true add a new line after text (default = true)
* @param int $fill Indicates if the background must be painted (1) or transparent (0). Default value: 0.
* @param boolean $reseth if true reset the last cell height (default false).
* @param boolean $cell if true add the default cMargin space to each Write (default false).
*/
function writeHTML($html, $ln=true, $fill=0, $reseth=false, $cell=false) {

// store some variables
$html=strip_tags($html,"<h1><h2><h3><h4><h5><h6><b ><u><i><a><img><p><br><br/><strong><em><font><blockquote><li><ul><ol><hr><td ><th><tr><table><sup><sub><small><span><div>"); //remove all unsupported tags
//replace carriage returns, newlines and tabs
$repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
$html = strtr($html, $repTable);
$pattern = '/(<[^>]+>)/Uu';
$a = preg_split($pattern, $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); //explodes the string

if ((empty($this->lasth))OR ($reseth)) {
//set row height
$this->lasth = $this->FontS


Si alguien me puede ayudar a resolver poque en la línea 4461 me da un error se agradece.

Saludos a toda la gente de este gran foro
  #2 (permalink)  
Antiguo 06/07/2011, 11:24
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Error al crear un PDF de la Web

¿Has modificado la clase original?

Porque vamos, dicho error no debería surgir a menos que hayas modificado, cosa que no es correcta si no sabes lo que haces.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 07/07/2011, 02:56
 
Fecha de Ingreso: julio-2011
Mensajes: 3
Antigüedad: 12 años, 9 meses
Puntos: 0
Hola Paketetrueke

No he modificado ningún archivo .php ese es el original tal y como esta, pero tiene un error de sintaxis que no consigo averiguar en la ultima linea.
  #4 (permalink)  
Antiguo 07/07/2011, 09:22
 
Fecha de Ingreso: julio-2011
Mensajes: 3
Antigüedad: 12 años, 9 meses
Puntos: 0
Problema resuelto

El problema era mas complicado de lo que parecía ya que al instalar el componente por A o B ese archivo se subió a medias y faltaban 2.000 líneas de código con lo cual era imposible que funcionara instale el archivo correcto y problema resuelto ya tengo PDF de la web.

Saludos y gracias.

Etiquetas: html, pdf, variables
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:16.