- Edited
Hi all!I try to add second logo when i print ticket, but i didn't see logo.Where i'm need to modify class.pdf.php file or how can i do this?THnx 4 help.
Hi all!I try to add second logo when i print ticket, but i didn't see logo.Where i'm need to modify class.pdf.php file or how can i do this?THnx 4 help.
I think you need to alter the following code in include/class.pdf.php around line 55:if (!function_exists('imagecreatefromstring') || (!($logo = $ost->getConfig()->getClientLogo()))) { return INCLUDE_DIR.'fpdf/print-logo.png';}My suggestion is to remove / comment out the if clause and just use return INCLUDE_DIR.'fpdf/print-logo.png'; to get just the image from include/fpdf/print-logo.png.As final step you'd need to point to an alternative file that you copy to include/fpdf/ e.g. company-logo.png which would then be look like this finally:// if (!function_exists('imagecreatefromstring')// || (!($logo = $ost->getConfig()->getClientLogo()))) {// return INCLUDE_DIR.'fpdf/print-logo.png';// }return INCLUDE_DIR.'fpdf/company-logo.png';Since I have not tested it, please make sure to make a backup first and just give it a try.Cheers,Michael
@Chefkeks, thnx!I'll try do that, but the second logo (company-logo.png) not visible. =(
@Chefkeks, im do it =))))I'm add code after line 69:function getLogoFile2() {
global $ost;
if (!function_exists('imagecreatefromstring')
|| (!($logo = $ost->getConfig()->getClientLogo()))) {
return INCLUDE_DIR.'fpdf/print-logo2.png';
}
$tmp = tempnam(sys_get_temp_dir(), 'pdf') . '.jpg';
$img = imagecreatefromstring($logo->getData());
// Handle transparent images with white background
$img2 = imagecreatetruecolor(imagesx($img), imagesy($img));
$white = imagecolorallocate($img2, 255, 255, 255);
imagefill($img2, 0, 0, $white);
imagecopy($img2, $img, 0, 0, 0, 0, imagesx($img), imagesy($img));
imagejpeg($img2, $tmp);
return $tmp;
}Then Im add code after line 79:$logo = $this->getLogoFile2();//2nd logo
$this->Image($logo, $this->lMargin, $this->tMargin, 0, 20, $this->RMargin, 10);
if (strpos($logo, INCLUDE_DIR) === false)
unlink($logo);Then I saw my 2nd logo as i Wanted =)
@[deleted] ty) close topick
Very welcome.Closing and marking as resolved.