feat(webstatement): tambahkan pengaturan ukuran kertas A4 pada konversi HTML ke PDF
- Menambahkan pengaturan ukuran kertas A4 pada proses konversi HTML ke PDF di `ConvertHtmlToPdfJob`:
- Menggunakan metode `setPaper('A4', 'portrait')` untuk menetapkan standar ukuran dan orientasi kertas.
- Memperbarui log proses konversi agar mencantumkan informasi ukuran kertas yang digunakan.
- Tujuan perubahan ini adalah memastikan tampilan PDF lebih terstandarisasi sesuai kebutuhan dokumen.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -88,13 +88,16 @@ class ConvertHtmlToPdfJob implements ShouldQueue
|
|||||||
// Read HTML content
|
// Read HTML content
|
||||||
$htmlContent = File::get($htmlFilePath);
|
$htmlContent = File::get($htmlFilePath);
|
||||||
|
|
||||||
// Convert HTML to PDF
|
// Convert HTML to PDF with A4 size
|
||||||
$pdf = PDF::loadHTML($htmlContent);
|
$pdf = PDF::loadHTML($htmlContent);
|
||||||
|
|
||||||
|
// Set paper size to A4
|
||||||
|
$pdf->setPaper('A4', 'portrait');
|
||||||
|
|
||||||
// Save PDF file
|
// Save PDF file
|
||||||
$pdf->save($pdfFilePath);
|
$pdf->save($pdfFilePath);
|
||||||
|
|
||||||
Log::info("Converted {$htmlFilePath} to {$pdfFilePath}");
|
Log::info("Converted {$htmlFilePath} to {$pdfFilePath} with A4 size");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error("Error converting {$htmlFilePath} to PDF: " . $e->getMessage());
|
Log::error("Error converting {$htmlFilePath} to PDF: " . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user