Advertisement
PDF TCPDF Error using Helvetica
Moderator: General Support Moderators
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
PDF TCPDF Error using Helvetica
I get the following error when trying to use the PDF icon:
Warning: TCPDF::include(/language/pdf_fonts/helvetica.php) [function.TCPDF-include]: failed to open stream: No such file or directory in /libraries/tcpdf/tcpdf.php on line 1661
Warning: TCPDF::include() [function.include]: Failed opening 'language/pdf_fonts/helvetica.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /libraries/tcpdf/tcpdf.php on line 1661
TCPDF error: Could not include font definition file
Can anyone help me resolve this?
Thanks
Warning: TCPDF::include(/language/pdf_fonts/helvetica.php) [function.TCPDF-include]: failed to open stream: No such file or directory in /libraries/tcpdf/tcpdf.php on line 1661
Warning: TCPDF::include() [function.include]: Failed opening 'language/pdf_fonts/helvetica.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /libraries/tcpdf/tcpdf.php on line 1661
TCPDF error: Could not include font definition file
Can anyone help me resolve this?
Thanks
Advertisement
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Is this because i'm using Helvetica as my font on the site? Surely it can't be as simple as that?
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
The tcpdf font to use when creating a pdf has to be included in the language/pdf_fonts/ folder
It is defined in the language/xx-XX/xx-XX.xml file (i.e.e for English in language/en-GB/en-GB.xml
The default font in Joomla! official release is freesans.
It is included in the 1.5.x releases.
I suggest you use 1.5.2 as the tcpdf library has also been updated.
If you use another language, the fonts may be available here:
http://joomlacode.org/gf/project/pdffonts15/frs/
It is defined in the language/xx-XX/xx-XX.xml file (i.e.e for English in language/en-GB/en-GB.xml
Code: Select all
<pdfFontName>freesans</pdfFontName>
It is included in the 1.5.x releases.
I suggest you use 1.5.2 as the tcpdf library has also been updated.
If you use another language, the fonts may be available here:
http://joomlacode.org/gf/project/pdffonts15/frs/
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Ok, thanks for this - i think i understand. Because i'm using HELVETICA as my font on the site, it is trying to export a PDF using HELVETICA- but because the HELVETICA file can't be found in the Language folder it can't export the PDF.
If i can locate the 'HELVETICA.PHP' file and include it in the language folder - should this resolve the issue? Do i also need to edit the 'Language/en-GB/en-GB.xml' file to use:
instead of freesans?
If i can locate the 'HELVETICA.PHP' file and include it in the language folder - should this resolve the issue? Do i also need to edit the 'Language/en-GB/en-GB.xml' file to use:
Code: Select all
<pdfFontName>helvetica</pdfFontName>
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
No. Font used in the site is not concerned.adam_fake wrote:Ok, thanks for this - i think i understand. Because i'm using HELVETICA as my font on the site, it is trying to export a PDF using HELVETICA- but because the HELVETICA file can't be found in the Language folder it can't export the PDF.
If i can locate the 'HELVETICA.PHP' file and include it in the language folder - should this resolve the issue? Do i also need to edit the 'Language/en-GB/en-GB.xml' file to use:
instead of freesans?Code: Select all
<pdfFontName>helvetica</pdfFontName>
Use the freesans font as all European languages do. It is composed of 3 files.
Look in the pdf_fonts folder to check they are present and then make sure <pdfFontName>freesans</pdfFontName> is in your site xml file.
Are you using English as your site language? If not which language?
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Yeah - i'm using English as the language (en-GB). Inside my 'pdf_fonts' folder i have the following:
In my 'en_GB.xml' file i havefreesans.ctg.z
freesans.php
freesans.z
freesansb.php
freesansbi.php
freesansbold.ctg
freesansbold.z
freesansboldoblique.ctg.z
freesansboldoblique.z
freesansi.php
freesansoblique.ctg.z
freesansoblique.z
index.html
tcpdf.php
Code: Select all
<pdfFontName>freesans</pdfFontName>
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
tcpdf.php has nothing to do in this folder.
Looks like you may be missing something in your install.
I suggest you upgrade to 1.5.2 using a the full stable release and check again.
Looks like you may be missing something in your install.
I suggest you upgrade to 1.5.2 using a the full stable release and check again.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Hmm, i'm currently using 1.5.2 - installed via my web host's 'one-click' install option. Shame as i don't want to have to start again...
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
You do not have to start again, just pick-up 1.5.2 full package on Joomlacode and overwrite your remote install (after putting aside anything custom you would have modified in core)
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Forgive my ignorance on all of this - So i go ahead and put aside the templates/css that i've changed and simply replace everything else with a fresh upload of 1.5.2?
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
Forgive us, me made a mistake in tcpdf.php
Comment this line:
require_once(dirname(__FILE__).'/config/tcpdf_config.php');
i.e.
change to
//require_once(dirname(__FILE__).'/config/tcpdf_config.php');
we found some other mistakes...
Comment this line:
require_once(dirname(__FILE__).'/config/tcpdf_config.php');
i.e.
change to
//require_once(dirname(__FILE__).'/config/tcpdf_config.php');
we found some other mistakes...

Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
I've made this change and re-uploaded the TCPDF.php file - is there any other changes required? I'm still getting the same error unfortunately.
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
I noticed this in the TCPDF.php file - my error appears on line 1661, this comment is just above it:
Code: Select all
/**
* Imports a TrueType or Type1 font and makes it available. It is necessary to generate a font definition file first with the makefont.php utility. The definition file (and the font file itself when embedding) must be present either in the current directory or in the one indicated by FPDF_FONTPATH if the constant is defined. If it could not be found, the error "Could not include font definition file" is generated.
* Support UTF-8 Unicode [Nicola Asuni, 2005-01-02].
* <b>Example</b>:<br />
* <pre>
* $pdf->AddFont('Comic','I');
* // is equivalent to:
* $pdf->AddFont('Comic','I','comici.php');
* </pre>
* @param string $family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
* @param string $style Font style. Possible values are (case insensitive):<ul><li>empty string: regular (default)</li><li>B: bold</li><li>I: italic</li><li>BI or IB: bold italic</li></ul>
* @param string $file The font definition file. By default, the name is built from the family and style, in lower case with no space.
* @since 1.5
* @see SetFont()
*/
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
The original error you posted is NOT line 1661.
The hack above should take care of it.
What is the exact error you get now?
It looks like you are not using Joomla! 1.5.2 and that this is the 1.5.3 tcpdf libary you have.
The hack above should take care of it.
What is the exact error you get now?
It looks like you are not using Joomla! 1.5.2 and that this is the 1.5.3 tcpdf libary you have.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
The error i encounter is the original in the first post. I've tried to enter what you suggested and i still get the same error...
I'm using Joomla 1.5.2 - the 'one-click install' from my webhost. All i've done to my joomla site is alter the template HTML and CSS to suit my design/layout. Just seem to come across the PDF problem....
I'm using Joomla 1.5.2 - the 'one-click install' from my webhost. All i've done to my joomla site is alter the template HTML and CSS to suit my design/layout. Just seem to come across the PDF problem....
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
Upgrade from our 1.5.2 release full package and edit the right tcpdf.php as I suggested.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
- esedic
- Joomla! Enthusiast
- Posts: 145
- Joined: Wed Dec 27, 2006 1:55 pm
- Contact:
Re: PDF TCPDF Error using Helvetica
I have the same problem and I can't resolve it.
The hack infograf768 proposed did not worked.
I've noticed that in /libraries/tcpdf/config/tcpdf_config.php there are certain values like installation path, url path, etc.
Should these values be changed, because this looks strange to me:
The hack infograf768 proposed did not worked.
I've noticed that in /libraries/tcpdf/config/tcpdf_config.php there are certain values like installation path, url path, etc.
Should these values be changed, because this looks strange to me:
Code: Select all
/**
* installation path
*/
define ("K_PATH_MAIN", "D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/");
/**
* url path
*/
define ("K_PATH_URL", "http://localhost/_OPENSOURCE/tcpdf/");
https://www.spletodrom.si| Izdelava spletnih strani
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
/libraries/tcpdf/config/tcpdf_config.php should not be used by the system.
It should be replaced by our own definitions in pdf.php (see hack above).
The little hack overwrite the access to tcpdf_config.php
It should be replaced by our own definitions in pdf.php (see hack above).
The little hack overwrite the access to tcpdf_config.php
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
- esedic
- Joomla! Enthusiast
- Posts: 145
- Joined: Wed Dec 27, 2006 1:55 pm
- Contact:
Re: PDF TCPDF Error using Helvetica
Ok, I understand now, but I still have a problem with pdf export as uncommenting that line didn't worked.
It's killing me because I'm developing this site and I thought it was almost finished and this error is quite substantial. 
Code: Select all
Warning: addfont(freesans.php): failed to open stream: No such file or directory in /var/www/vhosts/finmart.si/subdomains/beta/httpdocs/libraries/tcpdf/tcpdf.php on line 1661
Warning: addfont(): Failed opening 'freesans.php' for inclusion (include_path='.:.:.:') in /var/www/vhosts/finmart.si/subdomains/beta/httpdocs/libraries/tcpdf/tcpdf.php on line 1661
TCPDF error: Could not include font definition file

- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
This means the freesans 3 files fonts are not included in the folder pdf_fonts
As these come with Joomla install, I guess yoy have to check your install
As these come with Joomla install, I guess yoy have to check your install
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
I'm in the middle of replacing all the files to see if its going to make a difference. Just backing up my site and database, once thats done i'll let you know if its worked. Also - mine was doing the same, looking for the Freesans files which were clearly in the pdf_fonts folder.
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
Just completed the upgrade and it didn't make a difference - still get the same problem!
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
SOLVED - and its actually such a simple thing that was causing the problem.
I selected the HTML tab in the article's editor, low and behold for some reason, possibly when copying the text into the article, it had tagged the text with '<font face="helvetica"></font>.
After removing this, everything works fine, didn't need to re-install or do any upgrades, just this! Exports the PDF no problem. All of that for one simple little problem.
I selected the HTML tab in the article's editor, low and behold for some reason, possibly when copying the text into the article, it had tagged the text with '<font face="helvetica"></font>.
After removing this, everything works fine, didn't need to re-install or do any upgrades, just this! Exports the PDF no problem. All of that for one simple little problem.
- infograf768
- Joomla! Master
- Posts: 19128
- Joined: Fri Aug 12, 2005 3:47 pm
- Location: **Translation Matters**
Re: PDF TCPDF Error using Helvetica
Thanks for sharing.adam_fake wrote:SOLVED - and its actually such a simple thing that was causing the problem.
I selected the HTML tab in the article's editor, low and behold for some reason, possibly when copying the text into the article, it had tagged the text with '<font face="helvetica"></font>.
After removing this, everything works fine, didn't need to re-install or do any upgrades, just this! Exports the PDF no problem. All of that for one simple little problem.
An interesting issue indeed.
Which once more demonstrates that CSS are always better.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group
-
- Joomla! Enthusiast
- Posts: 135
- Joined: Thu Oct 04, 2007 8:15 pm
Re: PDF TCPDF Error using Helvetica
CSS all the way - i can only think that it added that piece of code when i'd copied into the text editor from another web-page....
God knows, but i hope this helps shed some light for future reference. Thanks for everyones help!
God knows, but i hope this helps shed some light for future reference. Thanks for everyones help!
Advertisement