Dobrý deň,
prosim Vás potrebujem poradiť skúšam generovať pdf s Laravelom.
Mám problém pri generovani šablony ak si dám zobraziť šablonu samostatnú tak diakritika sa zobrazí bez problémov, ale ako dám generovať do PDF tak sa diaktrikia prestane zobrazovať.
public function invoice(Pay $pay)
{
$pdf = PDF::loadView('pay.invoice', ['pay' => $pay,
'company' => json_decode($pay->company),
'website' => DB::table('websites')->where('id', $pay->website)->first(),
'tarif' => json_decode($pay->tarif)]);
return $pdf->download('itsolutionstuff.pdf');
}
blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PDF Demo in Laravel 7</title>
</head>
<body>
<header class="clearfix">
<div id="logo">
<img src="logo.png">
</div>
<div id="company">
<h2 class="name">{{ $company->name }}</h2>
<div>{{ $company->address }}</div>
<div>IČO: {{ $company->ico }}</div>
<div>DIČ: {{ $company->dic }}</div>
@if($company->dph)
<div>DPH: {{ $company->dph }}</div>
@endif
<div>{{ $company->note }}</div>
</div>
</div>
</header>
<main>
<div id="details" class="clearfix">
<div id="client">
<div class="to">Odběratel:</div>
<h2 class="name">{{ $website->firma }}</h2>
<div class="address">{{ $website->adresa }}</div>
<div class="address">IČO: {{ $website->ico }}</div>
<div class="address">DIČ: {{ $website->dic }}</div>
@if($company->dph)
<div class="address">DPH: {{ $website->dph }}</div>
@endif
</div>
<div id="invoice">
<h1>{{ $pay->number }}</h1>
<div class="date">Datum dodání: {{ $pay->created_at }}</div>
<div class="date">Datum splatnosti: {{ $pay->due }}</div>
</div>
</div>
<table border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<th class="no">#</th>
<th class="desc">Položka</th>
<th class="unit">Cena za ks</th>
<th class="qty">Počet</th>
<th class="total">Cena spolu</th>
</tr>
</thead>
<tbody>
<tr>
<td class="no">01</td>
<td class="desc">Tarif </td>
<td class="unit">{{ $tarif->price }} CZK</td>
<td class="qty">1</td>
<td class="total">{{ $tarif->price }} CZK</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td colspan="2">Cena spolu</td>
<td>{{ $tarif->price }} CZK</td>
</tr>
@if($company->dph)
<tr>
<td colspan="2"></td>
<td colspan="2">DPH 20%</td>
<td>{{ ($tarif->price / 100) * 20}} CZK</td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">Cena celkom</td>
<td>{{ (($tarif->price / 100) * 20) + $tarif->price}} CZK</td>
</tr>
@endif
</tfoot>
</table>
<div id="thanks">Děkujeme za důvěru!</div>
<div id="notices">
<div>Poznámka:</div>
<div class="notice">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
</div>
</main>
<footer>
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</footer>
</body>
</html>
Ďakujem za radu :)