Menu

#83 Modification to the tcpdf_include.php file in the examples directory.

Unstable_(example)
open
change (1)
9
2016-02-22
2016-02-22
No

I would like to suggest a simple change to TCPDF. This is in the tcpdf_include.php in the examples directory and the PHP.INI file. This is under Windows. (ie: I have only tried this under Windows.)

After the "// Include the main TCPDF library..." line put

// Include the main TCPDF library (search the library on the following directories).
$a = get_include_path();
$b = explode( ';', $a );

$path = null;
foreach( $b as $k=>$v ){
    if( stripos($v, "tcpdf") !== false ){ $path = "$v/tcpdf.php"; break; }
    }

if( is_null($path) ){
   die("No path provided for the include_path variable in the PHP.INI file"); }
if( @file_exists($path) ){ require_once($path); }
   else { die("File not found : $path"); }

This looks for an entry in the include path sent to PHP. If there is a TCPDF path declared it automatically includes it. This actually would eliminate the $tcpdf_include_dirs and the foreach loop

The changes to the PHP.INI file would be to add the path to TCPDF onto the include_path (which is where it really should go). This would also cause TCPDF to display an error message if there was a problem and then to die gracefully.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB