News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

TCPDF ERROR: Could not include font definition file: helvetica

Started by Twototango, September 18, 2019, 00:17:54 AM

Previous topic - Next topic

Twototango

Hi All,

I know this keeps popping from time to time, read several posts with similar issue.
But nothing that gave me a solution.

When generating a PDF invoice this message appears:

"TCPDF ERROR: Could not include font definition file: helvetica"

The error for it is:

Warning: opendir(/www/htdocs/campsenc/shop/libraries/www/htdocs/campsenc/shop/libraries/vendor/tecnickcom/tcpdf/fonts/): failed to open dir:
No such file or directory in /www/htdocs/campsenc/shop/libraries/vendor/tecnickcom/tcpdf/tcpdf.php on line 4147

As you can see the opendir path is incorrect. It sets '/www/htdocs/campsenc/shop/libraries' twice.

Looked up the stated lines in the file:

protected function getFontsList() {
      if (($fontsdir = opendir(TCPDF_FONTS::_getfontpath())) !== false) {
         while (($file = readdir($fontsdir)) !== false) {
            if (substr($file, -4) == '.php') {
               array_push($this->fontlist, strtolower(basename($file, '.php')));
            }
         }
         closedir($fontsdir);
      }
   }

This is a bit over my head I must admit, as I'm not a programmer... not even sure if these are the lines to fix?
Or maybe there's a whole different solution?

can anyone help me out?

VM VirtueMart 3.4.2
Joomla! 3.9.11

Thanks Jack

StefanSTS

Are you using TCPDF 1.0.8 with VM 3.4.2?
You might consider going back to 1.0.6 then, or updating VM to 3.6.0.

Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

Twototango

Hi Stefan,

No I'm using TCPDF 1.05, that came with the distribution.
Tried 1.08 but that gave me a 500 error...

Updating to 3.60. is not possible at this time...
tried that too, but propped up a problem with the custom build cart.
So that has to be for later...

Jack


stAn99

hello, this problem is most probably already fixed by a newer versions of virtuemart, if you want to get it fixed, please see my solution over here:

https://www.rupostel.com/phpBB3/viewtopic.php?f=7&t=3869

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Twototango

Thanks Stan,

My TCPDF 1.05 did not contain the line mentioned in your solution:

\libraries\vendor\tecnickcom\tcpdf\config\tcpdf_config.php
define("K_PATH_MAIN", VMPATH_LIBS . $cyu.'/');

So installed TCPDF 1.08 and altered it to:
define("K_PATH_MAIN",  $cyu.'/');

Seems to fix the font problem... but gives me this error:

TCPDF ERROR: Unable to create output file: ../fhthtFGDEEjjjrrKK18/invoices/vminvoice_19091924R40512.pdf
(safe path folder is altered for security reasons)

Checked the folders, all are set to CHmod 755


Jack

Milbo

when you want to use the tcpdf1.0.8 with vm3.4.x than you need to add or adjust the tcpdf function in vmdefines like that.

static public function tcpdf(){

static $tcPath = null;
if($tcPath === null){
$paths = array('/vendor/tecnickcom/tcpdf', '/tcpdf');
foreach($paths as $p){
if(file_exists(VMPATH_LIBS .$p.'/tcpdf.php')){
$tcPath = $p;
break;
}
}
if($tcPath === null){
vmLanguage::loadJLang('com_virtuemart_config');
vmWarn('COM_VIRTUEMART_TCPDF_NINSTALLED');
$tcPath = false;
} else {
defined ('VMPATH_TCPDF') or define ('VMPATH_TCPDF', VMPATH_LIBS .$tcPath );
JLoader::register('TCPDF',VMPATH_TCPDF .'/tcpdf.php');
}
}
return $tcPath;
}


Then you should also not need the "fix" of Stan.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Twototango

Hi Milbo,

This works...!!!

Reinstalled TCPDF 1.08 just to be sure of a fresh file set.
Added your code to vmdefines file.

Still gave the same error, but resetting the VM safe path fixed it.

Thank you very much... able to save and print the orders again.

Jack