Open hamza-saqib opened 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.
Greeting everyone, before you start remember that you're converting html to pdf, so when the html page is longer than 297mm, another page created.
What I did to make multiple pages is by send from the backend a collection of data, then in the html I print the data using foreach, lastly to make every data has it's one page I did some css. e.g.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PDF</title>
<!-- Styles -->
<style>
html, body {
height: 100%;
margin: 0;
}
.container {
text-align: center;
height: 200mm; // to makes each ticket has it's own page
margin: 0 auto;
padding: 0;
}
</style>
</head>
<body>
@foreach ($orderTicket as $ticket)
<div class="container">
<h1>Ticket Title: {{ $eventName }}</h1>
<h2>Code:{{ $ticket->code }} </h2>
<img src="data:image/png;base64,{{ base64_encode(QrCode::format('png')->size(150)->generate($ticket->code)); }}" alt="QR Code">
</div>
@endforeach
</body>
</html>
I hope now it's clear how pdf has multiple pages.
actualy i have different school vouchers wihich one page only, working fine with one page but i need to generate vouchers of all class or school in one pdf.