admin管理员组文章数量:1390204
I have been exploring the Laravel pdf package and I am facing this issue where i want to have a separate header in the first page. There are two issues i am facing. If I can solve one of the issues, I will be able to achieve this:
- I am unable to hide the first page header. If I can achieve this, I can put the first page header in the main page content and make @page:first top margin at a minimum value.
- Use a separate header on the first page. I am unable to use a separate header on the first page, in the header() blade file I use. I am assuming that this is because there is no way php knows (AFAIK) on which page I am on.
Here are the header file i am working with
<style>
header {
margin-right: 2cm;
margin-left: 2.5cm;
margin-top: 1.5cm;
text-align: center !important;
}
table {
table-layout: fixed;
width: 100%;
}
.first-page {
display: none;
font-size: 12px;
}
.other-pages {
display: block;
font-size: 12px;
}
@page:first {
.first-page {
display: block;
}
.other-pages {
display: none;
}
}
</style>
<header>
<div class="first-page">First page content</div>
<div class="other-pages">Other pages content</div>
</header>
In the above file, I am trying to hide the div with class first-page in the other pages and div with other-pages in the first page. As in documentation of the package, I have to use CSS of header in the same file as the content. Do you guys have any idea why this is not working
I did try both the ways explained above. As i mentioned before, if I can solve one of the ways, I can achieve what I am trying to do.
本文标签: How to have a separate header in first page of pdf using spatie laravel pdf packageStack Overflow
版权声明:本文标题:How to have a separate header in first page of pdf using spatie laravel pdf package - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744748768a2623046.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论