We are getting below error when generating pdf file using tcpdf in drupal 7.
Notice: tempnam(): file created in the system's temporary directory in TCPDF_STATIC::getObjFilename() (line 296 of /var/www/html/sites/all/libraries/tcpdf/include/tcpdf_static.php).
When we commenting the below code, this error will disappear
$path = 'sites/default/files/'.$user->mail.'/'.$sign_file;
$tcpdf->Image($path,145, 102.75, 40, 15, $sign_filetype , '', '', true, 150, '', false, false, 1, false, false, false);
File permissions of this file is
-rw-rw---- 1 apache apache 5917 Mar 4 23:10 sign.png
Version details are TCPDF module – 7.x-1.0-beta1 and php 7.2.27. Thanks in advance for any suggestion to resolve this issue.
2
Answers
This can be solved by adding the path of temp directory in php.ini file. Eg:
Just came across the same problem today, I was able to resolve it without going to the php.ini
in tcpdf_libconfigtcpdf_config.php
Was set, but there was no cache directory. Creating one with appropriate permissions correct the PHP notice.