fix: [approvals] 재직증명서 레이아웃 개선 - A4 용지 내 수직 배분 조정

- HTML 미리보기: @page A4 설정, cert-page wrapper, padding/font-size 증가
- PDF(TCPDF): 상단여백 추가, 섹션간격 확대, rowHeight 8→10, 본문 10→11pt
- 증명문구/날짜 12→14pt, 회사명 14→16pt
- create/show 동일 적용
This commit is contained in:
김보곤
2026-03-06 10:25:55 +09:00
parent f00eee7f12
commit f83986aec3
3 changed files with 62 additions and 59 deletions

View File

@@ -76,21 +76,24 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->SetMargins(20, 20, 20);
$pdf->SetMargins(20, 30, 20);
$pdf->SetAutoPageBreak(true, 20);
$font = $this->getKoreanFont();
$pdf->AddPage();
// 상단 여백
$pdf->Ln(10);
// 제목
$pdf->SetFont($font, 'B', 22);
$pdf->SetFont($font, 'B', 24);
$pdf->Cell(0, 20, '재 직 증 명 서', 0, 1, 'C');
$pdf->Ln(8);
$pdf->Ln(12);
// === 1. 인적사항 ===
$pdf->SetFont($font, 'B', 12);
$pdf->Cell(0, 8, '1. 인적사항', 0, 1, 'L');
$pdf->SetFont($font, 'B', 13);
$pdf->Cell(0, 10, '1. 인적사항', 0, 1, 'L');
$pdf->Ln(2);
$this->addTableRow($pdf, $font, [
@@ -100,11 +103,11 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
$this->addTableRow($pdf, $font, [
['주 소', $content['address'] ?? '-', 0],
]);
$pdf->Ln(6);
$pdf->Ln(8);
// === 2. 재직사항 ===
$pdf->SetFont($font, 'B', 12);
$pdf->Cell(0, 8, '2. 재직사항', 0, 1, 'L');
$pdf->SetFont($font, 'B', 13);
$pdf->Cell(0, 10, '2. 재직사항', 0, 1, 'L');
$pdf->Ln(2);
$this->addTableRow($pdf, $font, [
@@ -123,34 +126,34 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
$this->addTableRow($pdf, $font, [
['재직기간', $hireDateDisplay, 0],
]);
$pdf->Ln(6);
$pdf->Ln(8);
// === 3. 발급정보 ===
$pdf->SetFont($font, 'B', 12);
$pdf->Cell(0, 8, '3. 발급정보', 0, 1, 'L');
$pdf->SetFont($font, 'B', 13);
$pdf->Cell(0, 10, '3. 발급정보', 0, 1, 'L');
$pdf->Ln(2);
$this->addTableRow($pdf, $font, [
['사용용도', $content['purpose'] ?? '-', 0],
]);
$pdf->Ln(12);
$pdf->Ln(20);
// 증명 문구
$pdf->SetFont($font, '', 12);
$pdf->Cell(0, 10, '위 사항을 증명합니다.', 0, 1, 'C');
$pdf->Ln(6);
$pdf->SetFont($font, '', 14);
$pdf->Cell(0, 12, '위 사항을 증명합니다.', 0, 1, 'C');
$pdf->Ln(10);
// 발급일
$issueDate = $content['issue_date'] ?? date('Y-m-d');
$issueDateFormatted = $this->formatDate($issueDate);
$pdf->SetFont($font, 'B', 12);
$pdf->Cell(0, 10, $issueDateFormatted, 0, 1, 'C');
$pdf->Ln(12);
$pdf->SetFont($font, 'B', 14);
$pdf->Cell(0, 12, $issueDateFormatted, 0, 1, 'C');
$pdf->Ln(20);
// 회사명 + 대표이사
$ceoName = $content['ceo_name'] ?? '';
$pdf->SetFont($font, 'B', 14);
$pdf->Cell(0, 10, ($content['company_name'] ?? '').' 대표이사 '.$ceoName.' (인)', 0, 1, 'C');
$pdf->SetFont($font, 'B', 16);
$pdf->Cell(0, 12, ($content['company_name'] ?? '').' 대표이사 '.$ceoName.' (인)', 0, 1, 'C');
$pdfContent = $pdf->Output('', 'S');
$fileName = '재직증명서_'.($content['name'] ?? '').'.pdf';
@@ -167,24 +170,24 @@ public function generatePdfResponse(array $content): \Illuminate\Http\Response
private function addTableRow(\TCPDF $pdf, string $font, array $cells): void
{
$pageWidth = $pdf->getPageWidth() - 40; // margins
$rowHeight = 8;
$rowHeight = 10;
$thWidth = 30;
if (count($cells) === 1) {
// 단일 셀: th + td (전체 너비)
$pdf->SetFont($font, 'B', 10);
$pdf->SetFont($font, 'B', 11);
$pdf->SetFillColor(248, 249, 250);
$pdf->Cell($thWidth, $rowHeight, $cells[0][0], 1, 0, 'L', true);
$pdf->SetFont($font, '', 10);
$pdf->SetFont($font, '', 11);
$pdf->Cell($pageWidth - $thWidth, $rowHeight, $cells[0][1], 1, 1, 'L');
} else {
// 복수 셀: th+td + th+td
$tdWidth = ($pageWidth - $thWidth * 2) / 2;
foreach ($cells as $cell) {
$pdf->SetFont($font, 'B', 10);
$pdf->SetFont($font, 'B', 11);
$pdf->SetFillColor(248, 249, 250);
$pdf->Cell($thWidth, $rowHeight, $cell[0], 1, 0, 'L', true);
$pdf->SetFont($font, '', 10);
$pdf->SetFont($font, '', 11);
$pdf->Cell($tdWidth, $rowHeight, $cell[1], 1, 0, 'L');
}
$pdf->Ln();