-1

I need help with these few errors here

`[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(unifont/ttfonts.php): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507

[06-May-2018 20:08:16 America/New_York] PHP Warning: include_once(): Failed opening 'unifont/ttfonts.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507

[06-May-2018 20:08:16 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508`

This is the line 507:

    if (!isset($type) ||  $type != "TrueTypesubset") {
        include_once($this->_getfontpath().'unifont/ttfonts.php');

line 507>>> $ttf = new TTFontFile();

And this is line 508

            $ttf = new TTFontFile();

I updated the paths to this :

    if ($uni) {
    if (defined("_SYSTEM_TTFONTS") && file_exists(_SYSTEM_TTFONTS.$file )) { $ttfilename = _SYSTEM_TTFONTS.$file ; }
    else { $ttfilename = $this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/unifont/'.$file ; }
    $filename = $file;
    $filename =str_replace(' ','',$filename );
    $filename =str_replace('-','',$filename );
    $unifilename = $this->_getfontpath().'unifont/'.strtolower(substr($filename ,0,(strpos($filename ,'.'))));
    $diff = '';
    $enc = '';
    if (file_exists($unifilename.'.mtx.php')) {
        include($unifilename.'.mtx.php');
    }
    if (!isset($type) ||  $type != "TrueTypesubset") {
        include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');
        $ttf = new TTFontFile();

This is the font folder:

squid\lib\tfpdf\font full path: /Applications/MAMP/htdocs/squid/lib/font/

This is the unifont folder

squid\lib\tfpdf\font\unifont Full path: /Applications/MAMP/htdocs/squid/lib/font/unifont

When i change the paths i get this error:

[08-May-2018 14:38:02 America/New_York] PHP Warning:  include_once(/Applications/MAMP/htdocs/squid/lib/font/): failed to open stream: No such file or directory in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507

[08-May-2018 14:38:02 America/New_York] PHP Warning: include_once(): Failed opening '/Applications/MAMP/htdocs/squid/lib/font/' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.45/lib/php') in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 507 [08-May-2018 14:38:02 America/New_York] PHP Fatal error: Class 'TTFontFile' not found in /Applications/MAMP/htdocs/squid/lib/tfpdf.php on line 508

  • Possible duplicate of [PHP - Failed to open stream : No such file or directory](https://stackoverflow.com/questions/36577020/php-failed-to-open-stream-no-such-file-or-directory) – Progman May 08 '18 at 19:06

3 Answers3

0

Try changing

/Applications/MAMP/htdocs/squid/lib/font/

to

/squid/lib/font/

does that help?

Erty Seidohl
  • 4,487
  • 3
  • 33
  • 45
Tom
  • 324
  • 4
  • 11
0
include_once($this->_getfontpath().'/Applications/MAMP/htdocs/squid/lib/font/');

This gives an error because you're trying to include an entire folder, you need to specify a filename

$ttf = new TTFontFile();

This gives an error because the class TTFontFile is not defined, maybe its in another file that you didn't include.

andrew
  • 9,313
  • 7
  • 30
  • 61
0

Seems like the path returned by

$this->_getfontpath()

is incorrect, or the file you are looking to include is not installed at that path.

You should figure out what $this->_getfontpath() returns, where it is defined. Then see if that path exists and what files are there. Also reading the docs for the library you are installing should help you troubleshooting.

d g
  • 1,594
  • 13
  • 13