I tried to upgrade 12.3 to 12 .5 and 13.0. After the update I had a great deal of problems with PDF files.
Where big and cannot be displaied.
After a long seach I found that there is a function in dolibar/htdocs/includes/technikom/tcpdf/tdpdf.php:
public function _destroy($destroyall=false, $preserve_objcopy=false) {
// restore internal encoding
if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
mb_internal_encoding($this->internal_encoding);
}
if (isset(self::$cleaned_ids[$this->file_id])) {
$destroyall = false;
}
if ($destroyall AND !$preserve_objcopy) {
self::$cleaned_ids[$this->file_id] = true;
// remove all temporary files
if ($handle = opendir(K_PATH_CACHE)) {
while ( false !== ( $file_name = readdir( $handle ) ) ) {
if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) {
unlink(K_PATH_CACHE.$file_name);
}
}
closedir($handle);
}
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
// @CHANGE DOL
// unlink($file);
}
}
}
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
// @CHANGE DOL
// 'imagekeys',
'sign',
'signature_data',
'signature_max_length',
'byterange_string',
'tsa_timestamp',
'tsa_data'
);
which was wrong - at least for my installation.
I replace it with the old one, from version 6.0.3
public function _destroy($destroyall=false, $preserve_objcopy=false) {
// restore internal encoding
if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
mb_internal_encoding($this->internal_encoding);
}
if (isset(self::$cleaned_ids[$this->file_id])) {
$destroyall = false;
}
if ($destroyall AND !$preserve_objcopy) {
self::$cleaned_ids[$this->file_id] = true;
// remove all temporary files
if ($handle = opendir(K_PATH_CACHE)) {
while ( false !== ( $file_name = readdir( $handle ) ) ) {
if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) {
unlink(K_PATH_CACHE.$file_name);
}
}
closedir($handle);
}
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
// @CHANGE DOL
// unlink($file);
}
}
}
$preserve = array(
'file_id',
'internal_encoding',
'state',
'bufferlen',
'buffer',
'cached_files',
// @CHANGE DOL
// 'imagekeys',
'sign',
'signature_data',
'signature_max_length',
'byterange_string',
'tsa_timestamp',
'tsa_data'
);
foreach (array_keys(get_object_vars($this)) as $val) {
if ($destroyall OR !in_array($val, $preserve)) {
if ((!$preserve_objcopy OR ($val != 'objcopy')) AND ($val != 'file_id') AND isset($this->$val)) {
unset($this->$val);
}
}
}
}
and now PDF files are ok at least for version 12.5.
For version 13 i will come back soon.