I may just have done something really dumb - but I can't see where for the life of me.
I'm testing on my local workstation, so my base URL is http://localhost/drupal-4.7.4. I've installed pdfview in the "modules" directory, and tcpdf in the "pdfview" directory. I've modified the two parameters in tcpdf_config.php so that they read like this:

	/**
	 * installation path
	 */
	define ("K_PATH_MAIN", "C:/Apache/Apache2/htdocs/drupal-4.7.4/modules/pdfview/tcpdf/config");

	/**
	 * url path
	 */
	define ("K_PATH_URL", "http://localhost/drupal-4.7.4/modules/tcpdf/");

I'm running PHP5, so I installed the PHP5 version of tcpdf.

So far, so good. However, when I try to test the tcpdf installation by running test_unicode.php, I get this as a reply:


Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in C:\Apache\Apache2\htdocs\drupal-4.7.4\modules\pdfview\tcpdf\tcpdf.php on line 95

Fatal error: Cannot instantiate non-existent class: tcpdf in C:\Apache\Apache2\htdocs\drupal-4.7.4\modules\pdfview\tcpdf\test_unicode.php on line 40

I must be doing something really dumb - but what?? Help much appreciated.

Comments

jsgammato’s picture

I had a similar problem in Drupal 5.1 with the PDFView 5 release version running on my hosted site. I posted this message elsewhere, but got no replies:
I just tried installing PDFView on my Drupal 5.1 site.
The installation firections were pretty sketchy for a tyro like me. In particular, the instruction to:
5) Set K_PATH_MAIN costant in tcpdf/config/tcpdf_config.php
is unclear to me - I can find the constant, but to what do I set it?
I did the best I could, but still got and continue to get this error:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /webroot/s/g/sgamm001/www/HarnWriters/modules/pdfview/tcpdf/tcpdf.php on line 95

Of course it is possible that the aforementioned Step 5 is not the problem - maybe I got it right and the error is somewhere else, but then I am really lost.
I appreciate any help.

jsgammato’s picture

I just installed 5.x-1.1 and I am continuing to get the same error.

joel_guesclin’s picture

First problem - I was pretty sure I was working with PHP5, but in fact not. When I switched to using the PHP4 version, I got rid of the first problem I mentioned. Try using the PHP4 version of TCPDF

The K_PATH_MAIN looks like it should point to the path on your server where tcpdf is installed. For the moment I'm still doing things on my workstation, so my parameters look like this:

	define ("K_PATH_MAIN", "C:/Apache/Apache2/htdocs/drupal-4.7.4/modules/pdfview/tcpdf");
	define ("K_PATH_URL", "http://localhost/drupal-4.7.4/modules/tcpdf");

There is another problem which doesn't seem to be documented. The paths to the images and fonts directories are wrong. They should look like this:

	define ("FPDF_FONTPATH", K_PATH_MAIN."/fonts/");
	define ("K_PATH_CACHE", K_PATH_MAIN."/cache/");
	define ("K_PATH_URL_CACHE", K_PATH_URL."/cache/");
	define ("K_PATH_IMAGES", K_PATH_MAIN."/images/");

Bizarrely, the "test_unicode" script supplied with TCPDF still does not work - but the Drupal module does! I have successfully generated one page! Still a way to go before getting into production, but it's on the way.

ashtonium’s picture

Hey, I'm reviewing this module for possible use... ( is it still actively maintained? )

Here's what I've been able to find out about your problem:
The reason you had to add on the slash before the font, cache, & image path definitions is because you removed them from your K_PATH_MAIN definition. If you look at the original tcpdf_config.php file, you will see it has trailing slashes on the default values, I would add those back on and see if it solves any of your problems.

The K_PATH_MAIN seems to be the only important value to set on installation, as K_PATH_URL doesn't seem to be used at all.

I've successfully got this module working on a 5.x install running on PHP5, Apache2, Ubuntu Linux

In order to successfully run the test_unicode.php file (on 5.x) I browsed to: localhost/sites/all/modules/pdfview/tcpdf/test_unicode.php (both with and without friendly URLs)

hopefully some of this info helps you out

jsgammato’s picture

It helped me out - I was pointing to php 5 but running 4..now I am running 5.2 and all seems to be well so far. Thank you!

Egon Bianchet’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)