【发布时间】:2015-10-24 02:49:26
【问题描述】:
我正在使用 Laravel-snappy 并尝试绝对定位 6 列,以便在每页上打印 3 列..
查看
...
body {
position: relative;
}
.col1-1 {
text-align: right;
background-color: #00dd00;
position: absolute;
top: 0px;
left: 0px;
width: 250px;
height: 11in;
}
.col1-2 {
text-align: right;
position: absolute;
background-color: #1c94c4;
top: 0px;
left: 270px;
width: 250px;
height: 11in;
}
.col1-3 {
text-align: right;
background-color: #46b8da;
position: absolute;
top: 0px;
left: 540px;
width: 250px;
height: 11in;
}
.col2-1 {
text-align: right;
background-color: #dd0100;
position: absolute;
top: 11in;
left: 0px;
width: 250px;
height: 11in;
}
.col2-2 {
text-align: right;
position: absolute;
background-color: #c4770b;
top: 11in;
left: 270px;
width: 250px;
height: 11in;
}
.col2-3 {
text-align: right;
background-color: #da0073;
position: absolute;
top: 11in;
left: 540px;
width: 250px;
height: 11in;
}
</style>
</head>
<body>
<div class="col1-1"></div>
<div class="col1-2"></div>
<div class="col1-3"></div>
<div class="col2-1"></div>
<div class="col2-2"></div>
<div class="col2-3"></div>
....
控制器
return $pdf->stream('page.pdf');
return view('page');
问题是列短了,所以第二行从第一页开始...
我将页面大小设置为字母
'pdf' => array(
'enabled' => true,
'binary' => 'C:\wkhtmltopdf\bin\wkhtmltopdf',
'timeout' => false,
'options' => array('page-size'=>'letter'),
所以我不太确定下一步该做什么......
我觉得这是一个缩放问题?
如果我不使用 Snappy,而只是在屏幕上显示页面并将屏幕打印为 PDF,结果会好得多(只有几个像素),但我当然需要将页面返回为PDF。
【问题讨论】: