Cannot load font?

karl sf - March 24, 2007 - 20:41
Project:Pdfview
Version:5.x-1.1
Component:Documentation
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community
Description

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.

#1

karl sf - March 24, 2007 - 20:44

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.

#2

Crell - March 27, 2007 - 15:17
Component:Code» Documentation
Category:support request» bug report

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:

<?php
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.

#3

Crell - March 27, 2007 - 15:29

Follow-up, I think this is more general:

<?php
define
("K_PATH_MAIN", drupal_get_path('module', 'pdfview') . "/tcpdf/");
define ("K_PATH_URL", base_path() . drupal_get_path('module', 'pdfview') . "/tcpdf/");
?>

#4

Christefano - July 3, 2007 - 15:50
Status:active» reviewed & tested by the community

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

#5

promes - September 20, 2007 - 10:25

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.

#6

jerome_107 - February 20, 2008 - 05:48

hi all!

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

jerome

#7

okellhammer - May 29, 2008 - 01:47

Thanks !!

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

 
 

Drupal is a registered trademark of Dries Buytaert.