我正在尝试将刀片视图转换为pdf。如果我使用普通文本我能够生成pdf。我的刀片模板中的图像很少,因此我无法生成pdf。
这是我的刀片模板代码。
<html>
<head>
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row col-md-12">
<div class="col-md-5">
<table>
<tr>
<td>ID</td>
<td>:</td>
<td>CO12345</td>
</tr>
<tr>
<td>Date</td>
<td>:</td>
<td>CO12345</td>
</tr>
<tr>
<td>Contract/PO #</td>
<td>:</td>
<td>C122</td>
</tr>
<tr>
<td>Job ID</td>
<td>:</td>
<td>0001</td>
</tr>
<tr>
<td>Client Name</td>
<td>:</td>
<td>Hong</td>
</tr>
<tr>
<td>Project</td>
<td>:</td>
<td>Lake Nona Place</td>
</tr>
<tr>
<td>Address</td>
<td>:</td>
<td>123 Roy street, Suit 107, Lake Nona, FL 32817</td>
</tr>
</table>
</div>
<div class="col-md-7">
<img src="images/logo.jpg " class="float-right img-responsive img-thumbnail">
</div>
</div>
<div class="my-auto mx-auto text-center">
<h4>Change Order</h4>
</div>
<div class="row col-md-12">
<table class="table table-bordered">
<thead>
<tr>
<td><b><p class="text-md-center">Line</p></b></td>
<td><b><p class="text-md-center">Title</p></b></td>
<td><b><p class="text-md-center">Description</p></b></td>
<td><b><p class="text-md-center">Total</p></b></td>
</tr>
</thead>
<body>
<tr>
<td><p class="text-md-center">1</p></td>
<td><p class="text-md-center">B12, Unit 114</p></td>
<td><p class="text-md-center">Replace damage carpate in master bedroom.</p></td>
<td><p class="text-md-center">$250</p></td>
</tr>
<tr>
<td colspan="3"></td>
<td><p class="text-md-center">$250</p></td>
</tr>
</body>
</table>
</div>
<hr/>
<div class="col-md-12 row">
<div class="col-md-3">
<img src="images/logo.jpg " class="float-right img-responsive img-thumbnail">
</div>
<div class="col-md-3">
<img src="images/logo.jpg " class="float-right img-responsive img-thumbnail">
</div>
<div class="col-md-3">
<img src="images/logo.jpg " class="float-right img-responsive img-thumbnail">
</div>
<div class="col-md-3">
<img src="images/logo.jpg " class="float-right img-responsive img-thumbnail">
</div>
</div>
<hr/>
<div class="my-auto">
<p>
I hereby authorize <b>John</b> to perform the extra work listed above. I further state that I am authorized to
approve this extra work and that my signature below serves as a payment commitment of such.
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
</body>
<html>
以下是来自控制器类的代码片段,它生成pdf。
public function generatePdf(){
$pdf = PDF::loadView('template1');
return $pdf->download('template1.pdf');
}
我正在使用https://github.com/barryvdh/laravel-dompdf作为pdf。
答案 0 :(得分:0)
你可以增加php max_execution_time。但不建议这样做,因为如果有许多用户同时生成PDF,可能会导致服务器崩溃。 你需要尝试的事情:
来自react-native run-android --variant=release
github:https://github.com/barryvdh/laravel-dompdf/issues/184
希望有所帮助
答案 1 :(得分:0)
使用public_path()
代替asset()
。