Added logs in sticker pdf service
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m35s
Laravel Larastan / larastan (pull_request) Failing after 4m22s

This commit is contained in:
dhanabalan
2026-09-29 18:15:25 +05:30
parent 0f72b3a559
commit f6ebc1ce65

View File

@@ -20,6 +20,7 @@ use TCPDF_FONTS;
class StickerPdfService class StickerPdfService
{ {
public function generateStickerItem(string $stickerId, Collection $dynamicElements, ?ItemCharacteristic $itemCharacteristic) public function generateStickerItem(string $stickerId, Collection $dynamicElements, ?ItemCharacteristic $itemCharacteristic)
{ {
$dynamicValueMap = []; $dynamicValueMap = [];
@@ -1123,18 +1124,6 @@ class StickerPdfService
if ($row->characteristics_type == 'to_serial_number') { if ($row->characteristics_type == 'to_serial_number') {
$textValue = 'TO__SERIAL_NUMBER__'; $textValue = 'TO__SERIAL_NUMBER__';
} }
// if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
// $column = 'zmm_grwt_pump';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
// if ($row->characteristics_type == 'zmm_newt_pump_dual') {
// $column = 'zmm_newt_pump';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
if ($row->characteristics_type == 'zmm_grwt_pump_dual') { if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
$column = 'zmm_grwt_pump'; $column = 'zmm_grwt_pump';
@@ -1150,12 +1139,6 @@ class StickerPdfService
? number_format((float) $itemCharacteristic->{$column} * 2, 3, '.', '') ? number_format((float) $itemCharacteristic->{$column} * 2, 3, '.', '')
: ''; : '';
} }
// if ($row->characteristics_type == 'mrp_dual') {
// $column = 'zmm_mrp';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
if ($row->characteristics_type == 'mrp_dual') { if ($row->characteristics_type == 'mrp_dual') {
$column = 'zmm_mrp'; $column = 'zmm_mrp';
@@ -1179,19 +1162,36 @@ class StickerPdfService
if (!empty($row->string_font)) { if (!empty($row->string_font)) {
$fontFile = storage_path('app/private/fonts/' . $row->string_font . '.ttf'); $fontFile = storage_path('app/private/fonts/' . $row->string_font . '.ttf');
Log::info($fontFile, [
'font' => $row->string_font,
]);
if (file_exists($fontFile)) { if (file_exists($fontFile)) {
\Log::info('TCPDF FONT DEBUG', [
'K_PATH_FONTS' => defined('K_PATH_FONTS') ? K_PATH_FONTS : 'NOT DEFINED',
'fontFile' => $fontFile,
'php_sapi' => PHP_SAPI,
]);
$font = TCPDF_FONTS::addTTFfont( $font = TCPDF_FONTS::addTTFfont(
$fontFile, $fontFile,
'TrueTypeUnicode', 'TrueTypeUnicode',
'', '',
32 32
); );
Log::info('FONT CONVERSION RESULT', [
'result' => $font,
]);
} else { } else {
Log::warning('FONT FILE NOT FOUND', [
'font_file' => $fontFile,
]);
$font = 'helvetica'; $font = 'helvetica';
} }
} else { } else {
$font = 'helvetica'; $font = 'helvetica';
} }
} }
$templateElements[] = $templateElements[] =
@@ -1461,6 +1461,7 @@ class StickerPdfService
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode) public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
{ {
Log::info('PDF DEBUG: ENTERED generateBulkFromTemplate');
$stickerWidth = (float) $template['width']; $stickerWidth = (float) $template['width'];
$stickerHeight = (float) $template['height']; $stickerHeight = (float) $template['height'];
$stickerId = $template['sticker_id'] ?? null; $stickerId = $template['sticker_id'] ?? null;
@@ -1663,6 +1664,12 @@ class StickerPdfService
} }
} }
Log::info('PDF FONT DEBUG', [
'font' => $element['font'],
'size' => $element['size'],
'text' => $textValue,
]);
$pdf->SetFont( $pdf->SetFont(
$element['font'], $element['font'],
'', '',