After upgrading from version 6.x-1.14 to 6.x-1.17 PDF pages are empty or an error message is displayed (depending on the PHP error_reporting setting) if the Token module is not enabled in a drupal 6.x site.

I think the reason for the problem lies in the following code block in print_pdf/print_pdf.pages.inc (line 42):

if (function_exists('token_replace') && !empty($pdf_filename) && !empty($node)) {
	$pdf_filename = token_replace($pdf_filename, 'node', $node);
}
else {
	$pdf_filename = token_replace($pdf_filename, 'global');
	if (empty($pdf_filename) || count(token_scan($pdf_filename))) {
		// If there are still tokens, use a fallback solution
		$pdf_filename = str_replace('/', '_', $path);
	}
}

The if condition tests for the existence of the function 'token_replace' but the else branch also users this function wich leads to an error.

After installing and enabling the Token module the PDF pages are displayed correct (with the current developer version of the print module).

Comments

jcnventura’s picture

Well spotted, thanks for the bug report.

jcnventura’s picture

Status: Fixed » Closed (fixed)

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

Franz-’s picture

maybe fixed in git, but not in the downloadable 6.17, at least I get a failure message without token module (which I loaded now only for the PDFs)