157 lines
6.4 KiB
PHP
157 lines
6.4 KiB
PHP
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||
<meta charset="utf-8">
|
||
<title>{{ __('Posts') }}</title>
|
||
<style>
|
||
@font-face {
|
||
font-family: 'Oswald';
|
||
src: url('/fonts/static/oswald/Oswald-Regular.ttf') format('truetype');
|
||
font-weight: 400;
|
||
font-style: normal;
|
||
}
|
||
@font-face {
|
||
font-family: 'Oswald';
|
||
src: url('/fonts/static/oswald/Oswald-SemiBold.ttf') format('truetype');
|
||
font-weight: 600;
|
||
font-style: normal;
|
||
}
|
||
@font-face {
|
||
font-family: 'Poppins';
|
||
src: url('/fonts/static/poppins/Poppins-Regular.otf') format('opentype');
|
||
font-weight: normal;
|
||
font-style: normal;
|
||
}
|
||
|
||
@page { margin: 0; }
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
|
||
html, body {
|
||
width: 210mm;
|
||
height: 297mm;
|
||
background-color: #1a1a2e;
|
||
font-family: DejaVu Sans, Arial, sans-serif;
|
||
color: #ffffff;
|
||
}
|
||
|
||
@php
|
||
// 1-up: portrait A4, 1 col × 1 row, card 210×297mm, scale 1.0
|
||
// 2-up: landscape A4, 2 cols × 1 row, each card 148×210mm (A5 portrait), scale ≈ 0.705
|
||
// 4-up: portrait A4, 2 cols × 2 rows, each card 105×148mm, scale 0.498
|
||
$cols = $perPage >= 2 ? 2 : 1;
|
||
$rows = $perPage === 4 ? 2 : 1;
|
||
$cardW = $perPage === 4 ? 105 : ($perPage === 2 ? 148 : 210);
|
||
$cardH = $perPage === 4 ? 148 : ($perPage === 2 ? 210 : 297);
|
||
|
||
$scale = match($perPage) {
|
||
2 => 148/210, // A5 portrait ≈ 0.705
|
||
4 => 0.498,
|
||
default => 1.0,
|
||
};
|
||
|
||
// Scaled measurements (baseline from posts/pdf.blade.php A4 layout)
|
||
$margin = round(20 * $scale, 1) . 'mm';
|
||
$logoTop = round(14 * $scale, 1) . 'mm';
|
||
$logoRight = round(20 * $scale, 1) . 'mm';
|
||
$logoW = round(75 * $scale, 1) . 'mm';
|
||
$logoH = round(53 * $scale, 1) . 'mm';
|
||
$titleMarginTop = round(70 * $scale, 1) . 'mm';
|
||
$titleFontMaxPt = round(54 * $scale, 1); // numeric, no unit
|
||
$titleContainerMm = $cardW - 2 * 20 * $scale; // card width minus left+right margin
|
||
$titleFont = $titleFontMaxPt . 'pt'; // fallback string for non-partial use
|
||
$catFont = round(17 * $scale, 1) . 'pt';
|
||
$catPadH = round(16 * $scale, 1) . 'px';
|
||
$catPadV = round(8 * $scale, 1) . 'px';
|
||
$excerptFont = round(17.5 * $scale, 1) . 'pt';
|
||
$excerptMT = round(6 * $scale, 1) . 'mm';
|
||
$excerptMaxH = round(60 * $scale, 1) . 'mm';
|
||
$bottomBottom= round(20 * $scale, 1) . 'mm';
|
||
$qrSize = round(20 * $scale, 1) . 'mm';
|
||
$qrCellW = round(22 * $scale, 1) . 'mm';
|
||
$qrCellPad = round(4 * $scale, 1) . 'mm';
|
||
$venueFont = round(22.5 * $scale, 1) . 'pt';
|
||
$dateFont = round(18 * $scale, 1) . 'pt';
|
||
$footerFont = round(10.4 * $scale, 1) . 'pt';
|
||
$footerMT = round(8 * $scale, 1) . 'mm';
|
||
@endphp
|
||
|
||
@if($perPage === 2)
|
||
@page { size: A4 landscape; margin: 0; }
|
||
html, body { width: 297mm; height: 210mm; }
|
||
@endif
|
||
|
||
.page-table {
|
||
width: {{ $perPage === 2 ? '297mm' : '210mm' }};
|
||
border-collapse: collapse;
|
||
}
|
||
.page-table-break { page-break-after: always; }
|
||
.page-table tr { height: {{ $cardH }}mm; }
|
||
.card-cell {
|
||
width: {{ $cardW }}mm;
|
||
height: {{ $cardH }}mm;
|
||
overflow: hidden;
|
||
position: relative;
|
||
vertical-align: top;
|
||
background-color: #1a1a2e;
|
||
}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
|
||
@php
|
||
$cardsPerPage = $rows * $cols;
|
||
$pages = array_chunk($posts, $cardsPerPage);
|
||
@endphp
|
||
|
||
@foreach($pages as $pageIndex => $pagePosts)
|
||
@php
|
||
$padded = array_pad($pagePosts, $cardsPerPage, null);
|
||
$isLast = $pageIndex === count($pages) - 1;
|
||
@endphp
|
||
|
||
<table class="page-table {{ $isLast ? '' : 'page-table-break' }}">
|
||
@for($row = 0; $row < $rows; $row++)
|
||
<tr>
|
||
@for($col = 0; $col < $cols; $col++)
|
||
@php $idx = $row * $cols + $col; $data = $padded[$idx] ?? null; @endphp
|
||
<td class="card-cell">
|
||
@if($data)
|
||
@include('posts._pdf-card-bw', array_merge($data, [
|
||
'scale' => $scale,
|
||
'cardW' => $cardW,
|
||
'cardH' => $cardH,
|
||
'margin' => $margin,
|
||
'logoTop' => $logoTop,
|
||
'logoRight' => $logoRight,
|
||
'logoW' => $logoW,
|
||
'logoH' => $logoH,
|
||
'titleMarginTop' => $titleMarginTop,
|
||
'cardTitleMaxPt' => $titleFontMaxPt,
|
||
'cardTitleContainerMm' => $titleContainerMm,
|
||
'catFont' => $catFont,
|
||
'catPadH' => $catPadH,
|
||
'catPadV' => $catPadV,
|
||
'excerptFont' => $excerptFont,
|
||
'excerptMT' => $excerptMT,
|
||
'excerptMaxH' => $excerptMaxH,
|
||
'bottomBottom' => $bottomBottom,
|
||
'qrSize' => $qrSize,
|
||
'qrCellW' => $qrCellW,
|
||
'qrCellPad' => $qrCellPad,
|
||
'venueFont' => $venueFont,
|
||
'dateFont' => $dateFont,
|
||
'footerFont' => $footerFont,
|
||
'footerMT' => $footerMT,
|
||
]))
|
||
@endif
|
||
</td>
|
||
@endfor
|
||
</tr>
|
||
@endfor
|
||
</table>
|
||
@endforeach
|
||
|
||
</body>
|
||
</html>
|