laravel - Create pdf for signature list using Laravel and dompdf
问题描述
I'm stuck on a problem that I thought should be straightforward, but dompdf refuses to make my pdf as I want it. I want a pdf that my end user should print out containing a list with users with their names and a line where they should sign. Something like this:
I'm trying to do it like this:
<style>
.lineContainer div {height: 30px;}
.nounderscore {border-bottom: 0px;float:left;}
.underscore {border-bottom: 1px solid #000; overflow: hidden;}
</style>
@foreach($users as $user)
<div class="lineContainer">
<div class="nounderscore">{{$user->name}}</div>
<div class="underscore"></div>
</div>
@endforeach
This works fine when rendered as html, but when I use it for a pdf file it ends up with my underline starting from the far left end of the page, so also the names are underlined. Any ideas how to do this in a way that works with dompdf?
解决方案
<style>
li{
padding-bottom: 25px;
list-style: none;
}
.line{
padding-right: 15em;
margin: 0 1em;
border-bottom: 1px solid grey;
}
</style>
<ul>
@foreach($users as $user)
<li>{{$user->name}}<span class="line"></span></li>
@endforeach
</ul>
静态数据答案预览: https ://jsfiddle.net/wz1vpsnx/
推荐阅读
- firebase - 在 Firestore 中收听查询结果时记录读取含义
- typescript - 为什么在编写 TypeScript 时,Visual Studio Code 中的括号会变成红色?
- android - 膨胀类 com.google.android.material.bottomnavigation.BottomNavigationView 时出错-
- javascript - 如何避免在 Webpack 中的异步中检查等待
- azure-data-factory - 如何从数据流(Azure 数据工厂)中的 json 源中删除根?
- javascript - 彼此垂直绘制条形图d3.js
- git - 从干净的工作目录执行 git pull 后,文件传递到修改
- python - Cron 不会自动启动
- node.js - 为什么我的方法不能解决间隔调度算法?
- c# - 在 C# 中进行泛型搜索的函数