I have been having problems similar to those reported at http://drupal.org/node/130779 -- however, my configuration is fine, I think. I'm using this code to set constants in tcpdf_config.php:

	/**
	 * installation path
	 */
	$path = drupal_get_path('module', 'pdfview') .'/tcpdf';
  define ("K_PATH_MAIN", realpath($path) .'/');
	
	/**
	 * url path
	 */
	define ("K_PATH_URL", url($path .'/', NULL, NULL, TRUE));

But I keep getting this when I click to view a node's PDF version:

TCPDF error: Could not include font definition file

and then when I return to the node I'm trying to pdf-ify, I see this message from Drupal:

# warning: addfont(font/freeserif.php) [function.addfont]: failed to open stream: No such file or directory in /home/choosing/public_html/sites/all/modules/pdfview/tcpdf/tcpdf.php on line 1661.
# warning: addfont(font/freeserif.php) [function.addfont]: failed to open stream: No such file or directory in /home/choosing/public_html/sites/all/modules/pdfview/tcpdf/tcpdf.php on line 1661.
# warning: addfont() [function.include]: Failed opening 'font/freeserif.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/choosing/public_html/sites/all/modules/pdfview/tcpdf/tcpdf.php on line 1661.

The problem seems to be FPDF_FONTPATH, the variable that gets set in the config file right after K_PATH_URL. When I check its contents after its define statement in tcpdf_config.php, it says that it equals 'font/' rather than 'K_PATH_MAIN."fonts/"' (which = '/home/choosing/public_html/sites/all/modules/pdfview/tcpdf/fonts' in my case). So... where else is this constant getting set, so that the define statement here isn't working? Any ideas?

Comments

bdimaggio’s picture

Title: FPDF_FONTPATH seems to have been defined somewhere before tcpdf_config.php » Table_export conflicts with Pdfview!

Aha. Turns out that that the table export module contains a copy of FPDF, the pdf-generating library that I believe is the precursor to Pdfview's (TCPDF). FPDF sets the constant that was bugging me, FPDF_FONTPATH, and then of course TCPDF is powerless to change that. I imagine that I would have run into other conflicts of this sort had I somehow managed to get around this, too... My solution was just to uninstall table export, since I fortunately didn't really need it.

rconstantine’s picture

I wonder if table_export can be made to work with pdf_view's TCPDF...