I got a parse error, if there is an single quote in text:

Parse error: syntax error, unexpected T_STRING in /modules/print/include/php_evaluator.cls.php(66) : eval()'d code on line 18 Unable to stream pdf: headers already sent

Eval code (line with $pdf->page_text):

if (isset($pdf)) {
$font = Font_Metrics::get_font("verdana");;
$size = 10;
$color = array(0,0,0);
$text_height = Font_Metrics::get_font_height($font, $size);

$w = $pdf->get_width();
$h = $pdf->get_height();

$footer = $pdf->open_object();

// Draw a line along the bottom
$y = $h - 25;
$pdf->line(15, $y, $w - 15, $y, $color, 1);

$y += $text_height / 2;
$pdf->page_text(15, $y, 'Fondation de l'Ecole Internationale de Genève
62, route de Chêne - CH-1208 Genève
Tel: +41 22 787 2400 - Fax: +41 22 787 2410
', $font, $size, $color);

$pdf->close_object();
$pdf->add_object($footer, "all");

// Center the text
$width = Font_Metrics::get_text_width("Page 1 of 2", $font, $size);
$pagenumtxt = t("Page !n of !total", array("!n" => "{PAGE_NUM}", "!total" => "{PAGE_COUNT}"));
$pdf->page_text($w - 15 - $width, $y, $pagenumtxt, $font, $size, $color);
}

I added addslashes in print_pdf.pages.inc and it seems to work. =)

$pdf->page_text(15, $y, \''. addslashes(strip_tags($tpl_footer[1])) .'\', $font, $size, $color);

Thomas

Comments

jcnventura’s picture

Status: Active » Fixed

Hi,

Thanks for the fix. I have committed this to CVS.

João

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.