Footer before pagebreak #65
Replies: 1 comment 1 reply
-
As far as I see your code the footer code does not have css styles and footers are added automatically by chaining them, you should loop and break the page at the end of every looped item if you want to see a footer as you want. In this case you probably want to have a footer code in a blade component
<style>
.footer {
font-size: 12px;
margin: 10px auto;
}
</style>
<footer>
<div>
<p>Page @pageNumber of @totalPages</p>
</div>
<div>
<img src="{{asset('img/logo.png')}}" />
</div>
</footer> Then in your controller return your view in this way: $pdf = pdf()->view('my-pdf')->footerView(components.footer)->name('name.pdf') Then in your template the footer markup is not required anymore: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=Kadwa:wght@700&family=Lato:ital,wght@1,300&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap"
rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<title>{{$project->getTestDocumentTitle()}}</title>
</head>
<body>
@include('pdfs.frontpage', ['title' => $project->getTestDocumentTitle() ])
@pageBreak
<div style="" class="shadow bg-white p-5 m-12 rounded-lg">
<h2 class="text-2xl pb-6">@lang('testcase.testcase_plural')</h2>
<div>
/// content
</div>
</div>
@pageBreak
@foreach($testcases as $index => $testcase)
<div class="shadow bg-white p-5 m-12 rounded-lg">
/// some content
</div>
@pageBreak
@endforeach
</body>
</html> |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to add a footer to all my pages but the first one. I've tried using $pdf->footerView() and $pdf->footerHtml but both seem to not do anything while I am able to find it on the page using CTRL + F but can't see it. I need the footer to be on the bottom of the page it's on, but when I use position absolute all the page footers will be on the first page instead of their own. This is my blade that I load with pdf()->view('my-pdf')->name('name.pdf');
Beta Was this translation helpful? Give feedback.
All reactions