function.addfont seems to be failing on a path issue, but I am not sure where to change the path.
Error received:

"# warning: addfont(D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/fonts/freeserif.php) [function.addfont]: failed to open stream: No such file or directory in /home/karl/public_html/home/d5/modules/pdfview/tcpdf/tcpdf.php on line 1651.
# warning: addfont() [function.include]: Failed opening 'D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/fonts/freeserif.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/karl/public_html/home/d5/modules/pdfview/tcpdf/tcpdf.php on line 1651."

My host runs PHP4.4, so I installed the 'tcpdf_php4' and renamed the directory to 'tcpdf' which correct a failure to open stream. Now I have this error.

Thanks.
K.

Comments

karl sf’s picture

Upon clicking the "Download PDF" button I see the following error:
"TCPDF error: Could not include font definition file"

When I go back to the page that tried launching the PDF I get the error above.

Crell’s picture

Component: Code » Documentation
Category: support » bug

Although it doesn't seem to be documented anywhere in the PDFview docs, with tcpdf you need to setup the config file with the necessary paths. There's various defines at the top of tcpdf/config/tcpdf_config.php. For me, I used the following and it was able to find things:

define ("K_PATH_MAIN", "sites/all/modules/pdfview/tcpdf/");
define ("K_PATH_URL", base_path() . "sites/all/modules/pdfview/tcpdf/");

Your paths may vary.

Moving this to a documentation bug, since that step really should be mentioned more prominently.

Crell’s picture

Follow-up, I think this is more general:

define ("K_PATH_MAIN", drupal_get_path('module', 'pdfview') . "/tcpdf/");
define ("K_PATH_URL", base_path() . drupal_get_path('module', 'pdfview') . "/tcpdf/");
Christefano-oldaccount’s picture

Status: Active » Reviewed & tested by the community

Looks good, Crell. Let's get this added to the documentation.

promes’s picture

Today I had almost the same error, but the path now reads: /var/www/html/sites/all/modules/pdfview/tcpdffont/freeserif.php

I downloaded both projects (pdfview and tcpdf) this week, so some changes can have been made already in the files since last comments.

The problem is in tcpdf/config directory in file tcpdf_config.php.
The following line is in error:
define ("K_PATH_MAIN", "/var/www/html/sites/all/modules/pdfview/tcpdf");
This should read / be changed into:
define ("K_PATH_MAIN", "/var/www/html/sites/all/modules/pdfview/tcpdf/");
Attention: only a trailing slash has been appended (ala the K_PATH_URL definition).

Thanks for a nice project.

jerome_107’s picture

hi all!

thanks for this useful module...
thanks for this forum thread, too...

jerome

okellhammer’s picture

Thanks !!

This fix works like a charm. Now the Pdfview module is usable in Drupal 5.7