PDF TCPDF Error using Helvetica

General questions regarding the use of languages in Joomla! 1.5.

Moderator: General Support Moderators

Locked
adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

PDF TCPDF Error using Helvetica

Post by adam_fake » Mon Mar 24, 2008 8:47 pm

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

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Wed Mar 26, 2008 4:26 pm

Is this because i'm using Helvetica as my font on the site? Surely it can't be as simple as that?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Thu Mar 27, 2008 10:48 am

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

Code: Select all

<pdfFontName>freesans</pdfFontName>
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/
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Thu Mar 27, 2008 3:51 pm

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:

Code: Select all

<pdfFontName>helvetica</pdfFontName>
instead of freesans?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Thu Mar 27, 2008 4:11 pm

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:

Code: Select all

<pdfFontName>helvetica</pdfFontName>
instead of freesans?
No. Font used in the site is not concerned.
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 · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Thu Mar 27, 2008 5:07 pm

Yeah - i'm using English as the language (en-GB). Inside my 'pdf_fonts' folder i have the following:
freesans.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
In my 'en_GB.xml' file i have

Code: Select all

<pdfFontName>freesans</pdfFontName>

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Fri Mar 28, 2008 6:01 am

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.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Sat Mar 29, 2008 10:18 pm

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

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Sun Mar 30, 2008 7:21 am

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 · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Sun Mar 30, 2008 10:26 am

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?

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Sun Mar 30, 2008 2:11 pm

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... ;)
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Sun Mar 30, 2008 4:41 pm

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.

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Sun Mar 30, 2008 4:55 pm

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()
		*/

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Sun Mar 30, 2008 6:10 pm

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.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Sun Mar 30, 2008 7:04 pm

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

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Mon Mar 31, 2008 6:44 am

Upgrade from our 1.5.2 release full package and edit the right tcpdf.php as I suggested.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
esedic
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 145
Joined: Wed Dec 27, 2006 1:55 pm
Contact:

Re: PDF TCPDF Error using Helvetica

Post by esedic » Fri Apr 04, 2008 9:57 am

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:

Code: Select all

	/**
	 * installation path
	 */
	define ("K_PATH_MAIN", "D:/Inetpub/wwwroot/_OPENSOURCE/tcpdf/");
	
	/**
	 * url path
	 */
	define ("K_PATH_URL", "http://localhost/_OPENSOURCE/tcpdf/");
http://www.spletodrom.com | Izdelava spletnih strani

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Fri Apr 04, 2008 10:18 am

/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
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
esedic
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 145
Joined: Wed Dec 27, 2006 1:55 pm
Contact:

Re: PDF TCPDF Error using Helvetica

Post by esedic » Fri Apr 04, 2008 10:50 am

Ok, I understand now, but I still have a problem with pdf export as uncommenting that line didn't worked.

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
It's killing me because I'm developing this site and I thought it was almost finished and this error is quite substantial. :(

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Fri Apr 04, 2008 1:12 pm

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
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Fri Apr 04, 2008 4:15 pm

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.

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Wed Apr 09, 2008 11:23 am

Just completed the upgrade and it didn't make a difference - still get the same problem!

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Wed Apr 09, 2008 1:31 pm

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.

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 18746
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: PDF TCPDF Error using Helvetica

Post by infograf768 » Thu Apr 10, 2008 9:20 am

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.
Thanks for sharing.
An interesting issue indeed.
Which once more demonstrates that CSS are always better.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

adam_fake
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 135
Joined: Thu Oct 04, 2007 8:15 pm

Re: PDF TCPDF Error using Helvetica

Post by adam_fake » Thu Apr 10, 2008 3:38 pm

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!


Locked

Return to “Language - Joomla! 1.5”